Python 将hextump(数据包)保存到scapy中的列表
是否有任何方法可以将hextump()保存到字节列表中,以便通过索引访问该列表。我需要的是这样Python 将hextump(数据包)保存到scapy中的列表,python,scapy,hexdump,Python,Scapy,Hexdump,是否有任何方法可以将hextump()保存到字节列表中,以便通过索引访问该列表。我需要的是这样 byte = hexdump(packet) for i in range(0, len(byte)): print %x byte[i] 可通过调用str(packet)访问数据包的字节内容,如下所示: content = str(packet) # decoded hex string, such as '\xde\xad\xbe\xef' print content for byte in c
byte = hexdump(packet)
for i in range(0, len(byte)):
print %x byte[i]
可通过调用
str(packet)
访问数据包的字节内容,如下所示:
content = str(packet) # decoded hex string, such as '\xde\xad\xbe\xef'
print content
for byte in content:
pass # do something with byte
编辑-指定如何将其转换为字节数组,例如:
byte_array = map(ord, str(packet)) # list of numbers, such as [0xDE, 0xAD, 0xBE, 0xEF]
print byte_array
for byte in byte_array:
pass # do something with byte
但是我需要一个十六进制值的数组,我可以在循环中建立索引。例如,字节[0x00,0x11,0x22]是否尝试使用python pickle库?