Thanks Brian, Excellent suggestion! This is where I am so far:
#!/usr/bin/perl -w use strict; use Net::Pcap; use NetPacket::Ethernet; use NetPacket::IP; use NetPacket::TCP; my $err; my $dev = $ARGV[0]; my $object; $object = Net::Pcap::open_offline($dev, \$err); unless (defined $object) { die 'Unable to create packet capture on device ', $dev, ' - ', $er +r; } Net::Pcap::loop($object, -1, \&callback_function, ''); Net::Pcap::close($object); sub callback_function { my ($user_data,$header,$packet) =@_; my $ether_data = NetPacket::Ethernet::strip($packet); my $ip = NetPacket::IP->decode($ether_data); my $tcp = NetPacket::TCP->decode($ip->{'data'}); print $ip->{'src_ip'}, ":", $tcp->{'src_port'}, " -> ", $ip->{'dest_ip'}, ":", $tcp->{'dest_port'}, "\n"; }
With errors as
Use of uninitialized value in unpack at /usr/lib/perl5/site_perl/5.8.0 +/NetPacket/TCP.pm line 138. 57.24.4.3:260 -> 0.0.100.0:33412 178.163.14.0:29300 -> 0.0.100.0:29295 3.0.0.0:0 -> 8.0.69.0:16401 252.87.141.0:4356 -> 0.0.100.0:12 Use of uninitialized value in unpack at /usr/lib/perl5/site_perl/5.8.0 +/NetPacket/TCP.pm line 138. 157.24.4.3:260 -> 0.0.100.0:33412 253.87.141.0:4356 -> 0.0.100.0:12 Use of uninitialized value in unpack at /usr/lib/perl5/site_perl/5.8.0 +/NetPacket/TCP.pm line 138. 159.24.4.3:260 -> 0.0.100.0:33412 239.36.90.0:0 -> 0.0.100.0:5 240.36.90.0:0 -> 0.0.100.0:5 3.37.90.0:0 -> 0.0.100.0:5 5.37.90.0:0 -> 0.0.100.0:5 3.0.0.0:1 -> 8.6.0.1:2560
I bet all I need to do now is either find or write an appropriate NetPacket module. Almost there!

In reply to Re^2: Kismet Drone by satanklawz
in thread Kismet Drone by satanklawz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.