Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Net::Analysis::ListeneUserxContributed PerNet::Analysis::Listener::Example2(3)

NAME
       Net::Analysis::Listener::Example2 - accessing TCP info

SYNOPSIS
	package	Net::Analysis::Listener::Example2;

	use strict;
	use warnings;
	use base qw(Net::Analysis::Listener::Base);

	sub tcp_monologue {
	    my ($self, $args) =	@_;
	    my ($mono) = $args->{monologue};	# isa Net::Analysis::TCPMonologue
	    my ($pkt)  = $mono->first_packet();	# isa Net::Analysis::Packet
	    my ($from) = $pkt->{from};
	    my ($time) = $pkt->{time}->as_string('full');

	    printf "(%s)  %-22.22s % 6d	bytes",	$time, $from, $mono->length();

	    if ($self->{regex})	{
		if ($mono->data() =~ /(.{0,10}$self->{regex}.{0,10})/i)	{
		    print " ** regex matched: '$1'";
		}
	    }

	    print "\n";
	}

	1;

       You can invoke this example on a	TCP capture file from the command
       line, as	follows:

	$ perl -MNet::Analysis -e main Example2,regex=img t/t1_google.tcp

       Note the	regex parameter	being passed to	the Example2 listener.

DESCRIPTION
       This Listener prints a brief summary of the monologue traffic, and
       optionally greps	the monologue data for a regex,	if one is passed via
       config into $self.

SEE ALSO
       Net::Analysis.

AUTHOR
       Adam B. Worrall,	<worrall@cpan.org>

COPYRIGHT AND LICENSE
       Copyright (C) 2004 by Adam B. Worrall

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself, either Perl	version	5.8.5 or, at
       your option, any	later version of Perl 5	you may	have available.

perl v5.32.0			  2010-03-Net::Analysis::Listener::Example2(3)

NAME | SYNOPSIS | DESCRIPTION | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Net::Analysis::Listener::Example2&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help