0%

shell批量telnet

实现批量telnet ip 端口,是否异常

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

cat > telnet.txt << EOF

10.0.0.1 80
10.0.0.2 80
10.0.0.3 80
EOF

awk '{print $1,$2}' telnet.txt | while read a b
do
echo a=$a b=$b
telnet $a $b
if [ $? -eq 0 ]; then
cat telnet.txt | grep $1| grep $2 | xargs -I {} sed -i /{}/d telnet.txt

fi
done