擅长:python、mysql、java
<p>这有帮助吗?在</p>
<pre><code>[mpenning@Bucksnort ~]$ arp -an
? (4.121.8.3) at 08:00:27:f5:5b:6b [ether] on eth0
? (4.121.8.4) at 08:00:27:f5:5b:6b [ether] on eth0
? (4.121.8.1) at 00:1b:53:6b:c9:c4 [ether] on eth0
[mpenning@Bucksnort ~]$
</code></pre>
<p>在python中。。。在</p>
^{pr2}$
<p>在perl中。。。在</p>
<pre><code>my $SUBNET = '192.168.1.0/24'; # Insert your subnet here
`nmap -sP $SUBNET`;
my $p = `arp -an`;
for my $line (split('\n', $p)) {
$line=~/\((\S+?)\)\s+at\s+(\S+)/;
$ipaddr = $1;
$mac = $2;
# do something with with each mac and ip address
}
</code></pre>