nmap在二层发现中的使用:
nmap只需要一行即可实现arping的一个脚本:并且速度更快
#!/bin/bash if [ "$#" -ne 1 ];then 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 prefix=$(ifconfig $interface | grep "broadcast" | cut -d " " -f 10 | cut -d '.' -f 1-3) for addr in $(seq 1 255);do arping -c 1 $prefix.$addr -I $interface | grep "reply from" | cut -d" " -f 4 done
nmap:
扫描一个指定文件中保存的IP:
其实nmap这里的扫描和arping不一样,可以抓包发现,nmap还发送DNS数据包,解析主机名