用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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM