Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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
  11. or download this
    use Net::Pcap;
    use NetPacket::Ethernet;
            $ip->{'dest_ip'}, ":", $tcp->{'dest_port'}, "\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perltutorial [id://170648]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-03-26 16:33 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (315 votes). Check out past polls.