shell ip扫描

来源:互联网 发布:数控冲床编程难不难 编辑:程序博客网 时间:2024/06/11 05:24
#shell scriptecho ping扫描echo 开始扫描...echo 获取本机IP...myip=`ifconfig eth0 | awk '{print $2}'|egrep "addr:[0-9]" | awk 'BEGIN {FS=":"} {print $2}'`echo "本机IP:" $myipnet_ip=${myip%.*}.echo "网络扫描开始地址:"$net_ip'1'echo "ping扫描" > ./up_host.txtfor scan_ip in $(seq 1 255)doping -c 3 $net_ip"$scan_ip" > /dev/null && echo "the host is up----" $net_ip"$scan_ip" && echo $net_ip"$scan_ip">> ./up_host.txt || echo "the host is down--" $net_ip"$scan_ip"done