【发布时间】:2017-07-22 23:14:22
【问题描述】:
我想单独解析 TCP 数据包,而不使用 PCAPLib 自己的数据结构。因此,我需要获取 TCP 标头的字节数组。
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”的调试器结果截图:
在这个库中甚至可以这样做吗?
【问题讨论】: