weixin_39602005 2020-11-22 03:36
浏览 0

Exception OverflowError

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

  • 写回答

13条回答 默认 最新

  • weixin_39602005 2020-11-22 03:36
    关注

    From rram....com on November 20, 2009 10:42:46

    I am facing the same issue. I need to parse a UDP packet and can't do it. Please let me know what can I do.

    Thanks,

    Ram.

    评论

报告相同问题?