Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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


Comment on Re: real-time packet capture
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://250077]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-07-30 12:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (231 votes), past polls