k_grdn has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Net::TcpDumpLog; use NetPacket::IP qw(:strip); use NetPacket::TCP qw(:strip); my $log = Net::TcpDumpLog->new(); $log->read("tcp01.dump"); my @Indexes = $log->indexes; my $index; my ($length_orig,$length_incl,$drops,$secs,$msecs); my $data; foreach $index (@Indexes) { ($length_orig,$length_incl,$drops,$secs,$msecs) = $log->header($in +dex); $data = $log->data($index); my ($ether_dest,$ether_src,$ether_type,$ether_data) = unpack('H12H +12H4a*',$data); my $ip_obj = NetPacket::IP->decode($ether_data); my $tcp_obj = NetPacket::TCP->decode( $ip_obj->{data} ); print("$ip_obj->{src_ip}:$ip_obj->{dest_ip}\n"); }
250.84.80.45:76.34.213.120 250.19.80.45:76.34.213.120 249.4.213.120:252.2.80.45 249.3.213.120:252.2.80.45 249.2.213.120:252.2.80.45 223.68.213.120:252.2.80.45
IP 80.45.76.34.22 > 213.120.252.2.49191: IP 80.45.76.34.22 > 213.120.252.2.49191: IP 213.120.252.2.49191 > 80.45.76.34.22: IP 213.120.252.2.49191 > 80.45.76.34.22: IP 213.120.252.2.49191 > 80.45.76.34.22:
kernel 2.6.22-14-386
tcpdump 3.9.7-1
distro ubuntu 7.10
Is this compatibility issues? or can errors be overcome with correct code syntax?
Regards,
k_grdn
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: NetPacket IP Problems
by k_grdn (Novice) on May 08, 2008 at 20:54 UTC | |
by NetWallah (Canon) on May 08, 2008 at 23:54 UTC | |
by Anonymous Monk on May 12, 2008 at 12:13 UTC |