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協議而不是正在監聽的端口的信息。
TARGET SPECIFICATION: 目標說明
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 <inputfilename>: Input from list of hosts/networks 從文件中或者掃描列表,參數值為文件名
-iR <num hosts>: Choose random targets 隨機掃描幾個host,參數為個數,0表示無限
--exclude <host1[,host2][,host3],...>: Exclude hosts/networks 排除目標主機
--excludefile <exclude_file>: Exclude list from file 排除文件里的主機
HOST DISCOVERY: 主機發現
-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 向目的主機端口進行TCP或者UDP報文,ACK或者SYN報文,模擬三次握手中的過程,通過RST(錯誤報文)進行主機發現
-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes 使用ICMP echo, timestamp, and netmask 請求包發現主機
-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 <flags>: Customize TCP scan flags
-sI <zombie host[:probeport]>: Idlescan IP掃描,查看主機支持協議
-sO: IP protocol scan
-b <ftp relay host>: FTP bounce scan
PORT SPECIFICATION AND SCAN ORDER:
-p <port ranges>: 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) 快速掃描,具體端口在nmap-service文件中
-r: Scan ports consecutively - don't randomize 不隨機掃描,默認情況下是隨機掃描的,因為速度快
SERVICE/VERSION DETECTION:
-sV: Probe open ports to determine service/version info 版本探測 -A一起探測
--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 <msec>: Parallel host scan group sizes
--min-parallelism/max-parallelism <msec>: Probe parallelization
--min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout <msec>: Specifies
probe round trip time.
--host-timeout <msec>: Give up on target after this long
--scan-delay/--max-scan-delay <msec>: Adjust delay between probes
FIREWALL/IDS EVASION AND SPOOFING:
-f; --mtu <val>: fragment packets (optionally w/given MTU)
-D <decoy1,decoy2[,ME],...>: Cloak a scan with decoys
-S <IP_Address>: Spoof source address
-e <iface>: Use specified interface
-g/--source-port <portnum>: Use given port number
--data-length <num>: Append random data to sent packets
--ttl <val>: Set IP time-to-live field
--spoof-mac <mac address, prefix, or vendor name>: Spoof your MAC address
OUTPUT: 輸出
-oN/-oX/-oS/-oG <file>: Output scan results in normal, XML, s|<rIpt kIddi3,
and Grepable format, respectively, to the given filename.
-oA <basename>: 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)
--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
--no-stylesheet: Prevent Nmap from associating XSL stylesheet w/XML output
MISC:
-6: Enable IPv6 scanning 啟用ipv6掃描
-A: Enables OS detection and Version detection 版本和系統掃描
--datadir <dirname>: 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.
具體的說明都在
https://nmap.org/book/man.html
中文版本:https://nmap.org/man/zh/
實例
1.nmap 192.168.123.1-4 --exclude 192.168.123.3
掃描192.168.123.1-4內除了192.168.123.3的主機
2.nmap -v www.seu.edu.cn
掃描www.seu.edu.cn所有打開的TCP端口
3.nmap -sS -O www.seu.edu.cn/24
不連接的TCP端口掃面,並分析系統