Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Perl and Net::Pcap

by rob_au (Abbot)
on May 31, 2002 at 07:57 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: perltutorial [id://170648]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-23 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found