in reply to Re^8: Sniffer::HTTP problem with timeout
in thread Sniffer::HTTP problem with timeout
#!/usr/bin/perl use strict; use Net::Pcap; use Sniffer::HTTP; my $VERBOSE = 1; my $sniffer = Sniffer::HTTP->new( callbacks => { request => sub { my ($req,$conn) = @_; print $req->uri,"\n" if +$req }, response => sub { my ($res,$req,$conn) = @_; print $req->uri,"\n" if ($req); return if (length $res->content == 0); (my $filename = $req->uri)=~s/.*\///; open (FILE,">",$filename); print FILE $res->content; close FILE; }, log => sub { print $_[0] if $VERBOSE }, tcp_log => sub { print $_[0] if $VERBOSE > 1 }, }, timeout => 1*60, # seconds after which a connection is considered st +ale stale_connection => sub { my ($s,$conn,$key) = @_; my %test=%$conn; $conn->log->("$key is stale."); $s->remove_connection($key); }, ); $sniffer->run('eth0'); # uses the "best" default device
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: Sniffer::HTTP problem with timeout
by Corion (Patriarch) on Mar 23, 2011 at 07:47 UTC | |
by ponley (Novice) on Mar 23, 2011 at 20:19 UTC | |
by Corion (Patriarch) on Mar 23, 2011 at 20:57 UTC | |
by ponley (Novice) on Mar 23, 2011 at 22:27 UTC |