NetworkInfo::Discovery | Discovering your network neighbourhood |
Example (1) |
Passively listen to the network traffic
#!/usr/bin/perl -W use strict; use NetworkInfo::Discovery; use NetworkInfo::Discovery::Register; use NetworkInfo::Discovery::Sniff; my $data = new NetworkInfo::Discovery::Register ( 'file' => 'sample.register', 'autosave' => 1 ) or warn "Cannot create new object"; my $sniff = new NetworkInfo::Discovery::Sniff maxcapture => 10; $sniff->do_it; $data->add_interface($_) for ($sniff->get_interfaces) $data->write_register; for (@{$data->{interfaces}}) { print "interface: ",$_->{ip},'/',$_->{mask},$/ } |
YAPC::Europe 2004 | 10 / 36 | |
Copyright © Sébastien Aperghis-Tramoni <sebastien@aperghis.net> |