nmap [Scan Type(s)] [Options] {target specification}
nmap [扫描方式(s)] [选项] [扫描目标]web
SCAN TECHNIQUES:扫描方式网络
-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans #半链接扫描/全链接扫描(默认的方式)/.. -sU: UDP Scan #UDP端口扫描 -sN/sF/sX: TCP Null, FIN, and Xmas scans --scanflags <flags>: Customize TCP scan flags #自定义TCP标签 -sI <zombie host[:probeport]>: Idle scan #空闲扫描 -sY/sZ: SCTP INIT/COOKIE-ECHO scans -sO: IP protocol scan -b <FTP relay host>: FTP bounce scan
HOST DISCOVERY: 主机发现app
-sL: List Scan - simply list targets to scan #反向域名解析,用于主机发现 -sn: Ping Scan - disable port scan #ping扫描,不进行端口扫描 -Pn: Treat all hosts as online -- skip host discovery #跳过主机存活探测阶段 -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports #TCP syn/ack,udp/sctp探测指定端口 -PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes -PO[protocol list]: IP Protocol Ping -n/-R: Never do DNS resolution/Always resolve [default: sometimes] #不进行域名解析 / 都进行域名解析 --dns-servers <serv1[,serv2],...>: Specify custom DNS servers --system-dns: Use OS's DNS resolver --traceroute: Trace hop path to each host
PORT SPECIFICATION AND SCAN ORDER:端口说明和扫描顺序dom
-p <port ranges>: Only scan specified ports #扫描指定的扫描,Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9 --exclude-ports <port ranges>: Exclude the specified ports from scanning #排除端口 -F: Fast mode - Scan fewer ports than the default scan #快速扫描有限的端口 -r: Scan ports consecutively - don't randomize #不按随机顺序扫描端口 --top-ports <number>: Scan <number> most common ports #扫描最多见的端口 --port-ratio <ratio>: Scan ports more common than <ratio>
SERVICE/VERSION DETECTION: 版本检测socket
-sV: Probe open ports to determine service/version info #探测版本信息,(能够用-A 探测操做系统和版本信息) --version-intensity <level>: Set from 0 (light) to 9 (try all probes)#设置版本扫描强度 --version-light: Limit to most likely probes (intensity 2)#强度2的别名 --version-all: Try every single probe (intensity 9)#强度9的别名 --version-trace: Show detailed version scan activity (for debugging) #显示详细的版本扫描信息
SCRIPT SCAN: 脚本扫描tcp
-sC: equivalent to --script=default --script=<Lua scripts>: <Lua scripts> 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=<Lua scripts>: Show help about scripts. <Lua scripts> is a comma-separated list of script-files or script-categories.
OS DETECTION: 操做系统ide
-O: Enable OS detection #操做系统探测(也能够用-A进行操做系统和版本探测) --osscan-limit: Limit OS detection to promising targets --osscan-guess: Guess OS more aggressively #猜想操做系统
TIMING AND PERFORMANCE: 时间和性能性能
-T<0-5>: Set timing template (higher is faster)#设置时间模版 --min-hostgroup/max-hostgroup <size>: Parallel host scan group sizes --min-parallelism/max-parallelism <numprobes>: Probe parallelization --min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <time>: Specifies probe round trip time. --max-retries <tries>: Caps number of port scan probe retransmissions. --host-timeout <time>: Give up on target after this long --scan-delay/--max-scan-delay <time>: Adjust delay between probes --min-rate <number>: Send packets no slower than <number> per second --max-rate <number>: Send packets no faster than <number> per second
FIREWALL/IDS EVASION AND SPOOFING: 防火墙/入侵检测绕过和欺骗ui
-f; --mtu <val>: fragment packets (optionally w/given MTU)#指定mtu将tcp头部分红3个分片 -D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys -S <IP_Address>: Spoof source address#源地址欺骗(通常和-Pn,-e一块儿使用) -e <iface>: Use specified interface#使用指定接口(通常和-Pn,-e一块儿使用) -g/--source-port <portnum>: Use given port number#源端口欺骗(有些源为53和20端口,防火墙不会拦截) --proxies <url1,[url2],...>: Relay connections through HTTP/SOCKS4 proxies --data <hex string>: Append a custom payload to sent packets #附加16进制字符串 --data-string <string>: Append a custom ASCII string to sent packets#附加字符串 --data-length <num>: Append random data to sent packets#指定数据包大小,并附加随机数据 --ip-options <options>: Send packets with specified ip options --ttl <val>: Set IP time-to-live field --spoof-mac <mac address/prefix/vendor name>: Spoof your MAC address --badsum: Send packets with a bogus TCP/UDP/SCTP checksum
OUTPUT: 输出this
-oN/-oX/-oS/-oG <file>: Output scan in normal, XML, s|<rIpt kIddi3, and Grepable format, respectively, to the given filename.#标准输出/xml输出 -oA <basename>: 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) --reason: Display the reason a port is in a particular state#输出端口状态的缘由 --open: Only show open (or possibly open) ports --packet-trace: Show all packets sent and received #查看全部数据包的收发 --iflist: Print host interfaces and routes (for debugging) #打印主机的网络接口和路由 --append-output: Append to rather than clobber specified output files#在输出文件中追加,(默认是覆盖) --resume <filename>: Resume an aborted scan#恢复停止的扫描 --stylesheet <path/URL>: XSL stylesheet to transform XML output to HTML --webxml: Reference stylesheet from Nmap.Org for more portable XML --no-stylesheet: Prevent associating of XSL stylesheet w/XML output
MISC: 其余选项
-6: Enable IPv6 scanning -A: Enable OS detection, version detection, script scanning, and traceroute #启动操做系统检测,版本检测,脚本扫描,和路由跟踪 --datadir <dirname>: Specify custom Nmap data file location --send-eth/--send-ip: Send using raw ethernet frames or IP packets --privileged: Assume that the user is fully privileged --unprivileged: Assume the user lacks raw socket privileges -V: Print version number -h: Print this help summary page.
TARGET SPECIFICATION: 扫描目标
能够输入主机名,ip,网段等
Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
-iL <inputfilename>: Input from list of hosts/networks #从文件中读取目标列表,(每项用法空格,制表符或回车符分开) -iR <num hosts>: Choose random targets #随机选择n个目标 --exclude <host1[,host2][,host3],...>: Exclude hosts/networks #排除目标 --excludefile <exclude_file>: Exclude list from file #排除文件中目标列表,(每项用法空格,制表符或回车符分开)
EXAMPLES: nmap -sS -PS80 -iR 1 -p 80 nmap -v -A scanme.nmap.org nmap -v -sn 192.168.0.0/16 10.0.0.0/8 #pingscan主机存活探测 nmap -v -iR 10000 -Pn -p 80 #随机10000个ip 不探测存活 直接探测80端口