当前位置:   article > 正文

如何扫描网址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	  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

或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.
  • 1
  • 2
  • 3
  • 4

二 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
  • 1
  • 2
  • 3
  • 4
  • 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.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

扫描TCP开放端口

$nmap -sT baidu.com
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https
  • 1
  • 2
  • 3
  • 4

扫描UDP开放端口 需root权限

$nmap -sU baidu.com
  • 1

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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/663647
推荐阅读
相关标签
  

闽ICP备14008679号