我正在尝试从原始字符串构建 scapy 以太包。
packet = packets[4] # this is the packet I get from pcap file
str_packet = str(packet) # I get string form from here
packet2 = Ether(str_packet) # I try to make packet2 from the string
packet.show()
packet2.show()
此处的输出显示以太包 2 没有很好地形成。
任何想法,如何从原始字符串中获取 packet2 ?
###[ Ethernet ]###
dst = 80:e6:50:14:3d:52
src = 2a:74:02:9b:85:64
type = IPv4
###[ IP ]###
version = 4
ihl = 5
tos = 0x0
len = 52
id = 44178
flags =
frag = 0
ttl = 88
proto = tcp
chksum = 0x5503
src = 157.240.13.35
dst = 172.20.10.7
\options \
###[ TCP ]###
sport = https
dport = 60643
seq = 905248884
ack = 938762494
dataofs = 8
reserved = 0
flags = A
window = 113
chksum = 0x43e9
urgptr = 0
options = [('NOP', None), ('NOP', None), ('Timestamp', (2596765797, 886096700))]
###[ Raw ]###
load = "b'\\x80\\xe6P\\x14=R*t\\x02\\x9b\\x85d\\x08\\x00E\\x00\\x004\\xac\\x92\\x00\\x00X\\x06U\\x03\\x9d\\xf0\\r#\\xac\\x14\\n\\x07\\x01\\xbb\\xec\\xe35\\xf5\\x00t7\\xf4`\\xfe\\x80\\x10\\x00qC\\xe9\\x00\\x00\\x01\\x01\\x08\\n\\x9a\\xc7\\x80e4\\xd0\\xc3<'"