我想单独解析TCP数据包,而不使用PCAPLib自己的数据结构。因此,我需要获取TCP头的bytearray。在
from pcapfile import savefile
capfile = open('delta_capture.pcap')
sf = savefile.load_savefile(capfile)
for packet in sf.packets:
print packet.timestamp
print packet.packet
print packet.header # Returns a library object, I need the bytearray instead, as I want to use my own data structure and parse.
capfile.close()
我试着调试和检查对象结构,但是看不到任何在TCP头中存储实际字节的对象。在
变量“packet”的调试器结果屏幕截图:
在这个图书馆里甚至可以这样做吗?在
标头的
bytearray
无法直接访问。解析头中的各个字段,整个数据包都可用:相关问题 更多 >
编程相关推荐