Nmap如何快速上手

Nmap如何快速上手,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。

創(chuàng)新互聯(lián)公司是一家專注于網(wǎng)站設(shè)計(jì)、成都網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),柘榮網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:柘榮等地區(qū)。柘榮做網(wǎng)站價(jià)格咨詢:13518219792

1.安裝

https://nmap.org/,不做過(guò)多贅述

2.靶機(jī)搭建

本文使用靶機(jī)為OWASP Broken Web Applications Project

https://sourceforge.net/projects/owaspbwa/

靶機(jī)地址1:192.168.154.128

靶機(jī)地址2:192.168.3.7

3.命令行

C:\Users\Torjan>nmap --helpNmap 7.80 ( https://nmap.org )Usage: nmap [Scan Type(s)] [Options] {target specification}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: Input from list of hosts/networks,"從文件中導(dǎo)入目標(biāo)主機(jī)或目標(biāo)網(wǎng)段"-iR: Choose random targets,"隨機(jī)選擇目標(biāo)主機(jī)"--exclude: Exclude hosts/networks,"后面跟的主機(jī)或網(wǎng)段將不在掃描范圍內(nèi)"--excludefile: Exclude list from file,"后面跟的文件中的主機(jī)或網(wǎng)段將不在掃描范圍內(nèi)HOST DISCOVERY:["主機(jī)發(fā)現(xiàn)"]-sL:List Scan,"List Scan(列表掃描),僅列舉指定目標(biāo)的IP,不進(jìn)行主機(jī)發(fā)現(xiàn)"-sn: Ping Scan - disable port scan,"Ping Scan,只進(jìn)行主機(jī)發(fā)現(xiàn),不進(jìn)行端口掃描" -Pn: Treat all hosts as online -- skip host discovery,"將所有指定的主機(jī)視作已開(kāi)啟,跳過(guò)主機(jī)發(fā)現(xiàn)的過(guò)程。"-PS/PA/PU/PY[portlist]: TCP SYN/ACK, UDP or SCTP discovery to given ports,"使用 TCP SYN/ACk或SCTP INIT/ECHO方式來(lái)發(fā)現(xiàn)。"-PE/PP/PM: ICMP echo, timestamp, and netmask request discovery probes,"使用 ICMP echo、 timestamp、 netmask請(qǐng)求包發(fā)現(xiàn)主機(jī)"-PO[protocol list]: IP Protocol Ping,"使用IP協(xié)議包探測(cè)對(duì)方主機(jī)是否開(kāi)啟。"-n/-R: Never do DNS resolution/Always resolve [default: sometimes],"-n表示不進(jìn)行DNS解析;-R表示總是進(jìn)行DNS解析。"--dns-servers: Specify custom DNS servers,"指定DNS服務(wù)器。"--system-dns: Use OS s DNS resolver,"指定使用系統(tǒng)的DNS服務(wù)器。"--traceroute: Trace hop path to each host,"追蹤每個(gè)路由節(jié)點(diǎn)。SCAN TECHNIQUES:["掃描參數(shù)"]-sS/sT/sA/sW/sM: TCP SYN/Connect()/ACK/Window/Maimon scans,"指定使用 TCP SYN/Connect()/Ack/Window/Maimon scans的方式對(duì)目標(biāo)主機(jī)進(jìn)行掃描。"-sU: UDP Scan,"指定使用UDP掃描的方式確定目標(biāo)主機(jī)的UDP端口狀況。"-sN/sF/sX: TCP Null, FIN, and Xmas scans,"指定使用 TCP Null/FiN/Xmas scans秘密掃描的方式協(xié)助探測(cè)對(duì)方的TCP端口狀態(tài)。"--scanflags: Customize TCP scan flags,"定制TCP包的flags"-sI: Idle scan,"指定使用 Idle scan的方式掃描目標(biāo)主機(jī)(前提是需要找到合適的僵尸主機(jī)zombie host)。"-sY/sZ: SCTP INIT/COOKIE-ECHO scans,"使用 SCTP INIT/COOKIE-ECHO掃描SCTP協(xié)議端口的開(kāi)放情況"-sO: IP protocol scan,"使用 IP protocol掃描確定目標(biāo)機(jī)支持的協(xié)議類型。"-b: FTP bounce scan,"使用 FTP bounce scan掃描方式。PORT SPECIFICATION AND SCAN ORDER:["端口掃描參數(shù)和順序"]-p: Only scan specified ports,":掃描指定的端口"Ex("例如"): -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9--exclude-ports: Exclude the specified ports from scanning,"不掃描的端口"-F: Fast mode - Scan fewer ports than the default scan,"(快速模式),僅掃描TOP100的端口"-r: Scan ports consecutively - dont randomize,"不進(jìn)行端口隨機(jī)打亂的操作(如無(wú)該參數(shù),Nmap會(huì)將要掃描的端口以隨機(jī)順序的方式進(jìn)行掃描,讓Nmap的掃描不易被對(duì)方防火墻檢測(cè)到),即順序掃描。"--top-ports: Scanmost common ports,"掃描開(kāi)放概率最高的 number個(gè)端口(Nmap的作者曾做過(guò)大規(guī)模的互聯(lián)網(wǎng)掃描,以此統(tǒng)計(jì)網(wǎng)絡(luò)上各種端口可能開(kāi)放的概率,并排列出最有可能開(kāi)放端口的列表,具體可以參見(jiàn)nmap- -services文件。默認(rèn)情況下,Nmap會(huì)掃描最有可能的1000個(gè)TCP端口)。"--port-ratio: Scan ports more common than,"掃描指定頻率以上的端口。與上述top-ports類似,這里以概率作為參數(shù),概率大于port--ratio的端口才被掃描。顯然參數(shù)必須在0~1之間,想了解具體的概率范圍可以查看nmap- -services文件。SERVICE/VERSION DETECTION:["版本探測(cè)"]-sV: Probe open ports to determine service/version info,"指定讓Nmap進(jìn)行版本偵測(cè)。"--version-intensity: Set from 0 (light) to 9 (try all probes),"指定版本偵測(cè)的強(qiáng)度(0~9),默認(rèn)為7。數(shù)值越高,探測(cè)出的服務(wù)越準(zhǔn)確,但是運(yùn)行時(shí)間會(huì)比較長(zhǎng)。"--version-light: Limit to most likely probes (intensity 2),"指使用輕量級(jí)偵測(cè)方式(intensity2)"--version-all: Try every single probe (intensity 9),"嘗試使用所有的 probes進(jìn)行偵測(cè)( intensity9)。"--version-trace: Show detailed version scan activity (for debugging),"顯示出詳細(xì)的版本偵測(cè)過(guò)程信息。SCRIPT SCAN:["掃描腳本"]-sC/--script=default: "使用默認(rèn)的腳本進(jìn)行掃描。"--script=:is a comma separated list of,"使用某個(gè)腳本進(jìn)行掃描。"directories, script-files or script-categories--script-args=: provide arguments to scripts,"該參數(shù)用于傳遞腳本里的參數(shù)key是參數(shù)名,該參數(shù)對(duì)應(yīng)valuel這個(gè)值。如有更多的參數(shù),使用逗號(hào)連接。"--script-args-file=filename: provide NSE script args in a file,"使用文件為腳本提供參數(shù)。"--script-trace: Show all data sent and received,"如設(shè)置該參數(shù),則顯示腳本執(zhí)行過(guò)程中發(fā)送與接收的數(shù)據(jù)。"--script-updatedb: Update the script database."在Nmap 的scripts目錄里有一個(gè)db文件,該文件保存了當(dāng)前Nmap可用的腳本,類似于一個(gè)小型數(shù)據(jù)庫(kù),如果我們開(kāi)啟Nmap并調(diào)用了此參數(shù),則Nmap會(huì)自行掃描scripts掃描目錄中的擴(kuò)展腳本,進(jìn)行數(shù)據(jù)庫(kù)更新"--script-help=: Show help about scripts."查看掃描腳本幫助文檔"is a comma-separated list of script-files orscript-categoriesOS DETECTION:["系統(tǒng)探測(cè)"]-O: Enable OS detection,"系統(tǒng)探測(cè)"--osscan-limit: Limit OS detection to promising targets,"只對(duì)滿足“同時(shí)具備狀態(tài)為Open和closed的端口”的主機(jī)進(jìn)行操作系統(tǒng)探測(cè)"--osscan-guess: Guess OS more aggressively,"猜測(cè)最有可能的系統(tǒng)版本TIMING AND PERFORMANCE:["時(shí)間與性能"]Options which takeare in seconds, or append 'ms' (milliseconds),'s' (seconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m)."時(shí)間單位說(shuō)明"-T<0-5>: Set timing template (higher is faster),"時(shí)間掃描級(jí)別,數(shù)字越高越快"--min-hostgroup/max-hostgroup: Parallel host scan group sizes,"指定并行掃描的主機(jī)數(shù)量,每次最大或者最小掃描多少個(gè)主機(jī)"--min-parallelism/max-parallelism: Probe parallelization--min-rtt-timeout/max-rtt-timeout/initial-rtt-timeout: Specifiesprobe round trip time.--max-retries: Caps number of port scan probe retransmissions."最大的探測(cè)次數(shù)"--host-timeout: Give up on target after this long,"超時(shí)時(shí)間"--scan-delay/--max-scan-delay: Adjust delay between probes,"掃描探測(cè)的延時(shí)時(shí)間/間隔時(shí)間"--min-rate: Send packets no slower thanper second,"每秒發(fā)包不少于number"--max-rate: Send packets no faster thanper second,"每秒發(fā)包不多于numberFIREWALL/IDS EVASION AND SPOOFING:["防火墻/IDS繞過(guò)和欺騙"]-f; --mtu: fragment packets (optionally w/given MTU),"分片"-D: Cloak a scan with decoys,"偽造源地址,但并不是正真的源地址,而是增加一些噪聲源,用以迷惑目標(biāo)ip,增加對(duì)方的分析難度。"-S: Spoof source address,"源地址偽造"-e: Use specified interface,"使用特殊接口"-g/--source-port: Use given port number,"使用指定源端口"--proxies: Relay connections through HTTP/SOCKS4 proxies,"代理"--data: Append a custom payload to sent packets,"添加自定義數(shù)據(jù)字段,但字段必須是16進(jìn)制"--data-string: Append a custom ASCII string to sent packets,"添加ASCII碼發(fā)送數(shù)據(jù)"--data-length: Append random data to sent packets,"數(shù)據(jù)長(zhǎng)度"--ip-options: Send packets with specified ip options,"特殊IP選項(xiàng)"--ttl: Set IP time-to-live field,"設(shè)置IP存活時(shí)間"--spoof-mac: Spoof your MAC address,"MAC欺騙"--badsum: Send packets with a bogus TCP/UDP/SCTP checksumOUTPUT:,"差錯(cuò)校驗(yàn)"-oN/-oX/-oS/-oG: Output scan in normal, XML, s|<rIpt kIddi3,and Grepable format, respectively, to the given filename."指定格式輸出文檔"-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)--reason: Display the reason a port is in a particular state--open: Only show open (or possibly open) ports,"僅展示開(kāi)放端口"--packet-trace: Show all packets sent and received,"探測(cè)時(shí)展現(xiàn)發(fā)送和接收包過(guò)程"--iflist: Print host interfaces and routes (for debugging),"debug時(shí)展現(xiàn)主機(jī)端口和路由"--append-output: Append to rather than clobber specified output files--resume: Resume an aborted scan--stylesheet: 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 outputMISC:["其他"]-6: Enable IPv6 scanning,"IPv6"-A: Enable OS detection, version detection, script scanning, and traceroute--datadir: 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,"Nmap版本"-h: Print this help summary page."Nmap幫助"EXAMPLES:nmap -v -A scanme.nmap.orgnmap -v -sn 192.168.0.0/16 10.0.0.0/8nmap -v -iR 10000 -Pn -p 80SEE THE MAN PAGE (https://nmap.org/book/man.html) FOR MORE OPTIONS AND EXAMPLES

4.初級(jí)快速使用

靶機(jī)1IP:192.168.154.128

靶機(jī)2IP:192.168.3.7

4.1掃描單個(gè)目標(biāo) 

nmap 192.168.154.128

Nmap如何快速上手

4.2掃描多個(gè)目標(biāo)

nmap 192.168.154.128 192.168.3.7

Nmap如何快速上手

nmap 192.168.3.1-10 192.168.154.100-130

Nmap如何快速上手

4.3掃描除某個(gè)目標(biāo)之外的目標(biāo)

targets.txt:
192.168.3.1
192.168.3.5
192.168.3.7
192.168.154.128

使用方法:

nmap 192.168.3.1/28 -exclude 192.168.3.7

Nmap如何快速上手

nmap 192.168.154.128 -excludefile targets.txt

Nmap如何快速上手

4.4掃描指定文件內(nèi)的目標(biāo)

由于要讀取文件,可能根據(jù)文件存放路徑不同需要管理員權(quán)限

nmap -iL targets.txt

Nmap如何快速上手

4.5掃描指定端口

nmap 192.168.154.128 -p 21,22,23,80,443,3306

Nmap如何快速上手

4.6掃描端口開(kāi)放與服務(wù)版本情況

nmap -sV 192.168.154.128

Nmap如何快速上手

4.7路由跟蹤

nmap --traceroute 192.168.154.128

Nmap如何快速上手

4.8主機(jī)存活情況

nmap -sP 192.168.3.0/24 192.168.154.0/24 -T5

Nmap如何快速上手

4.9OS版本探測(cè)

nmap -O 192.168.154.128

Nmap如何快速上手

4.10防火墻狀態(tài)

nmap -sF -T5 192.168.154.128

Nmap如何快速上手

狀態(tài)識(shí)別

狀態(tài)

含義

open

端口處于開(kāi)放狀態(tài),表示應(yīng)用程序正在監(jiān)聽(tīng)該端口的連接,外部可以訪問(wèn)

filtered

被過(guò)濾,表示端口被防火墻或其他安全設(shè)備阻止,不能訪問(wèn)

closed

關(guān)閉,表示目標(biāo)主機(jī)未開(kāi)放該端口

unfiltered

未被過(guò)濾的,表示Nmap無(wú)法確認(rèn)該端口所處狀態(tài),需進(jìn)一步探測(cè)

open/filtered

開(kāi)放的或被過(guò)濾的,Nmap不能識(shí)別

closed/filtered

關(guān)閉的或被過(guò)濾的,Nmap不能識(shí)別

5.進(jìn)階使用

Nmap腳本默認(rèn)存放在/xx/nmap/scripts

Nmap如何快速上手

5.1Nmap腳本分類

auth: 負(fù)責(zé)處理鑒權(quán)證書(shū)(繞開(kāi)鑒權(quán))的腳本 broadcast: 在局域網(wǎng)內(nèi)探查更多服務(wù)開(kāi)啟狀況,如dhcp/dns/sqlserver等服務(wù)   brute: 提供暴力破解方式,針對(duì)常見(jiàn)的應(yīng)用如http/snmp等 default: 使用-sC或-A選項(xiàng)掃描時(shí)候默認(rèn)的腳本,提供基本腳本掃描能力 discovery: 對(duì)網(wǎng)絡(luò)進(jìn)行更多的信息,如SMB枚舉、SNMP查詢等 dos: 用于進(jìn)行拒絕服務(wù)攻擊 exploit: 利用已知的漏洞入侵系統(tǒng) external: 利用第三方的數(shù)據(jù)庫(kù)或資源,例如進(jìn)行whois解析 fuzzer: 模糊測(cè)試的腳本,發(fā)送異常的包到目標(biāo)機(jī),探測(cè)出潛在漏 intrusive:入侵性的腳本,此類腳本可能引發(fā)對(duì)方的IDS/IPS的記錄或屏蔽 malware: 探測(cè)目標(biāo)機(jī)是否感染了病毒、開(kāi)啟了后門等信息 safe: 此類與intrusive相反,屬于安全性腳本 version: 負(fù)責(zé)增強(qiáng)服務(wù)與版本掃描(Version Detection)功能的腳本 vuln: 負(fù)責(zé)檢查目標(biāo)機(jī)是否有常見(jiàn)的漏洞(Vulnerability),如是否有MS08_067

常用腳本使用語(yǔ)法:

SCRIPT SCAN:["掃描腳本"]  -sC/--script=default: "使用默認(rèn)的腳本進(jìn)行掃描。"  --script=:is a comma separated list of,"使用某個(gè)腳本進(jìn)行掃描。"           directories, script-files or script-categories  --script-args=: provide arguments to scripts,"該參數(shù)用于傳遞腳本里的參數(shù)key是參數(shù)名,該參數(shù)對(duì)應(yīng)valuel這個(gè)值。如有更多的參數(shù),使用逗號(hào)連接。"  --script-args-file=filename: provide NSE script args in a file,"使用文件為腳本提供參數(shù)。"  --script-trace: Show all data sent and received,"如設(shè)置該參數(shù),則顯示腳本執(zhí)行過(guò)程中發(fā)送與接收的數(shù)據(jù)。"  --script-updatedb: Update the script database."在Nmap 的scripts目錄里有一個(gè)db文件,該文件保存了當(dāng)前Nmap可用的腳本,類似于一個(gè)小型數(shù)據(jù)庫(kù),如果我們開(kāi)啟Nmap并調(diào)用了此參數(shù),則Nmap會(huì)自行掃描scripts掃描目錄中的擴(kuò)展腳本,進(jìn)行數(shù)據(jù)庫(kù)更新"  --script-help=: Show help about scripts."查看掃描腳本幫助文檔"           is a comma-separated list of script-files or           script-categories.

更多關(guān)于腳本使用參見(jiàn)本文命令行部分。

5.2鑒權(quán)掃描

nmap --script=auth 192.168.154.128

Nmap如何快速上手

5.3暴力破解

nmap --script=brute 192.168.154.128

Nmap如何快速上手

5.4漏洞掃描

一般進(jìn)行默認(rèn)掃描配置就行。

nmap --script=vuln 192.168.154.128

Nmap如何快速上手

5.4.1漏洞來(lái)源

 nmap-vulners:https://github.com/vulnersCom/nmap-vulners[默認(rèn)已有]

1.更改為Nmap腳本目錄:

cd /usr/share/nmap/scripts/

2.直接下載nmap-vulners腳本內(nèi)容復(fù)制到scripts路徑下

3.更新漏洞數(shù)據(jù)庫(kù):

nmap --script-updatedb

4.進(jìn)行掃描

nmap --script nmap-vulners -sV -p 80 192.168.154.128

注:該-sV是絕對(duì)必要的。使用-sV,告訴Nmap探測(cè)版本信息的目標(biāo)地址。如果Nmap不生成版本信息,則nmap-vulners將沒(méi)有任何數(shù)據(jù)來(lái)查詢Vulners數(shù)據(jù)庫(kù)。使用這些NSE腳本時(shí)始終使用-sV。

Vulscan:https://github.com/scipag/vulscan.git

1.將GitHub存儲(chǔ)庫(kù)克隆到Nmap腳本目錄中:git clone

https://github.com/scipag/vulscan.git

Vulscan支持許多優(yōu)秀的漏洞利用數(shù)據(jù)庫(kù):

 scipvuldb.csv cve.csv osvdb.csv securityfocus.csv securitytracker.csv xforce.csv expliotdb.csv openvas.csv

2.更新漏洞庫(kù):

Nmap如何快速上手

3.使用vulscan進(jìn)行掃描

nmap -sV --script=vulscan/vulscan.nse www.example.com

4.vulscan漏洞庫(kù)更新[Linux]

為確保數(shù)據(jù)庫(kù)完全是最新的,可使用vulscan / utilities / updater /目錄中的updateFiles.sh腳本進(jìn)行更新。

(1)通過(guò)在終端中鍵入命令,切換到updater目錄:

cd vulscan/utilities/updater/

(2)chmod命令確保該文件具有執(zhí)行的適當(dāng)權(quán)限:chmod +x updateFiles.sh

(3)終端中輸入命令來(lái)執(zhí)行和運(yùn)行腳本:./updateFiles.sh

(4)完成更新

5.vulscan漏洞庫(kù)更新[windows]

(1)下載漏洞庫(kù)文件

?https://www.computec.ch/projekte/vulscan/download/cve.csv?https://www.computec.ch/projekte/vulscan/download/exploitdb.csv?https://www.computec.ch/projekte/vulscan/download/openvas.csv?https://www.computec.ch/projekte/vulscan/download/osvdb.csv?https://www.computec.ch/projekte/vulscan/download/scipvuldb.csv?https://www.computec.ch/projekte/vulscan/download/securityfocus.csv?https://www.computec.ch/projekte/vulscan/download/securitytracker.csv?https://www.computec.ch/projekte/vulscan/download/xforce.csv

(2)復(fù)制到scripts路徑下

/scripts/

(3)使用時(shí)調(diào)用漏洞庫(kù)

--script-args vulscandb=your_own_database

5.5應(yīng)用服務(wù)掃描

不是很好用

nmap --script=realvnc-auth-bypass 192.168.154.128

Nmap如何快速上手

5.6局域網(wǎng)服務(wù)探測(cè)

用于探測(cè)網(wǎng)卡和開(kāi)放服務(wù)

nmap -n -p 443 --script=broadcast 192.168.154.128

Nmap如何快速上手

5.7Whois解析

利用第三方數(shù)據(jù)庫(kù)進(jìn)行whois解析,并不是完全準(zhǔn)確

nmap -script external baidu.com

Nmap如何快速上手

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)的支持。

網(wǎng)站標(biāo)題:Nmap如何快速上手
本文網(wǎng)址:http://bm7419.com/article30/pscipo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、標(biāo)簽優(yōu)化、做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)公司、搜索引擎優(yōu)化企業(yè)網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)