|
NAMENet::TcpDumpLog - Read tcpdump/libpcap network packet logs. Perl implementation (not an interface).SYNOPSISuse Net::TcpDumpLog;$log = Net::TcpDumpLog->new(); $log->read("/tmp/out01"); @Indexes = $log->indexes; foreach $index (@Indexes) { ($length_orig,$length_incl,$drops,$secs,$msecs) = $log->header($index); $data = $log->data($index); # your code here } DESCRIPTIONThis module can read the data and headers from tcpdump logs (these use the libpcap log format).METHODS
INSTALLATIONperl Makefile.PL make make test make install DEPENDENCIESExtUtils::MakeMakerEXAMPLESOnce you can read the raw packet data, the next step is read through the protocol stack. An Ethernet/802.3 example is,($ether_dest,$ether_src,$ether_type,$ether_data) = unpack('H12H12H4a*',$data); Keep an eye on CPAN for Ethernet, IP and TCP modules. LIMITATIONSThis reads tcpdump/libpcap version 2.4 logs (the most common). There could be new versions in the future, at which point this module will need updating.BUGSIf this module is not reading your logs correctly, try forcing the timestamp bits to either 32 or 64, eg "$log = Net::TcpDumpLog->new(32);". Also try printing out the log version using version() and checking it is "2.4".There is a certain tcpdump log format "SuSE linux 6.3" that put extra fields in the log without any clear identifier. If you think you have this log, put a "4" as a second argument to new, eg "$log = Net::TcpDumpLog->new(32,4);". (The 4 specifies how many extra header bytes to skip). TODOFuture versions should include the ability to write as well as read tcpdump logs. Also a memory efficient technique to process very large tcpdump logs (where the log size is greater than available virtual memory).SEE ALSOhttp://www.tcpdump.orgCOPYRIGHTCopyright (c) 2003 Brendan Gregg. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itselfAUTHORSBrendan Gregg <brendan.gregg@tpg.com.au> [Sydney, Australia]
Visit the GSP FreeBSD Man Page Interface. |