批量Tcping ip 加 端口

1、整理好待测试的目标IP 及对应端口号,存为本地文本文件
183.61.160.67 10024
183.61.160.74 10009
119.147.128.173 10006
183.61.160.84 10011
119.147.107.203 10013
183.61.160.67 10015
183.61.160.58 10016
183.61.160.56 10010
183.61.160.74 10018
183.61.160.121 10015
youxi1

2、安装好tcping工具
Tcping 相关参数
tcping, (C) 2003 folkert@vanheusden.com

-h hostname hostname (e.g. localhost)
-p portnr portnumber (e.g. 80)
-c count how many times to connect
-i interval delay between each connect
-f flood connect (no delays)
-q quiet, only returncode

3、Shell 编写

#!/bin/bash
i=/home/admin/test/youxi1
cat $i |
while read line
do
host=echo $line | awk -F ' ' '{print $1}'
port=echo $line | awk -F ' ' '{print $2}'
tcping -h $host -p $port -c 10 -i 0.5
done

保存为 tcping.sh
注:echo $line | awk -F ' ' '{print $2}'
echo $line | awk -F ' ' '{print $2}'
要用单引号引起来

4、执行 bash tcping.sh

转载于:https://blog.51cto.com/lihongweibj/2298153

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值