端口掃描之nmap命令


nmap

Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254
TARGET SPECIFICATION:
  Can pass hostnames, IP addresses, networks, etc.
  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
  --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
  --excludefile <exclude_file>: Exclude list from file
HOST DISCOVERY:
  -sL: List Scan - simply list targets to scan
  -sn: Ping Scan - disable port scan
  -Pn: Treat all hosts as online -- skip host discovery
  -PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports
  -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
SCAN TECHNIQUES:
  -sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans
  -sU: UDP Scan
  -sN/sF/sX: TCP Null, FIN, and Xmas scans
  --scanflags <flags>: Customize TCP scan flags
  -sI <zombie host[:probeport]>: Idle scan
  -sY/sZ: SCTP INIT/COOKIE-ECHO scans
  -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,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:
  -sV: Probe open ports to determine service/version info
  --version-intensity <level>: Set from 0 (light) to 9 (try all probes)
  --version-light: Limit to most likely probes (intensity 2)
  --version-all: Try every single probe (intensity 9)
  --version-trace: Show detailed version scan activity (for debugging)
SCRIPT SCAN:
  -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:
  -O: Enable OS detection
  --osscan-limit: Limit OS detection to promising targets
  --osscan-guess: Guess OS more aggressively
TIMING AND PERFORMANCE:
  Options which take <time> 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)
  --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:
  -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
  --proxies <url1,[url2],...>: Relay connections through HTTP/SOCKS4 proxies
  --data <hex string>: Append a custom payload to sent packets
  --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:
  -oN/-oX/-oS/-oG <file>: Output scan 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 -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.
EXAMPLES:
  nmap -v -A scanme.nmap.org
  nmap -v -sn 192.168.0.0/16 10.0.0.0/8
  nmap -v -iR 10000 -Pn -p 80

-sT	         TCP connect()掃描,這種方式會在目標主機的日志中記錄大批連接請求和錯誤信息。
-sS	         半開掃描,很少有系統能把它記入系統日志。不過,需要Root權限。
-sF  -sN	 秘密FIN數據包掃描、Xmas Tree、Null掃描模式
-sP	         ping掃描,Nmap在掃描端口時,默認都會使用ping掃描,只有主機存活,Nmap才會繼續掃描。
-sU	         UDP掃描,但UDP掃描是不可靠的
-sA	         這項高級的掃描方法通常用來穿過防火牆的規則集
-sV	         探測端口服務版本
-Pn	         掃描之前不需要用ping命令,有些防火牆禁止ping命令。可以使用此選項進行掃描
-v	         顯示掃描過程,推薦使用
-h	         幫助選項,是最清楚的幫助文檔
-p	         指定端口,如“1-65535、1433、135、22、80”等
-O	         啟用遠程操作系統檢測,存在誤報
-A	         全面系統檢測、啟用腳本檢測、掃描等
-oN/-oX/-oG	 將報告寫入文件,分別是正常、XML、grepable 三種格式
-T4	         針對TCP端口禁止動態掃描延遲超過10ms
-iL	         讀取主機列表,例如,“-iL C  \ip.txt”
 
-iflist      查看本地主機的接口信息和路由信息
-A           選項用於使用進攻性方式掃描
-T4          指定掃描過程使用的時序,總有6個級別(0-5),級別越高,掃描速度越快,但也容易被防火牆或IDS檢測並屏蔽掉,在網絡通訊狀況較好的情況下推薦使用T4
-oX test.xml 將掃描結果生成 test.xml 文件,如果中斷,則結果打不開
-oA test.xml 將掃描結果生成 test.xml 文件,中斷后,結果也可保存
-oG test.txt 將掃描結果生成 test.txt 文件
-sn    只進行主機發現,不進行端口掃描
-O    指定Nmap進行系統版本掃描
-sV   指定讓Nmap進行服務版本掃描
-p <port ranges>   掃描指定的端口
-sS/sT/sA/sW/sM  指定使用 TCP SYN/Connect()/ACK/Window/Maimon scans的方式來對目標主機進行掃描
-sU   指定使用UDP掃描方式確定目標主機的UDP端口狀況
-script <script name>    指定掃描腳本
-Pn             不進行ping掃描
-sP     用ping掃描判斷主機是否存活,只有主機存活,nmap才會繼續掃描,一般最好不加,因為有的主機會禁止ping
-PI     設置這個選項,讓nmap使用真正的ping(ICMP echo請求)來掃描目標主機是否正在運行。
-iL 1.txt    批量掃描1.txt中的目標地址
 
-sL   List Scan 列表掃描,僅將指定的目標的IP列舉出來,不進行主機發現
-sY/sZ   使用SCTP INIT/COOKIE-ECHO來掃描SCTP協議端口的開放的情況
-sO   使用IP protocol 掃描確定目標機支持的協議類型
-PO    使用IP協議包探測對方主機是否開啟 
-PE/PP/PM    使用ICMP echo、 ICMP timestamp、ICMP netmask 請求包發現主機
-PS/PA/PU/PY    使用TCP SYN/TCP ACK或SCTP INIT/ECHO方式進行發現
 
-sN/sF/sX   指定使用TCP Null, FIN, and Xmas scans秘密掃描方式來協助探測對方的TCP端口狀態
-e eth0           指定使用eth0網卡進行探測
-f    --mtu <val>   指定使用分片、指定數據包的 MTU.
-b <FTP relay host>   使用FTP bounce scan掃描方式
-g            指定發送的端口號
-r   不進行端口隨機打亂的操作(如無該參數,nmap會將要掃描的端口以隨機順序方式掃描,以讓nmap的掃描不易被對方防火牆檢測到)
-v 表示顯示冗余信息,在掃描過程中顯示掃描的細節,從而讓用戶了解當前的掃描狀態
-n    表示不進行DNS解析;
-D  <decoy1,decoy2[,ME],...>   用一組 IP 地址掩蓋真實地址,其中 ME 填入自己的 IP 地址
-R            表示總是進行DNS解析。 
-F    快速模式,僅掃描TOP 100的端口 
-S <IP_Address>   偽裝成其他 IP 地址
--ttl <val>   設置 time-to-live 時間
--badsum   使用錯誤的 checksum 來發送數據包(正常情況下,該類數據包被拋棄,如果收到回復,說明回復來自防火牆或 IDS/IPS)
--dns-servers     指定DNS服務器
--system-dns    指定使用系統的DNS服務器   
--traceroute    追蹤每個路由節點 
--scanflags <flags>   定制TCP包的flags
--top-ports <number>   掃描開放概率最高的number個端口
--port-ratio <ratio>   掃描指定頻率以上的端口。與上述--top-ports類似,這里以概率作為參數
--version-trace   顯示出詳細的版本偵測過程信息
--osscan-limit   限制Nmap只對確定的主機的進行OS探測(至少需確知該主機分別有一個open和closed的端口)
--osscan-guess   大膽猜測對方的主機的系統類型。由此准確性會下降不少,但會盡可能多為用戶提供潛在的操作系統
--data-length <num>   填充隨機數據讓數據包長度達到 Num
--ip-options <options>   使用指定的 IP 選項來發送數據包
--spoof-mac <mac address/prefix/vendor name>    偽裝 MAC 地址
--version-intensity <level>   指定版本偵測強度(0-9),默認為7。數值越高,探測出的服務越准確,但是運行時間會比較長。
--version-light   指定使用輕量偵測方式 (intensity 2)
--version-all   嘗試使用所有的probes進行偵測 (intensity 9)
--version-trace   顯示出詳細的版本偵測過程信息


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM