[20171204]nc快速判斷埠是否開啟2.txt

lfree發表於2017-12-04

[20171204]nc快速判斷埠是否開啟2.txt

--//前幾天寫了一篇透過nc快速判斷開啟那些埠,連結如下:
http://blog.itpub.net/267265/viewspace-2148121/

--//如果要判斷一定的範圍,可以執行如下:
$ echo a | nc -w 1 -n -v  192.168.xxx.xx 1-1521 2>/dev/null | grep "succeeded"
Connection to 192.168.xxx.xx 21 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 22 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 80 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 111 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 113 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 443 port [tcp/*] succeeded!
Connection to 192.168.xxx.xx 1521 port [tcp/*] succeeded!

--//在服務端檢查如下:
# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:32768               0.0.0.0:*                   LISTEN      2553/rpc.statd
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      2533/portmap
tcp        0      0 0.0.0.0:113                 0.0.0.0:*                   LISTEN      27632/xinetd
tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISTEN      2966/vsftpd
tcp        0      0 :::80                       :::*                        LISTEN      26638/httpd
tcp        0      0 :::1521                     :::*                        LISTEN      26334/tnslsnr
tcp        0      0 :::22                       :::*                        LISTEN      12568/sshd
tcp        0      0 :::443                      :::*                        LISTEN      26638/httpd

--//另外測試發現掃描還很快,如果我從1-65000,大約4-5秒ok(注另外的伺服器):

# echo a | nc -w 1 -n -v  192.168.yyy.yy 1-65000 2>/dev/null | grep "succeeded"
Connection to 192.168.yyy.yy 22 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 111 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 833 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 857 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 953 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 1521 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 2049 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 51082 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 52744 port [tcp/*] succeeded!
Connection to 192.168.yyy.yy 57371 port [tcp/*] succeeded!

# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 192.168.yyy.yy:1521         0.0.0.0:*                   LISTEN      61210/tnslsnr
tcp        0      0 127.0.0.1:1521              0.0.0.0:*                   LISTEN      61210/tnslsnr
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      25383/sshd
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      29590/cupsd
tcp        0      0 0.0.0.0:953                 0.0.0.0:*                   LISTEN      39779/rpc.statd
tcp        0      0 0.0.0.0:857                 0.0.0.0:*                   LISTEN      39686/rpc.mountd
tcp        0      0 0.0.0.0:57371               0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      -
tcp        0      0 0.0.0.0:833                 0.0.0.0:*                   LISTEN      39661/rpc.rquotad
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      39531/portmap
tcp        0      0 :::22                       :::*                        LISTEN      25383/sshd
tcp        0      0 :::52744                    :::*                        LISTEN      9755/ora_d000_book
tcp        0      0 :::51082                    :::*                        LISTEN      14344/ora_d000_orcl

--//順便解答連結的問題 [20170825]不啟動監聽遠端能連線資料庫嗎2 =>[20170825]不啟動監聽遠端能連線資料庫嗎
--//如何探測oracle 共享伺服器埠,我感覺比nmap還有快.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2148257/,如需轉載,請註明出處,否則將追究法律責任。

相關文章