官方文档 :http://www.nmap.com.cn/

-iL : Input from list of hosts/networks

指定输入文件,可用于指定扫描的目标 ex: -iL 192.168.0.0/16

-iR : Choose random targets

选择随机目标 ex:-iR 200 (选定随机的200个目标)

–exclude <host1[,host2][,host3],…>: Exclude hosts/networks

排除主机,即扫描的时候越过该主机

–excludefile : Exclude list from file

同上,引进黑名单 ex:–excludefile host.txt

HOST DISCOVERY: 主机发现

-sL: List Scan - simply list targets to scan

显示扫描主机的列表,有助于查看

-sn: Ping Scan - disable port scan

使用ping进行扫描,由于现有网络主机大部分防火墙拒绝icmp协议,一般无用

-Pn: Treat all hosts as online – skip host discovery

不进行主机发现,直接进行深层扫描,即使用此命令时,nmap认为主机在线

-PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports

使用四种方式探测端口

-PS 端口列表用,隔开[tcp80 syn 扫描]
-PA 端口列表用,隔开ack扫描【默认扫描端口1-1024】
-PU 端口列表用,隔开[udp高端口扫描 穿越只过滤tcp的防火墙]

-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes

-PE 的ICMP Echo扫描简单来说是通过向目标发送ICMP Echo数据包来探测目标主机是否存活,但由于许多主机的防火墙会禁止这些报文,所以仅仅ICMP扫描通常是不够的

-PP 的ICMP time stamp时间戳扫描在大多数防火墙配置不当时可能会得到回复,可以以此方式来判断目标主机是否存活。倘若目标主机在线,该命令还会探测其开放的端口以及运行的服务

-PM 的ICMP address maskPing地址掩码扫描会试图用备选的ICMP等级Ping指定主机,通常有不错的穿透防火墙的效果

-PO[protocol list]: IP Protocol Ping

-PO ”选项进行一个IP协议ping。

语法:nmap –PO 协议 目标

IP协议ping用指定的协议发送一个包给目标。如果没有指定协议,默认的协议是 1 (ICMP), 2 (IGMP)和4 (IP-in-IP)
-n/-R: Never do DNS resolution/Always resolve [default: sometimes]

选择是否进行dns解析

“ -n ”参数用来说明不使用反向域名解析。

语法:nmap –n 目标

反向域名解析会明显的降低Nmap扫描的速度。使用“-n”选项会极大的减少扫描时,特别是当扫描大量的主机时。如果你不关心目标系统的DNS信息,更喜欢进行一个能快速产生结果的扫描时,可以使用这个选项

–dns-servers <serv1[,serv2],…>: Specify custom DNS servers

明确使用的DNS服务器

–system-dns: Use OS’s DNS resolver

使用主机nmap运行主机的dns

选项-system-dns指示NMAP使用主机系统自带的DNS解析器,而不是其自身内部的方法

–traceroute: Trace hop path to each host

跟踪扫描主机的网络路线

SCAN TECHNIQUES:

-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans

指定nmap的扫描方式,默认为sT

-sU: UDP Scan

使用UDP协议进行扫描

-sN/sF/sX: TCP Null, FIN, and Xmas scans

指定使用TCP Null, FIN, and Xmas scans秘密扫描方式来协助探测对方的TCP端口状态

–scanflags : Customize TCP scan flags

定制TCP包的flags

-sI <zombie host[:probeport]>: Idle scan

指定使用idle scan方式来扫描目标主机(前提需要找到合适的zombie host)

-sY/sZ: SCTP INIT/COOKIE-ECHO scans

使用SCTP INIT/COOKIE-ECHO来扫描SCTP协议端口的开放的情况

-sO: IP protocol scan

使用IP protocol 扫描确定目标机支持的协议类型

-b : FTP bounce scan

使用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,S:9

扫描指定的端口
实例: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9(其中T代表TCP协议、U代表UDP协议、S代表SCTP协议)

–exclude-ports : Exclude the specified ports from scanning

-F: Fast mode - Scan fewer ports than the default scan

快速模式,仅扫描TOP 100的端口

-r: Scan ports consecutively - don’t randomize

不进行端口随机打乱的操作(如无该参数,nmap会将要扫描的端口以随机顺序方式扫描,以让nmap的扫描不易被对方防火墙检测到)

–top-ports : Scan most common ports

扫描开放概率最高的number个端口(nmap的作者曾经做过大规模地互联网扫描,以此统计出网络上各种端口可能开放的概率。以此排列出最有可能开放端口的列表,具体可以参见文件:nmap-services。默认情况下,nmap会扫描最有可能的1000个TCP端口)

–port-ratio : Scan ports more common than

扫描指定频率以上的端口。与上述–top-ports类似,这里以概率作为参数,让概率大于–port-ratio的端口才被扫描。显然参数必须在在0到1之间,具体范围概率情况可以查看nmap-services文件

SERVICE/VERSION DETECTION: 网络主机服务版本探测
-sV: Probe open ports to determine service/version info

