标签:shell 绑定 ip/mac arp欺骗 arp病毒
#!/bin/bash
#function: Count the relationship between ip and mac in a C subnet
#created by comk at Mar.12.2016
quitScript() {
echo "User Interrupt ,Quit..."
}
trap ‘quitScript; exit 5‘ SIGINT #### support ctrl+c interrupt
read -p "请输入你要测试的网段(如192.168.0.0):" string
a=`echo $string|cut -d"." -f1-3`
for i in {1..254};do
ping -c 1 $a.$i
done
exec arp -a | cut -d" " -f2,4 | tr -s [\(\)] [" "" "] > mac.txt本文出自 “净空蓝星” 博客,请务必保留此出处http://jingkonglanxing.blog.51cto.com/1152128/1750403
shell 实现统计一个网段的IP和mac对应关系并保存到文件mac.txt
标签:shell 绑定 ip/mac arp欺骗 arp病毒
原文地址:http://jingkonglanxing.blog.51cto.com/1152128/1750403