Nmap 参考指南
目錄
介绍
一、 描述
二、 译注
三、 选项概要
四、 目标说明
五、 主机发现
六、 端口扫描基础
七、 端口扫描技术
八、 端口说明和扫描顺序
九、 服务和版本探测
十、 操作系统探测
十一、 时间和性能
十二、 防火墙/IDS 躲避和哄骗
十三、 输出
十四、 其它选项
十五、 运行时的交互
十六、 实例
十七、 Bugs
十八、 作者
十九、 法律事项(版权、许可证、担保(缺)、出口限制)
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
Nmap 参考指南
Nmap 参考指南
Table of Contents
描述
译注
选项概要
目标说明
主机发现
端口扫描基础
端口扫描技术
端口说明和扫描顺序
服务和版本探测
操作系统探测
时间和性能
防火墙/IDS
躲避和哄骗
输出
其它选项
运行时的交互
实例
Bugs
作者
法律事项(版权、许可证、担保、出口限制)
Unofficial Translation Disclaimer
Name
nmap — 网络探测工具和安全/端口扫描器
Synopsis
nmap [ 扫描类型 ...] [ 选项 ] { 扫描目标说明 }
介绍
3
Nmap 参考指南
一、 描述
Nmap (“Network Mapper(网络映射器)”) 是一款开放源代码的 网络探测和安全审核的工具。
它的设计目标是快速地扫描大型网络,当然用它扫描单个 主机也没有问题。Nmap 以新颖的
方式 使用原始 IP 报文来发现网络上有哪些主机,那些 主机提供什么服务(应用程序名和版
本),那 些服务运行在什么操作系统(包括版本信息), 它们使用什么类型的报文过滤器/防火
墙,以及一堆其它功能。虽然 Nmap 通常用于安全审核, 许多系统管理员和网络管理员也
用它来做一些 日常的工作,比如查看整个网络的信息, 管理服务升级计划,以及监视主机
和服务的运行。
Nmap 输出的是扫描目标的列表,以及每个目标的补充信息,至于是哪些信息则依赖于所使用的
选项。 “所感兴趣的端口表格”是其中的关键。那张表列出端口号,协议,服务名称和状态。 状态
可能是 open(开放的),filtered(被过滤的), closed(关闭的),或者 unfiltered(未被过滤的)。
Open(开放的)意味着目标机器上的应用程序正在该端口监听连接/报文。 filtered(被 过滤的) 意味
着防火墙,过滤器或者其它网络障碍阻止了该端口被访问,Nmap 无法得知 它是 open(开放的)
还是 closed(关闭的)。 closed(关闭的) 端口没有应用程序在它上面监听,但 是他们随时可能开
放。 当端口对 Nmap 的探测做出响应,但是 Nmap 无法确定它们是关闭还是开 放时,这些端口
就被认为是 unfiltered(未被过滤的) 如果 Nmap 报告状态组合 open|filtered
和 closed|filtered 时,那说明 Nmap 无法确定该端口处于两个状态中的哪一个状态。 当要
求进行版本探测时,端口表也可以包含软件的版本信息。当要求进行 IP 协议扫描时 (-sO),
Nmap 提供关于所支持的 IP 协议而不是正在监听的端口的信息。
除了所感兴趣的端口表,Nmap 还能提供关于目标机的进一步信息,包括反向域名,操作系
统猜 测,设备类型,和 MAC 地址。
一个典型的 Nmap 扫描如 Example 1, “一个典型的 Nmap 扫描”所示。在这个例子中,唯一
的选 项是-A, 用来进行操作系统及其版本的探测,-T4 可以加快执行速度,接着是两个目
标主机名
Example 1. 一个典型的 Nmap 扫描
一、描述
4
Nmap 参考指南
# nmap -A -T4 scanme.nmap.org playground
[Starting nmap ( http://www.insecure.org/nmap/](http://www.insecure.org/nmap/) )
Interesting ports on scanme.nmap.org (205.217.153.62):
(The 1663 ports scanned but not shown below are in state: filtered)
port STATE SERVICE VERSION
22/tcp open ssh OpenSSH 3.9p1 (protocol 1.99)
53/tcp open domain
70/tcp closed gopher
80/tcp open http Apache httpd 2.0.52 ((Fedora))
113/tcp closed auth
Device type: general purpose
Running: Linux 2.4.X|2.5.X|2.6.X
OS details: Linux 2.4.7 - 2.6.11,Linux 2.6.0 - 2.6.11 Uptime 33。908
days (since Thu Jul 21 03:38:03 2005)
Interesting ports on playground。nmap。或者 g (192.168.0.40):
(The 1659 ports scanned but not shown below are in state: closed)
port STATE SERVICE VERSION
135/tcp open msrpc Microsoft Windows RPC
139/tcp open netbios-ssn
389/tcp open ldap?

445/tcp open microsoft-ds Microsoft Windows XP microsoft-ds 1002/tcp open
windows-icfw?
1025/tcp open msrpc Microsoft Windows RPC 1720/tcp open
H.323/Q.931 CompTek AquaGateKeeper
5800/tcp open vnc-http RealVNC 4.0 (Resolution 400x250; VNC TCP port: 5900)
5900/tcp open vnc VNC (protocol 3.8)
MAC Address: 00:A0:CC:63:85:4B (Lite-on Communications)
Device type: general purpose
Running: Microsoft Windows NT/2K/XP
OS details: Microsoft Windows XP Pro RC1+ through final release
Service Info: OSs: Windows,Windows XP
Nmap finished: 2 IP addresses (2 hosts up) scanned in 88.392 seconds
一、描述
5
Nmap 参考指南
二、 译注
该 Nmap 参考指南中文版由 Fei Yang fyang1024@gmail.com 和 Lei Li lilei_721@6611.org
从 英文版本翻译而来。我们希望这将使全世界使用中文的人们更了解 Nmap,但我们不能保
证 该 译 本 和 官 方 的 英 文 版 本 一 样 完 整 , 也 不 能 保 证 同 步 更 新 。 它 可 以 在 Creative
Commons Attribution License 下被修改并重新发布。
二、译注
6
Nmap 参考指南
三、 选项概要
当 Nmap 不带选项运行时,该选项概要会被输出,最新的版本在这里
http://www.insecure.org/nmap/data/nmap.usage.txt。它帮助人们记住最常用的选项,但不
能替代本手册其余深入的文档,一些晦涩的选项甚至不在这里。
Usage: nmap [Scan Type(s)] [Options] {target specification}
TARGET SPECIFICATION:
HOST DISCOVERY:
Can pass hostnames, IP addresses, networks, etc.
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0-255.0-255.1-254
-iL
: Input from list of hosts/networks
-iR : Choose random targets
--exclude : Exclude hosts/networks
--excludefile : Exclude list from file
-sL: List Scan - simply list targets to scan
-sP: Ping Scan - go no further than determining if host is online
-P0: Treat all hosts as online -- skip host discovery
-PS/PA/PU [portlist]: TCP SYN/ACK or UDP discovery probes to given ports
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes
-n/-R: Never do DNS resolution/Always resolve [default: sometimes resolve]
SCAN TECHNIQUES:
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
-sN/sF/sX: TCP Null, FIN, and Xmas scans
--scanflags : Customize TCP scan flags
-sI : Idlescan
-sO: IP protocol scan
-b : FTP bounce scan
PORT SPECIFICATION AND SCAN ORDER:
-p : Only scan specified ports
Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080
-F: Fast - Scan only the ports listed in the nmap-services file)
-r: Scan ports consecutively - don't randomize
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info
--version-light: Limit to most likely probes for faster identification
--version-all: Try every single probe for version detection
--version-trace: Show detailed version scan activity (for debugging)
OS DETECTION:
-O: Enable OS detection
--osscan-limit: Limit OS detection to promising targets
--osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
-T[0-6]: Set timing template (higher is faster)
--min-hostgroup/max-hostgroup : Parallel host scan group sizes
--min-parallelism/max-parallelism : Probe parallelization
--min_rtt_timeout/max-rtt-timeout/initial-rtt-timeout : Specifies probe round t
--host-timeout : Give up on target after this long
--scan-delay/--max_scan-delay : Adjust delay between probes
FIREWALL/IDS EVASION AND SPOOFING:
-f; --mtu : fragment packets (optionally w/given MTU)
-D : Cloak a scan with decoys
-S : Spoof source address
-e : Use specified interface
-g/--source-port : Use given port number
--data-length : Append random data to sent packets
--ttl : Set IP time-to-live field
--spoof-mac : Spoof your MAC address
OUTPUT:
-oN/-oX/-oS/-oG : Output scan results in normal, XML, s|: Output in the three major formats at once
-v: Increase verbosity level (use twice for more effect)
-d[level]: Set or increase debugging level (Up to 9 is meaningful)
--packet-trace: Show all packets sent and received
--iflist: Print host interfaces and routes (for debugging)
三、 选项概要
7
Nmap 参考指南
MISC:
--append-output: Append to rather than clobber specified output files
--resume
: Resume an aborted scan
--stylesheet : XSL stylesheet to transform XML output to HTML
--no_stylesheet: Prevent Nmap from associating XSL stylesheet w/XML output
-6: Enable IPv6 scanning
-A: Enables OS detection and Version detection
--datadir : Specify custom Nmap data file location
--send-eth/--send-ip: Send packets using raw ethernet frames or IP packets
--privileged: Assume that the user is fully privileged
-V: Print version number
-h: Print this help summary page.
EXAMPLES:
nmap -v -A scanme.nmap.org
nmap -v -sP 192.168.0.0/16 10.0.0.0/8
nmap -v -iR 10000 -P0 -p 80
三、 选项概要
8