作者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://www.ptt.cc/bbs/Python/M.1556548667.A.7B9.html
推 abc127845: raw socket呢 04/30 11:35
→ HairBand: 雩茯O不行用(作業限制)但我找到解決辦法了 04/30 19:29
→ HairBand: buf[12:14]就可以讀byte了... 04/30 19:30
→ HairBand: 應該** 04/30 19:31