nc扫描端口

    技术2025-12-15  5

    nc可以用来扫描端口,但是各个系统之间版本差别较大

    centos7:

    nc 不支持-r,i.e. 无法扫描端口范围。如果只测试一个端口可以用nc

    [root@baidu ~]# nc -4vzw 1 www.baidu.com 81 Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connection to 39.156.66.18 failed: Connection timed out. Ncat: Trying next address... Ncat: Connection timed out. [root@baidu ~]# nc -4vzw 1 www.baidu.com 80 Ncat: Version 7.50 ( https://nmap.org/ncat ) Ncat: Connected to 39.156.66.18:80. Ncat: 0 bytes sent, 0 bytes received in 0.03 seconds.

    范围扫描可以用nmap

    yum install nmap -y [root@baidu ~]# nmap -sS -p 79-81 www.baidu.com Starting Nmap 6.40 ( http://nmap.org ) at Nmap scan report for www.baidu.com (39.156.66.14) Host is up (0.0073s latency). Other addresses for www.baidu.com (not scanned): 39.156.66.18 PORT STATE SERVICE 79/tcp filtered finger 80/tcp open http 81/tcp filtered hosts2-ns Nmap done: 1 IP address (1 host up) scanned in 1.32 seconds

    mac:

    nc 支持-r,但是超时不用-w,这个nc忘了是不是系统自带的了,版本号都没查到

    root@baidu ~ % nc -rvz -i 1 -G 1 39.156.66.18 79-81 Connection to 39.156.66.18 port 80 [tcp/http] succeeded! nc: connectx to 39.156.66.18 port 81 (tcp) failed: Operation timed out nc: connectx to 39.156.66.18 port 79 (tcp) failed: Operation timed out

    百度承受了很多测试的责任,能力越大责任越大啊,哈哈蛤

    其他的系统暂时未尝试,大家如果有好的方法欢迎留言

    Processed: 0.010, SQL: 9