如何扫描网址ip的特定端口或扫描全部网段

一 nc
sudo apt install netcat-openbsd

$nc -vz  baidu.com 80
Connection to baidu.com (39.156.66.10) 80 port [tcp/http] succeeded!

$nc -h
nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
	  [-m minttl] [-O length] [-P proxy_username] [-p source_port]
	  [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit]
	  [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]
	  [destination] [port]
	  
-v 	verbose
-z     Zero-I/O mode	  

或sudo apt install ncat

$ ncat -vz  baidu.com 80
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connected to 110.242.68.66:80.
Ncat: 0 bytes sent, 0 bytes received in 0.27 seconds.

二 telnet
sudo apt install telnet

$telnet 192.168.2.61 22
Trying 192.168.2.61...
Connected to 192.168.2.61.
Escape character is '^]'.
SSH-2.0-OpenSSH_9.5

转义符为 ‘^]’.
ctrl + ] 之后quit 或 q

$telnet baidu.com 80
Trying 39.156.66.10...
Connected to baidu.com.
Escape character is '^]'.
^]
telnet> q
Connection closed.

$telnet baidu.com 443
Trying 110.242.68.66...
Connected to baidu.com.
Escape character is '^]'.
^]
telnet> q
Connection closed.

三 nmap

$ nmap baidu.com -p 443
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-17 08:06 CST
Nmap scan report for baidu.com (110.242.68.66)
Host is up (0.023s latency).
Other addresses for baidu.com (not scanned): 39.156.66.10

PORT    STATE SERVICE
443/tcp open  https

Nmap done: 1 IP address (1 host up) scanned in 0.21 seconds

扫描TCP开放端口

$nmap -sT baidu.com
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https

扫描UDP开放端口 需root权限

$nmap -sU baidu.com

nmap 扫描整个网段

nmap -sn 192.168.1.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2024-01-17 08:07 CST
Nmap scan report for 192.168.1.1
Host is up (0.0022s latency).
Nmap scan report for 192.168.1.2
Host is up (0.0046s latency).
Nmap scan report for 192.168.1.5
Host is up (0.0032s latency).
Nmap done: 256 IP addresses (3 hosts up) scanned in 6.96 seconds
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yvee

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值