-->
#!/usr/bin/perl -w
#nmap-parser.pl
use warnings;
use strict;
use Nmap::Parser;
my @host=map "192.168.1.$_",1..254;
my $nm= new Nmap::Parser;
$nm->parsescan("/usr/bin/nmap","-sP",@host);
foreach my $i (@host){
my $ht=$nm->get_host($i);
if($ht->status() eq "up"){
my $addr=$ht->mac_addr();
print "$i $addr\n";
}
}
部分运行结果
192.168.1.71 00:0D:87:ED:5A:2C
192.168.1.72 00:11:25:D8:46:88
192.168.1.73 00:12:3F:D2:F0:11
192.168.1.74 00:0B:CD:B4:C4:92
192.168.1.75 00:0D:87:ED:6F:EB
192.168.1.76 00:16:EC:75:6F:31
192.168.1.77 00:0D:87:CB:AF:84
192.168.1.79 00:07:E9:88:D7:26

发表评论