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

Re: Net::Pcap garbage Output

by Khen1950fx (Canon)
on May 26, 2008 at 21:47 UTC ( [id://688560] : note . print w/replies, xml ) Need Help??

in reply to Net::Pcap garbage Output

I couldn't get Net::Pcap to work for me. Here's a small substitute:

#!/usr/bin/perl use strict; use warnings; use Linux::net::dev; use Net::ARP; use Net::Address::Ethernet qw(get_address); use Sys::HostIP; my $devs = Linux::net::dev::info(); print "Devices (bytes read):\n"; foreach (keys %$devs) { print " $_ ($devs->{$_}->{rbytes})\n"; } my $dev = "eth0"; my $mac = Net::ARP::get_mac("eth0"); print "$mac\n"; $mac = Net::ARP::arp_lookup($dev, ''); print " has got mac $mac\n"; my $sAddress = get_address; print "$sAddress\n"; my $ip_address = Sys::HostIP->ip; print $ip_address, "\n";