#! /bin/bash
# timout_second:超时时间,秒
# host: 域名
# port: 端口
# echo -e '\x1dclose\x0d' | timeout --signal=9 {timout_second} telnet {host} {port}
# timeout 指定命令运行时长
# -s --signal=9 超时发出信号
while read ip
do
if [[ "$ip" == "" ]]; then continue; fi
echo -ne "\r $ip:43300 ...."
ret=`echo -e '\x1dclose\x0d' | timeout --signal=9 1 telnet $ip 43300`;
connected=`echo $ret | grep "Connected"`;
if [[ $connected != "" ]]; then
echo " .... Ok"
fi
done < $1
linux shell 批量telnet测试端口
最新推荐文章于 2024-06-15 06:00:00 发布