#!/bin/bash
if [ "$#" -ne 1 ];then #-ne 1 参数不等于为1
echo "Usage - ./arping.sh [interface]"
echo "Excample - ./arping.sh eth0"
echo "Example will perform an ARP scan of the local subnet to which eth0 is assigned"
exit
fi
interface=$1 #输入的一个值,,赋值给interface变量
prefix=$(ifconfig $interface | grep "broadcast" | cut -d " " -f 10 | cut -d '.' -f 1-3) #取IP地址的前缀,如:192.168.1
#echo "$prefix"
for addr in $(seq 98 110);do
arping -c 1 $prefix.$addr -I $interface | grep "reply from" | cut -d" " -f 4
done
(注意现在的arping参数有所变化 可以通过arping -h查看 主要是ya-I(device) )
if [ "$#" -ne 1 ];then #-ne 1 参数不等于为1
echo "Usage - ./arping.sh [interface]"
echo "Excample - ./arping.sh eth0"
echo "Example will perform an ARP scan of the local subnet to which eth0 is assigned"
exit
fi
interface=$1 #输入的一个值,,赋值给interface变量
prefix=$(ifconfig $interface | grep "broadcast" | cut -d " " -f 10 | cut -d '.' -f 1-3) #取IP地址的前缀,如:192.168.1
#echo "$prefix"
for addr in $(seq 98 110);do
arping -c 1 $prefix.$addr -I $interface | grep "reply from" | cut -d" " -f 4
done
(注意现在的arping参数有所变化 可以通过arping -h查看 主要是ya-I(device) )