From paul.fer....com on November 06, 2009 17:30:27
I'm trying to use DPKT to parse a PCAP file and getting an exception thrown in the pcap.py module.
My code:
import dpkt
f = open('capture.pcap') pcap = dpkt.pcap.Reader(f)
for ts, buf in pcap: eth = dpkt.ethernet.Ethernet(buf) ip = eth.data tcp = ip.data
print tcp.sport, tcp.dport, len(tcp.data)
f.close()
Breaks in the following module:
def iter(self): self.f.seek(FileHdr.__hdr_len) while 1: buf = self.f.read(PktHdr.__hdr_len) if not buf: break hdr = self.__ph(buf) buf = self.__f.read(hdr.caplen)
It breaks in the last line with this error:
exceptions.OverflowError: long int too large to convert to int
Wireshark displays the data fine and I don't see anything that looks like it would be a problem. The traffic is a mix of TCP and UDP it it breaks on a UDP packet.
Any ideas?
Original issue: http://code.google.com/p/dpkt/issues/detail?id=27
该提问来源于开源项目:kbandla/dpkt