初识Nmap

108 阅读3分钟

携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第1天,点击查看活动详情 

简介

Nmap(Network Mapper 网络映射器)是一款开源的网络探测工具。网管用它查看整个网络的信息,管理服务升级计划,以及监视主机和服务。

6个端口状态

Nmap所识别的6个端口状态。

  • open(开放的)

    该状态表示应用程序正在该端口接收TCP连接或者UDP报文。

  • closed(关闭的)

    该状态表示关闭的端口对于Nmap也是可访问的, 但没有应用程序在其上监听。

  • filtered(被过滤的)

    该状态表示Nmap无法确定该端口是否开放,主要原因是包过滤阻止探测报文到达端口。

  • unfiltered(未被过滤的)

    该状态表示Nmap无法确定它是开放还是关闭,注意端口是可以访问的。

  • open|filtered(开放或者被过滤的)

    该状态表示无法确定端口是开放还是被过滤的。

  • closed|filtered(关闭或者被过滤的)

    该状态表示无法确定端口是关闭的还是被过滤的。

一个典型的Nmap扫描

Nmap还能提供关于目标主机的反向域名,操作系统,设备类型和MAC地址。一个典型的Nmap扫描如例 1 所示。

在这个例子中,-A表示探测目标主机操作系统及其版本,-T4 表示加快执行速度。输出包含了大量有用的信息,比如 22 端口的 ssh 服务,80 端口的 http 服务。

# nmap -A -T4 scanme.nmap.org

Starting Nmap 7.92 ( https://nmap.org ) at 2022-08-03 08:21 中国标准时间
Nmap scan report for scanme.nmap.org (45.33.32.156)
Host is up (0.21s latency).
Other addresses for scanme.nmap.org (not scanned): 2600:3c01::f03c:91ff:fe18:bb2f
Not shown: 995 closed tcp ports (reset)
PORT      STATE    SERVICE      VERSION
22/tcp    open     ssh          OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.13 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   1024 ac:00:a0:1a:82:ff:cc:55:99:dc:67:2b:34:97:6b:75 (DSA)
|   256 96:02:bb:5e:57:54:1c:4e:45:2f:56:4c:4a:24:b2:57 (ECDSA)
|_  256 33:fa:91:0f:e0:e1:7b:1f:6d:05:a2:b0:f1:54:41:56 (ED25519)
80/tcp    open     http         Apache httpd 2.4.7 ((Ubuntu))
|_http-title: Go ahead and ScanMe!
|_http-favicon: Nmap Project
|_http-server-header: Apache/2.4.7 (Ubuntu)
445/tcp   filtered microsoft-ds
9929/tcp  open     nping-echo   Nping echo
31337/tcp open     tcpwrapped
Device type: general purpose|firewall|storage-misc|webcam|WAP
Running (JUST GUESSING): Linux 3.X|2.6.X|4.X|2.4.X (90%), WatchGuard Fireware 11.X (86%), Synology DiskStation Manager 5.X (85%), Tandberg embedded (85%)
OS CPE: cpe:/o:linux:linux_kernel:3.4 cpe:/o:linux:linux_kernel:2.6.32 cpe:/o:linux:linux_kernel:4.2 cpe:/o:watchguard:fireware:11.8 cpe:/o:linux:linux_kernel cpe:/a:synology:diskstation_manager:5.1 cpe:/h:tandberg:vcs cpe:/o:linux:linux_kernel:2.4
Aggressive OS guesses: Linux 3.4 (90%), Linux 2.6.32 (86%), Linux 2.6.32 or 3.10 (86%), Linux 3.5 (86%), Linux 4.2 (86%), WatchGuard Fireware 11.8 (86%), Synology DiskStation Manager 5.1 (85%), Linux 2.6.35 (85%), Linux 2.6.39 (85%), Linux 3.10 - 3.12 (85%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 20 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 8888/tcp)
HOP RTT       ADDRESS
1   6.00 ms   192.168.185.214
2   67.00 ms  192.168.25.254
3   66.00 ms  192.168.123.21
4   ...
5   44.00 ms  112.50.201.69
6   55.00 ms  218.207.222.81
7   31.00 ms  111.24.11.61
8   51.00 ms  221.183.98.54
9   31.00 ms  111.24.5.182
10  46.00 ms  221.176.24.6
11  53.00 ms  221.176.19.214
12  ...
13  235.00 ms 223.120.12.41
14  228.00 ms 223.120.6.70
15  282.00 ms te0-10-0-6-4.ccr41.lax05.atlas.cogentco.com (38.104.85.161)
16  568.00 ms be3243.ccr41.lax01.atlas.cogentco.com (154.54.27.117)
17  857.00 ms be3359.ccr42.lax01.atlas.cogentco.com (154.54.3.69)
18  231.00 ms 38.142.11.154
19  244.00 ms 38.142.11.154
20  233.00 ms scanme.nmap.org (45.33.32.156)

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 83.05 seconds