Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 866
auino Avatar asked Nov 07 '12 09:11

auino


1 Answers

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

like image 99
auino Avatar answered Sep 17 '22 05:09

auino