is there any way to replay a pre-recorded pcap file in reverse order? That is, starting from the last packet in the file and without changing the delay between packets?
I also tried reversing the pcap itself using scapy
as follows:
>>> from scapy.all import *
>>> pkts = rdpcap("telemetry.pcap")
>>> pkts.reverse()
>>> wrpcap("telemetry_rev.pcap", pkts)
This code actually works, in the sense that the packets order in the file is inverted. The problem is that it doesn't touch the packets' timestamps, so that I ended up with a negative delay between packets (look at the image below), which is not handled by tcpreplay
. Any idea?