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端口