[问题] 确认 packet 的 protocol type (学校作业

楼主: HairBand (发箍男)   2019-04-29 22:37:45
大神们好
我需要在整个pcap file里面找出arp packet。 条件是不能读入library 的 pre-defined structure。
我目前是用 dpkt
import dpkt
f = open("xxx.pcap", "rb")
pcap = dpkt.pcap.reader(f)
for ts, but in pcap:
*
*
*
f.close()
对我什么都没有...
找到的资料都大概是
eth=dpkt.Ethernet.ethernet(buf)
ip= eth.data
然后就可以直接找protocol type了
但教授要求最多只能用library iterate thru the pcap file
剩下的要 parse in byte level programing
找完arp之后要print 所有arp header 里的资料,那个我会再努力想办法解决... 但我现在连起头都有障碍
感谢大神们帮忙
知道有点晚了,任何提示都感激不尽!
楼主: HairBand (发箍男)   2019-04-30 19:29:00
雩茯O不行用(作业限制)但我找到解决办法了buf[12:14]就可以读byte了...应该**
作者: abc127845 (monkeyGOD)   2019-04-30 11:35:00
raw socket呢

Links booklink

Contact Us: admin [ a t ] ucptt.com