[20171204]nc快速判断端口是否打开2.txt

[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还有快.

上一篇:Aliplayer快速入门:资源引用、添加容器元素与初始化


下一篇:阿里云自营建站_阿里云模板网站_阿里云速成美站