Python dpkt can parse Wireshark/pcap files and show packet data successfully:
>>> for ts, pkt in pcap:
eth = dpkt.ethernet.Ethernet(pkt)
type(eth.data)
<class 'dpkt.ip.IP'>
<class 'dpkt.ip.IP'>
But when I tried to parse the tcpdump file I got the following result:
>>> for ts, pkt in pcap:
eth = dpkt.ethernet.Ethernet(pkt)
type(eth.data)
<type 'str'>
<type 'str'>
<type 'str'>
From Python IDE print you can see that type(eth.data) is 'str' instead of class 'dpkt.ip.IP'.
Does anyone know what is root cause and how to make the dpkt work for tcpdump
captures?