美文网首页
局域网IP扫描工具

局域网IP扫描工具

作者: 大胖孩 | 来源:发表于2019-07-07 20:11 被阅读0次

有时候想知道局域网内哪些IP可以用,哪些IP不能用,但是去ping的还是比较麻烦的,索性就写了一个shell脚本去跑吧!

#!/bin/bash
network=$1
time=$(date +%H%M%S)
for i in $(seq $2 $3)
do
    ping -c 1 -w 2 $network.$i > /dev/null
    if [ $? -eq 0 ]; then
          arp $network.$i | grep ":" | awk '{print $1,$3}' >> $time.log
          echo "host $network.$i is up"
   else
          echo "host $network.$i is down"
   fi
done

使用方式:

./netscan.sh 10.200.201 100 200

其意思就是判断10.200.201.100-10.200.201.200中有多少IP存活。

脚本运行效果截图:


image.png

相关文章

网友评论

      本文标题:局域网IP扫描工具

      本文链接:https://www.haomeiwen.com/subject/nmuihctx.html