#!/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
时间: 2024-12-06 17:08:47