使用tcp syn数据包ping主机
synping的Python项目详细描述
合成
ping主机使用tcp syn数据包。
简单示例:
$ synping example.org Pinging example.org 4 times on port 80: Reply from 93.184.216.34:80 time=7.40 ms Reply from 93.184.216.34:80 time=10.31 ms Reply from 93.184.216.34:80 time=7.18 ms Reply from 93.184.216.34:80 time=6.92 ms Statistics: -------------------------- Host: example.org Sent: 4 packets Received: 4 packets Lost: 0 packets (0.00%) Min time: 6.92 ms Max time: 10.31 ms Average time: 7.95 ms
安装
使用pip安装:
pip install synping
或
下载并设置脚本文件的可执行权限:
chmod +x synping.py
或
使用python解释器下载并运行:
python synping.py
使用量
Usage: synping host [options] ping hosts using tcp syn packets Options: --version show program's version number and exit -h, --help show this help message and exit -t ping host until stopped with 'control-c' -n COUNT number of requests to send (default: 4) -p PORT port number to use (default: 80) -w TIMEOUT timeout in seconds to wait for reply (default: 3)
示例
端口80上的ping主机(默认):
$ synping host
ping端口22上的主机:
$ synping host -p 22
ping主机10次,超时1秒:
$ synping host -n 10 -w 1
注释
- 适用于Python2和Python3
- 在Linux上运行良好,应在所有平台上运行
- 在Windows、Cygwin和OSX上进行了简短的测试