用tcping检查网站开放的端口

麦新杰之前分享过一款小巧玲珑工具软件:tcping,即在tcp层进行端口的ping。

tcping可以用来检查和确认我们的网站有哪些端口是开放的,使用很顺手。比如麦新杰这几天在研究如何关闭mysql的3306端口,就通过使用tcping工具来确认关闭端口是否成功。Linux下有有个netstat命令,总是对其输出看得云里雾里,虽然netstat -l的输出看不到3306端口,是tcping还能ping通,而且百度云检测也能检测到3306端口的开放状态并告警。

 

首先下载并在合适的位置存放tcping工具,请参考:TCPING小工具的使用和下载

然后,打开cmd窗口,使用如下命令检查网站开放的端口:

检查网站Web服务器的80端口:

C:\Users\Administrator>tcping 114.215.183.12 80

Probing 114.215.183.12:80/tcp - Port is open - time=25.839ms
Probing 114.215.183.12:80/tcp - Port is open - time=16.662ms
Probing 114.215.183.12:80/tcp - Port is open - time=13.375ms
Probing 114.215.183.12:80/tcp - Port is open - time=15.192ms

Ping statistics for 114.215.183.12:80
4 probes sent.
4 successful, 0 failed.
Approximate trip times in milli-seconds:
Minimum = 13.375ms, Maximum = 25.839ms, Average = 17.767ms

C:\Users\Administrator>

80端口打开,网站可以被访问。

 

检查网站数据库服务器的3306端口:

C:\Users\Administrator>tcping 114.215.183.12 3306

Probing 114.215.183.12:3306/tcp - Port is open - time=25.296ms
Probing 114.215.183.12:3306/tcp - Port is open - time=15.218ms
Probing 114.215.183.12:3306/tcp - Port is open - time=14.877ms
Probing 114.215.183.12:3306/tcp - Port is open - time=14.629ms

Ping statistics for 114.215.183.12:3306
4 probes sent.
4 successful, 0 failed.
Approximate trip times in milli-seconds:
Minimum = 14.629ms, Maximum = 25.296ms, Average = 17.505ms

C:\Users\Administrator>

MySQL数据库3306端口打开,存在安全隐患。

 

除了使用简单,还可以看到各个端口的响应时间,这个响应时间比3层的ping的时间更精准更有参考价值。

网站响应时间可是SEO的一个重要参数哦。

 

用tcping查看一个没有打开的端口:

C:\Users\Administrator>tcping 114.215.183.12 12345

Probing 114.215.183.12:12345/tcp - No response - time=2011.028ms
Probing 114.215.183.12:12345/tcp - No response - time=2001.356ms
Probing 114.215.183.12:12345/tcp - No response - time=2001.396ms
Probing 114.215.183.12:12345/tcp - No response - time=2000.701ms

Ping statistics for 114.215.183.12:12345
4 probes sent.
0 successful, 4 failed.
Was unable to connect, cannot provide trip statistics.

C:\Users\Administrator>

随便写一个12345端口,看到No response,就是没有打开的。

请同学们自己查看一下FTP 21端口,SSH 22端口。

 

tcping有局限性,它只能检查tcp端口,而不能检查udp端口。这个要注意。

 

转至:http://www.maixj.net/wz/tcping-duankou-16414

posted @ 2017-09-19 14:13  coolid  阅读(21378)  评论(0编辑  收藏  举报