作者HairBand (发箍男)
看板Python
标题[问题] 确认 packet 的 protocol type (学校作业
时间Mon Apr 29 22:37:45 2019
大神们好
我需要在整个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 里的资料,那个我会再努力想办法解决... 但我现在连起头都有障碍
感谢大神们帮忙
知道有点晚了,任何提示都感激不尽!
-----
Sent from JPTT on my iPhone
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 130.245.192.21
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1556548667.A.7B9.html
1F:推 abc127845: raw socket呢 04/30 11:35
2F:→ HairBand: 雩茯O不行用(作业限制)但我找到解决办法了 04/30 19:29
3F:→ HairBand: buf[12:14]就可以读byte了... 04/30 19:30
4F:→ HairBand: 应该** 04/30 19:31