一、收集需要探测的IP地址和端口信息(ip_info.txt)

10.192.219.12:5888
10.192.219.12:22
10.192.155.2:22
10.192.155.2:3306
10.192.155.1:3306
10.1.105.11:80

二、探测脚本命令如下:

#!/bin/bash
check_telnet(){
for ip_port in $(cat ip_info|grep -v '^#')
do
    CHECK_PORT=$(echo $ip_port|awk -F: '{print $2}')
    CHECK_IP=$(echo $ip_port|awk -F: '{print $1}')
    echo -e "\n\n\n"| curl --connect-timeout 5 -s $CHECK_IP:$CHECK_PORT >/dev/null
    if [ $? -eq 0 ];then
        echo "$LOCALIP result $CHECK_IP : $CHECK_PORT connected"
    else
        echo "$LOCALIP result $CHECK_IP : $CHECK_PORT can not Connected"
    fi
done
}
check_telnet > result.log

三、设置探测频率,比如每10秒运行脚本

四、探测结果

Copyright © https://yan-jian.com 2023 all right reserved更新时间: 2024-01-28 13:51:18

results matching ""

    No results matching ""