标签:pre utf-8 alt com struct pac csharp random source
问题:使用struct来构建tcp数据包
#coding=utf-8 from random import randint import struct #源端口 source_port = randint(1,65535); #目的端口 dst_port = 23; #32位确认序号 ack_sn=0; #32序号 sn=randint(1,65535*65535); #数据包窗口 windows=4096 data=struct.pack(‘>HHIIBBH‘,source_port,dst_port,sn,ack_sn,80,2,windows); hd = open(‘data.bin‘,‘wb‘); hd.write(data); hd.close();
标签:pre utf-8 alt com struct pac csharp random source
原文地址:https://www.cnblogs.com/zh718594493/p/12359549.html