指定让Nmap进行版本侦测

–version-intensity : Set from 0 (light) to 9 (try all probes)

指定版本侦测强度(0-9),默认为7。数值越高,探测出的服务越准确,但是运行时间会比较长。

–version-light: Limit to most likely probes (intensity 2)

指定使用轻量侦测方式 (intensity 2)

–version-all: Try every single probe (intensity 9)

尝试使用所有的probes进行侦测 (intensity 9)

–version-trace: Show detailed version scan activity (for debugging)

显示出详细的版本侦测过程信息。

SCRIPT SCAN:脚本扫描

-sC: equivalent to –script=default

指定script脚本为默认值

–script=: is a comma separated list of
directories, script-files or script-categories

使用某个或某类脚本进行扫描,支持通配符描述

–script-args=<n1=v1,[n2=v2,…]>: provide arguments to scripts

为脚本提供默认参数

–script-args-file=filename: provide NSE script args in a file

使用文件来为脚本提供参数

–script-trace: Show all data sent and received

显示脚本执行过程中发送与接收的数据

–script-updatedb: Update the script database.

更新脚本数据库,每次更新脚本后

–script-help=: Show help about scripts.
is a comma-separated list of script-files or
script-categories.

显示脚本的帮助信息,其中部分可以逗号分隔的文件或脚本类别

OS DETECTION:操作系统探测
-O: Enable OS detection

指定Nmap进行OS侦测。

–osscan-limit: Limit OS detection to promising targets

限制Nmap只对确定的主机的进行OS探测(至少需确知该主机分别有一个open和closed的端口)。

–osscan-guess: Guess OS more aggressively

大胆猜测对方的主机的系统类型。由此准确性会下降不少,但会尽可能多为用户提供潜在的操作系统。

TIMING AND PERFORMANCE:
Options which take are in seconds, or append ‘ms’ (milliseconds),
‘s’ (seconds), ‘m’ (minutes), or ‘h’ (hours) to the value (e.g. 30m).
-T<0-5>: Set timing template (higher is faster)

-T0 偏执的:非常非常慢,用于IDS逃逸

-T1 猥琐的:相当慢,用于IDS逃逸

-T2 有礼貌的:降低速度以消耗更小的带宽,比默认慢十倍

-T3 普通的:默认,根据目标的反应自动调整时间模式

-T4 野蛮的:假定处在一个很好的网络环境,请求可能会淹没目标

-T5 疯狂的:非常野蛮,很可能会淹没目标端口或是漏掉一些开放端口

–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 trip time.

指定每轮探测的时间

–max-retries : Caps number of port scan probe retransmissions.

扫描探测的上限次数设定

–host-timeout : Give up on target after this long

设置timeout时间

–scan-delay/–max-scan-delay : Adjust delay between probes

调整两次探测之间的延迟

–min-rate : Send packets no slower than per second
–max-rate : Send packets no faster than per second

每秒发送数据包不少于次

FIREWALL/IDS EVASION AND SPOOFING:防火墙/IDS规避
-f; –mtu : fragment packets (optionally w/given MTU)

指定使用分片、指定数据包的MTU.

-D <decoy1,decoy2[,ME],…>: Cloak a scan with decoys

用一组IP地址掩盖真实地址,其中ME填入自己的IP地址

-S : Spoof source address

伪装成其他IP地址

-e : Use specified interface

使用特定的网络接口,指定网卡

-g/–source-port : Use given port number

使用指定源端口

–proxies <url1,[url2],…>: Relay connections through HTTP/SOCKS4 proxies

使用代理

–data : Append a custom payload to sent packets

给数据包添加指定数据

–data-string : Append a custom ASCII string to sent packets

给数据包添加指定ASCII字符串

–data-length : Append random data to sent packets

填充随机数据让数据包长度达到Num

–ip-options : Send packets with specified ip options

使用指定的IP选项来发送数据包。

–ttl : Set IP time-to-live field

设置time-to-live时间,没什么用

–spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address

伪装MAC地址,伪装mac地址为指定值

–badsum: Send packets with a bogus TCP/UDP/SCTP checksum

使用错误的checksum来发送数据包(正常情况下,该类数据包被抛弃,如果收到回复,说明回复来自防火墙或IDS/IPS)

可用户检测是否有防火墙或IDS/IPS

OUTPUT:
-oN/-oX/-oS/-oG : Output scan in normal, XML, s|<rIpt kIddi3,
and Grepable format, respectively, to the given filename.

指定输出文件格式,分为正常,XML

-oA : Output in the three major formats at once

用生成以上格式的文件

-v: Increase verbosity level (use -vv or more for greater effect)

这个选项使用两次,会提供更详细的信息

-d: Increase debugging level (use -dd or more for greater effect)

(提高或设置调试级别,最高级别-d9,输出更多的细节)
————————————————

原文链接:https://blog.csdn.net/qq_21310689/java/article/details/85273250