Scapy PcapReader and packets time

Posted by auino on Stack Overflow See other posts from Stack Overflow or by auino
Published on 2012-11-07T09:05:18Z Indexed on 2012/11/07 11:00 UTC
Read the original article Hit count: 354

Filed under:
|
|
|
|

I'm reading a PCAP file using Scapy using a script such as the (semplified) following one:

#! /usr/bin/env python
from scapy.all import *
# ...
myreader = PcapReader(myinputfile)
for p in myreader:
    pkt = p.payload
    print pkt.time

In this case the packets time is not relative to PCAP capture time, but starts from the instant I've launched my script. I'd like to start from 0.0 or to be relative to the PCAP capture.

How can I fix it (possibly without "manually" retrieving the first packet time and repeatedly using math to fix the problem)?

© Stack Overflow or respective owner

Related posts about python

Related posts about capture