问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
python 抓出来的结果 用socket 或 scapy抓的结果一致
>>> pkts[0]
<Ether dst=f8:e4:3b:6d:08:86 src=00:0a:35:01:fe:c0 type=IPv4 |<IP version=4 ihl=5 tos=0x0 len=60 id=9 flags=DF frag=0 ttl=128 proto=udp chksum=0xb752 src=192.168.0.2 dst=192.168.0.3 |<UDP sport=8080 dport=32896 len=40 chksum=0x0 |<Raw load='\\xff\\xe5\\xa0;\\xff\\xed\\xb0Y\\xff\\xe5\\xa0;\\xff\\xed\\xb0Y\\xff\\xe5\\xa0:\\xff\\xed\\xb0X\\xff\\xe5\\xa0;\\xff\\xed\\xb0X'
用wireshark抓取的结果
Frame 5827: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface \Device\NPF_{7FDA44A8-BF66-4BAA-9A2B-68B6690128E1}, id 0
Ethernet II, Src: Xilinx_01:fe:c0 (00:0a:35:01:fe:c0), Dst: ASIXElec_6d:08:86 (f8:e4:3b:6d:08:86)
Internet Protocol Version 4, Src: 192.168.0.2, Dst: 192.168.0.3
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total Length: 60
Identification: 0x00ac (172)
Flags: 0x40, Don't fragment
...0 0000 0000 0000 = Fragment Offset: 0
Time to Live: 128
Protocol: UDP (17)
Header Checksum: 0x95af [validation disabled]
[Header checksum status: Unverified]
Source Address: 192.168.0.2
Destination Address: 192.168.0.3
User Datagram Protocol, Src Port: 8080, Dst Port: 32896
Source Port: 8080
Destination Port: 32896
Length: 40
Checksum: 0x0000 [zero-value ignored]
[Stream index: 0]
[Timestamps]
UDP payload (32 bytes)
Data (32 bytes)
Data: ffe5a03affedac56ffe5a03affedac58ffe5a03bffedac59ffe5a03bffedac57
[Length: 32]
运行结果及报错内容
python 抓出来的数据,len=40,去掉UDP head ,应该是32个byte,但只有24个byte的数据。