auino
auino

Reputation: 1656

Scapy PcapReader and packets time

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)?

Upvotes: 7

Views: 17745

Answers (1)

auino
auino

Reputation: 1656

I saw that using pkt.time is wrong, in this case.
I should print p.time instead.

Upvotes: 6

Related Questions