linuxShell检测内网中存活主机,windows下net view/nmblookup

 

 

#!/bin/bash
    # Simple SHELL script for Linux and UNIX system monitoring with
    # ping command
    # code by robert
    for ((a=1;a<=255;a++));do
    HOSTS="10.67.12.$a"
    COUNT=1
    for myhost in $HOSTS
    do
      count=$(ping -c $COUNT $myhost | grep 'received' | awk -F',' '{ print $2 }' | awk '{ print $1 }')
    if [ $count -eq 0 ]; then # 100% failue
            echo "$myhost is down (ping failed)"
                    else
                            echo "$myhost is up"
                    fi
    done
    done

 

windows下net view显示局域网所有正在运行的电脑

nmblookup

dig

posted @ 2018-09-11 19:04 t6 阅读(...) 评论(...) 编辑 收藏