Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: real-time packet capture

by tstock (Curate)
on Apr 12, 2003 at 19:55 UTC ( #250077=note: print w/replies, xml ) Need Help??


in reply to real-time packet capture

Maybe this will give you some ideas:
#! /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 $!;

Tiago

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://250077]
help
Chatterbox?
[marioroy]: Is List::Util::XS a core Perl module?
[stevieb]: corelist List::Util::XS says "List::Util::XS was first released with perl v5.10.1"
[stevieb]: so yes, since v5.10.1 :)
[MidLifeXis]: According to [metaperl:// corelist], Perl 5.10.1
Lady_Aleena blurbles. One of her favorite modiles is now in "maintenance mode" in favor of a new fangled module.
[MidLifeXis]: D'oh. Slow out of the gate.
[marioroy]: Thanks stevieb, MidLifeXis.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2017-05-24 17:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?