nc命令检查端口是否存活
#!/bin/bash
for IP in `cat /log/ip_ubt.txt`
do
IPP="$IP 22"
/bin/nc -v -w 5 -z $IPP > /dev/null 2>&1
if [ $? -eq 0 ];then
echo $IPP:ok >> /log/ssh_22_ok.txt
echo $IP >> /log/ssh_22.txt
fi
done
时间: 2024-11-05 18:08:18
nc命令检查端口是否存活
#!/bin/bash
for IP in `cat /log/ip_ubt.txt`
do
IPP="$IP 22"
/bin/nc -v -w 5 -z $IPP > /dev/null 2>&1
if [ $? -eq 0 ];then
echo $IPP:ok >> /log/ssh_22_ok.txt
echo $IP >> /log/ssh_22.txt
fi
done