局域网ip地址扫描_v1版本

局域网ip地址扫描

工作中,我们有时需要对局域网中ip地址使用情况进行统计。可以使用shell脚本进行扫。

脚本功能:

  1. 在线使用IP写入list_online.txt文件
  2. 未在线IP写入list_offline.txt文件
#!/bin/bash
#2019年10月31日00:45:54
#IP address scanning v1
#sunjinhua
########################
NET_VER="$1"
NET="$NET_VER"
for ip in {1..250}
do  
    ping -c 1 $NET.$ip
    if [ $? -eq 0 ];then
        echo "$NET.$ip" >> list_online.txt
    else
        echo "$NET.$ip" >> list_offline.txt
    fi  
don

猜你喜欢

转载自www.cnblogs.com/linux123/p/11768994.html