Net::Inspect - library for inspection of data on various network layers
use Net::Pcap 'pcap_loop';
my $pcap = Net::Pcap->new...
my $l7 = Net::Inspect::L7::HTTP->new;
my $l4 = Net::Inspect::L4::TCP->new($l7);
my $l3 = Net::Inspect::L3::IP->new($l4);
my $l2 = Net::Inspect::L2::Pcap->new($pcap,$l3);
my (undef,$hdr,$data) = @_;
The idea of Net::Inspect is to plug various layers of network inspection together to analyze data. This is kind of what wireshark or IDS do, exept this is in perl and therefore slower to execute but faster to develop and maybe more flexibel too.
One can start analysis on some level and stop it at any higher level. There are various useful tools in tools/ which make use of this library:
gets data from pcap file or does live capture and extracts tcp connections into separate files.
gets data from pcap file or does live capture and extracts http requests into separate files. Does request unchunking and decompression. Works with persistant and with pipelined HTTP connections.
simple http(s) proxy with the ability to inspect and transform requests. Contrary to tcpflow and httpflow it starts analysis at the TCP layer, not at the pcap layer.
Because of non-blocking DNS lookups and connects and DNS caching the proxy is fast enough to be used in simple production setups. It can also store each http connections as a single pcap file for more analysis.
Currently the following modules are implemented:
reads from pcap layer
processes raw IP packets, does defragmentation.
handles TCP connections, e.g. connection setup and shutdown and reordering of packets.
handles UDP packets. Can aggregate udp packets in virtual connections.
tries to guess the higher level protocol from TCP connections.
handles HTTP connections. Plugable into Net::Inspect::L5::GuessProtocol.
handles connections which don't transport any data. Plugable into Net::Inspect::L5::GuessProtocol.
used together with Net::Inspect::L5::GuessProtocol as a fallback if no other protocol handler matched.
Probably still a lot. The HTTP part was tested with a lot of real-life traffic, so it should be kind of stable. There is currently no support for IPv6.
Steffen Ullrich, <email@example.com>
Copyright 2011-2013 Steffen Ullrich
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::Inspect, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.