2

Info: Python 3.6.3 via Anaconda Distribution

I am using dpkt to parse through a pcap file and I cycle through it collecting the ethernet, ip and tcp.

Python Code:

import dpkt
file = open('file10','rb')
pcapFile = dpkt.pcap.Reader(file)

for ts, buf in pcapFile:
    eth = dpkt.ethernet.Ethernet(buf)
    ip = eth.data
    tcp = ip.data
file.close()

From this, I want to extract a protocol trace corpus for use in a n-gram language model. How can I extract these bytes from eth, ip or tcp?

0 Answers0