标签:res lse down 输入 The ports style 端口 nbsp
#!/bin/bash #**************************************************** #Date: 2020-06-25 #Author: Damon Ye #FileName: MailPing.sh #Description:The test script #**************************************************** red="\033[31m" green="\033[32m" shutdown="\033[0m" read -p "请输入你的ip地址:" ipadress ping -W1 -c3 $ipadress &>/dev/null if [ $? -eq 0 ];then echo -e "$ipadress is ${green}running${shutdown}......" else echo -e "$ipadress is ${red}stopped${shutdown}......" fi
for ip in {1..254} do ping -w0.1 -W1 -c1 10.0.0.${ip} &>/dev/null if [ $? -eq 0 ];then echo -e "10.0.0.${ip} is ${green}running${shutdown}......" else echo -e "10.0.0.${ip} is ${red}stopped${shutdown}......" fi done
#!/bin/bash #**************************************************** #Date: 2020-06-25 #Author: Damon Ye #FileName: PortLook.sh #Description:The test script #**************************************************** shutdown="\033[0m" green="\033[32m" blue="\033[34m" for ip in {1..254} do ping -c1 -W1 -w0.1 10.0.0.${ip} &> /dev/null if [ $? -eq 0 ];then echo -e "${green}#################################################${shutdown}" echo "Host 10.0.0.${ip} runs on the following ports. " nmap 10.0.0.$ip | sed -n ‘/^PORT/,/^MAC/p‘| sed -n ‘/^[0-9]/p‘ echo -e "${blue}#################################################${shutdown}" echo -e "\n\n" fi done
标签:res lse down 输入 The ports style 端口 nbsp
原文地址:https://www.cnblogs.com/ytdyz/p/13192696.html