#! /usr/bin/perl my $tcpdump = '/usr/sbin/tcpdump -n'; # path and options my $timeout = 5; # time to listen my $fileout = 'out.tcpdump'; open(OUT, "> $fileout") || die $!; open(CMD, "$tcpdump |") || die $!; eval { local $SIG{ALRM}= sub { die('done') }; alarm( $timeout ); while (<CMD>) { my $line = $_; print OUT $line; } alarm(0); }; print $@ if $@; close OUT || die $!;
In reply to Re: real-time packet capture
by tstock
in thread real-time packet capture
by PEACHHORSE
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |