JN-PDD

导航

arp脚本

1.什么是arp?arp可以解决什么问题?

  ARP:是地址解析协议

  arp解决我们知道一个机器(主机或者路由器)的IP地址,需要找出其相应的硬件地址

2.编写ARP脚本,抓取对应主机的mac地址

1 #!/bin/bash
2
3 net='192.168.1.'
4 i=1
5
6 count=0
7 while [ $i -le 254 ]
8 do
9 if [ $count -eq 20 ];then
10 count=0
11 sleep 1
12 fi
13 ping -cl $net$i &
14 let i++
15 let count++
16 done
17
18 wait
19 echo '############################'
20 arp -a|grep -v 'incomplete'
21 echo '############################'
22

 

posted on 2017-06-26 16:11  JN-PDD  阅读(172)  评论(0编辑  收藏  举报