warjiang / dpkt

Automatically exported from code.google.com/p/dpkt
Other
0 stars 0 forks source link

time and size of packet #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
i am new in python, and i need your help.
I am trying to get the time and size of each packet from a pcap file.
i tried the following:

f = open('test.pcap')
pcap = dpkt.pcap.Reader(f)
for ts, buf in pcap:
    print ts, len(buf)

but all i getting is some numbers, that are wrong comparing to the pcap in 
wireshark.
can someone help me???

Thanks

Original issue reported on code.google.com by itayr...@gmail.com on 9 Nov 2014 at 1:30

GoogleCodeExporter commented 9 years ago
Try open with binary

f = open('test.pcap','rb')
pcap = dpkt.pcap.Reader(f)
for ts, buf in pcap:
    print ts, len(buf)

Original comment by vinifa...@gmail.com on 12 Nov 2014 at 6:46

GoogleCodeExporter commented 9 years ago
Could you please provide more details like the operating System and dpkt 
version?
Also, please upload the test pcap file that fails in comparison with wireshark. 

Original comment by kbandla@in2void.com on 25 Dec 2014 at 4:17

GoogleCodeExporter commented 9 years ago
Please see the following issues:
https://code.google.com/p/dpkt/issues/detail?id=129
https://code.google.com/p/dpkt/issues/detail?id=27

If the timestamp values are not matching up with Wireshark, it is because of 
the way you are printing the value in python. See issue #129 for more details.

Original comment by kbandla@in2void.com on 25 Dec 2014 at 5:58