#!/usr/bin/perl -w # bmc@shmoo.com use strict; use warnings; use Net::Pcap; my $err; die "$0 \n" if (scalar(@ARGV) != 3); my ($delay, $input, $output) = @ARGV; my $in = Net::Pcap::open_offline($input, \$err) || die "Cant open input file: $err"; my $out = Net::Pcap::dump_open($in, $output) || die Net::Pcap::geterr($in); Net::Pcap::loop($in, -1, \&process, ''); Net::Pcap::close($in); Net::Pcap::dump_close($out); { my $time; my $count = 0; sub process { my ($data, $hdr, $pkt) = @_; if (!$time) { $time = $hdr->{'tv_sec'}; $count = 0; } $hdr->{'tv_sec'} = $time + ($delay * $count); $count++; Net::Pcap::dump($out, $hdr, $pkt); } }