Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Perl and Net::Pcap

by rob_au (Abbot)
on May 31, 2002 at 07:57 UTC ( #170648=perltutorial: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $dev = Net::Pcap::lookupdev(\$err)
    
  2. or download this
    use Net::Pcap;
    use strict;
    ...
        die 'Unable to determine network device for monitoring - ', $err;
    }
    
  3. or download this
    Net::Pcap::lookupnet($dev, \$net, \$mask, \$err)
    
  4. or download this
    my ($address, $netmask, $err);
    if (Net::Pcap::lookupnet($dev, \$address, \$netmask, \$err)) {
    ...
    }
    print STDOUT "$dev: addr/mask -> $addr/$mask\n";
    
  5. or download this
    $object = Net::Pcap::open_live($dev, $snaplen, $promisc, $to_ms, \$err
    +)
    
  6. or download this
    Net::Pcap::loop($object, $count, \&callback_function, $user_data)
    
  7. or download this
    sub callback_function {
        my ($user_data, $header, $packet) = @_;
    ...
        ...
    }
    
  8. or download this
    Net::Pcap::compile($object, \$filter_compiled, $filter_string, $optimi
    +se, $netmask)
    
  9. or download this
    Net::Pcap::setfilter($object, $filter_compiled);
    
  10. or download this
    Net::Pcap::close($object)
    
  11. or download this
    use Net::Pcap;
    use NetPacket::Ethernet;
    ...
            $ip->{'dest_ip'}, ":", $tcp->{'dest_port'}, "\n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://170648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (18)
As of 2014-10-20 12:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (76 votes), past polls