Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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]
[QM]: choroba, who or what are you hiring?
[choroba]: Perl programmers

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-06-29 10:12 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (658 votes). Check out past polls.