nmap常用命令及參數(shù)說明
發(fā)布時(shí)間:2012-06-17 23:44:03 作者:佚名
我要評(píng)論

nmap是一個(gè)網(wǎng)絡(luò)探測(cè)和安全掃描程序,系統(tǒng)管理者和個(gè)人可以使用這個(gè)軟件掃描大型的網(wǎng)絡(luò),獲取被掃描主機(jī)正在運(yùn)行以及提供什么服務(wù)等信息
nmap是一個(gè)網(wǎng)絡(luò)探測(cè)和安全掃描程序,系統(tǒng)管理者和個(gè)人可以使用這個(gè)軟件掃描大型的網(wǎng)絡(luò),獲取被掃描主機(jī)正在運(yùn)行以及提供什么服務(wù)等信息。 nmap支持很多掃描技術(shù),例如:UDP、TCP connect()、TCP SYN(半開掃描)、ftp代理(bounce攻擊)、反向標(biāo)志、ICMP、FIN、ACK掃描、圣誕樹(Xmas Tree)、SYN掃描和null掃描。從掃描類型一節(jié)可以得到細(xì)節(jié)。nmap還提供了一些高級(jí)的特征,例如:通過TCP/IP協(xié)議棧特征探測(cè)操作系統(tǒng)類型,秘密掃描,動(dòng)態(tài)延時(shí)和重傳計(jì)算,并行掃描,通過并行ping掃描探測(cè)關(guān)閉的主機(jī),誘餌掃描,避開端口過濾檢測(cè),直接RPC掃描(無須端口影射),碎片掃描,以及靈活的目標(biāo)和端口設(shè)定。本文詳細(xì)介紹了NMap的詳細(xì)使用選項(xiàng),并給出了幾個(gè)實(shí)用實(shí)例,nmap是入侵和網(wǎng)絡(luò)安全檢測(cè)的必備工具。
nmap
BT5(BackTrack--Information Gathering--Network Analysis--Network Scanners-nmap)
-sP 滲透內(nèi)網(wǎng)之后判斷當(dāng)前網(wǎng)絡(luò)那些主機(jī)在線
nmap -sP 192.168.1/255
-vv 現(xiàn)實(shí)詳細(xì)的掃描過程
-sS 使用SYN半開式掃描,這種掃描方式使得掃描結(jié)果更加正確(又稱半開放,或
隱身掃描)
nmap -vv -sS IP
-O 大寫O代表OS 判斷主機(jī)操作系統(tǒng)
nmap -O IP
延時(shí)策略
-T(0-5) 默認(rèn)為3
0 即Paranoid模式。為了避開IDS的檢測(cè)使掃描速度極慢,nmap串所有的掃描,
每隔至少5分鐘發(fā)送一個(gè)包
1 即Sneaky模式。也差不多,只是數(shù)據(jù)包的發(fā)送間隔是15秒
2 即Polite模式。不增加太大的網(wǎng)絡(luò)負(fù)載,串行每個(gè)探測(cè),并使每個(gè)探測(cè)間隔
0.4秒
3 即Normal模式。nmap的默認(rèn)選項(xiàng),在不使網(wǎng)絡(luò)過載或者主機(jī)/端口丟失的情況
下盡可能快速地掃描
4 即Aggressive模式。設(shè)置5分鐘的超時(shí)限制,對(duì)每臺(tái)主機(jī)的掃描時(shí)間不超過5分
鐘,并且對(duì)每次探測(cè)回應(yīng)的等待時(shí)間不超過1.5秒。
5 即lnsane模式。只適合快速的網(wǎng)絡(luò)或者不在意丟失默些信息,每臺(tái)主機(jī)的超時(shí)
限制為75秒,對(duì)每次探測(cè)只等待0.3秒。
nmap -sS -T1 IP
-sV 探測(cè)端口的服務(wù)類型/具體版本等信息
nmap -vv -sV IP
-p 端口號(hào) 對(duì)某個(gè)端口的服務(wù)版本進(jìn)行詳細(xì)探測(cè) 有助于升入的針對(duì)性攻擊,
比如緩沖溢出攻擊
nmap -vv -sV IP -p 21
適用于內(nèi)外網(wǎng)的探測(cè),以內(nèi)網(wǎng)操作為示例(外網(wǎng)參數(shù)同)
簡(jiǎn)單端口掃描: nmap -vv -sT(sS、sF、sU、sA) 192.168.0.1 -D 127.0.0.1
(-D偽造的地址)
OS檢測(cè): nmap -vv -sS -O 192.168.0.1
RPC鑒別: nmap -sS -sR 192.168.0.1 Linux上的portmap就是一個(gè)簡(jiǎn)單的RPC服
務(wù),監(jiān)聽端口為111(默認(rèn))
Ping掃射:nmap -sP 172.16.15.0/24
十條常用nmap命令行格式
1)獲取遠(yuǎn)程主機(jī)的系統(tǒng)類型及開放端口
Get info about remote host ports and OS detection
nmap -sS -P0 -sV -O <target>
這里的 < target > 可以是單一 IP, 或主機(jī)名,或域名,或子網(wǎng)
-sS TCP SYN 掃描 (又稱半開放,或隱身掃描)
-P0 允許你關(guān)閉 ICMP pings.
-sV 打開系統(tǒng)版本檢測(cè)
-O 嘗試識(shí)別遠(yuǎn)程操作系統(tǒng)
-sS TCP SYN scanning (also known as half-open, or stealth scanning)
-P0 option allows you to switch off ICMP pings.
-sV option enables version detection
-O flag attempt to identify the remote operating system
Other option:
-A 同時(shí)啟用操作系統(tǒng)指紋識(shí)別和版本檢測(cè)
-A option enables both OS fingerprinting and version detection
-v use -v twice for more verbosity.
nmap -sS -P0 -A -v < target >
2)列出開放了指定端口的主機(jī)列表
Get list of servers with a specific port open
nmap -sT -p 80 -oG – 192.168.1.* | grep open
Change the -p argument for the port number. See “man nmap” for
different ways to specify address ranges.
3)在網(wǎng)絡(luò)尋找所有在線主機(jī)
Find all active IP addresses in a network
nmap -sP 192.168.0.*
或者也可用以下命令:
nmap -sP 192.168.0.0/24
指定 subnet
4)Ping 指定范圍內(nèi)的 IP 地址
Ping a range of IP addresses
nmap -sP 192.168.1.100-254
nmap accepts a wide variety of addressing notation, multiple
targets/ranges, etc.
5)在某段子網(wǎng)上查找未占用的 IP
Find unused IPs on a given subnet
nmap -T4 -sP 192.168.2.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
6)在局域網(wǎng)上掃找 Conficker 蠕蟲病毒
Scan for the Conficker virus on your LAN ect.
nmap -PN -T4 -p139,445 -n -v –script=smb-check-vulns –script-args
safe=1 192.168.0.1-254
replace 192.168.0.1-256 with the IP’s you want to check.
7)掃描網(wǎng)絡(luò)上的惡意接入點(diǎn) rogue APs.
Scan Network for Rogue APs.
nmap -A -p1-85,113,443,8080-8100 -T4 –min-hostgroup 50 –max-rtt-
timeout 2000 –initial-rtt-timeout 300 –max-retries 3 –host-timeout
20m –max-scan-delay 1000 -oA wapscan 10.0.0.0/8
I’ve used this scan to successfully find many rogue APs on a very,
very large network.
8)使用誘餌掃描方法來掃描主機(jī)端口
Use a decoy while scanning ports to avoid getting caught by the sys
admin
sudo nmap -sS 192.168.0.10 -D 192.168.0.2
Scan for open ports on the target device/computer (192.168.0.10) while
setting up a decoy address (192.168.0.2). This will show the decoy ip
address instead of your ip in targets security logs. Decoy address
needs to be alive. Check the targets security log at /var/log/secure
to make sure it worked.
9)為一個(gè)子網(wǎng)列出反向 DNS 記錄
List of reverse DNS records for a subnet
nmap -R -sL 209.85.229.99/27 | awk '{if($3=="not")print"("$2") no
PTR";else print$3" is "$2}' | grep '('
10)顯示網(wǎng)絡(luò)上共有多少臺(tái) Linux 及 Win 設(shè)備?
How Many Linux And Windows Devices Are On Your Network?
sudo nmap -F -O 192.168.1.1-255 | grep "Running: " > /tmp/os; echo
"$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo "$(cat
/tmp/os | grep Windows | wc -l) Window(s) devices"
nmap
BT5(BackTrack--Information Gathering--Network Analysis--Network Scanners-nmap)
-sP 滲透內(nèi)網(wǎng)之后判斷當(dāng)前網(wǎng)絡(luò)那些主機(jī)在線
nmap -sP 192.168.1/255
-vv 現(xiàn)實(shí)詳細(xì)的掃描過程
-sS 使用SYN半開式掃描,這種掃描方式使得掃描結(jié)果更加正確(又稱半開放,或
隱身掃描)
nmap -vv -sS IP
-O 大寫O代表OS 判斷主機(jī)操作系統(tǒng)
nmap -O IP
延時(shí)策略
-T(0-5) 默認(rèn)為3
0 即Paranoid模式。為了避開IDS的檢測(cè)使掃描速度極慢,nmap串所有的掃描,
每隔至少5分鐘發(fā)送一個(gè)包
1 即Sneaky模式。也差不多,只是數(shù)據(jù)包的發(fā)送間隔是15秒
2 即Polite模式。不增加太大的網(wǎng)絡(luò)負(fù)載,串行每個(gè)探測(cè),并使每個(gè)探測(cè)間隔
0.4秒
3 即Normal模式。nmap的默認(rèn)選項(xiàng),在不使網(wǎng)絡(luò)過載或者主機(jī)/端口丟失的情況
下盡可能快速地掃描
4 即Aggressive模式。設(shè)置5分鐘的超時(shí)限制,對(duì)每臺(tái)主機(jī)的掃描時(shí)間不超過5分
鐘,并且對(duì)每次探測(cè)回應(yīng)的等待時(shí)間不超過1.5秒。
5 即lnsane模式。只適合快速的網(wǎng)絡(luò)或者不在意丟失默些信息,每臺(tái)主機(jī)的超時(shí)
限制為75秒,對(duì)每次探測(cè)只等待0.3秒。
nmap -sS -T1 IP
-sV 探測(cè)端口的服務(wù)類型/具體版本等信息
nmap -vv -sV IP
-p 端口號(hào) 對(duì)某個(gè)端口的服務(wù)版本進(jìn)行詳細(xì)探測(cè) 有助于升入的針對(duì)性攻擊,
比如緩沖溢出攻擊
nmap -vv -sV IP -p 21
適用于內(nèi)外網(wǎng)的探測(cè),以內(nèi)網(wǎng)操作為示例(外網(wǎng)參數(shù)同)
簡(jiǎn)單端口掃描: nmap -vv -sT(sS、sF、sU、sA) 192.168.0.1 -D 127.0.0.1
(-D偽造的地址)
OS檢測(cè): nmap -vv -sS -O 192.168.0.1
RPC鑒別: nmap -sS -sR 192.168.0.1 Linux上的portmap就是一個(gè)簡(jiǎn)單的RPC服
務(wù),監(jiān)聽端口為111(默認(rèn))
Ping掃射:nmap -sP 172.16.15.0/24
十條常用nmap命令行格式
1)獲取遠(yuǎn)程主機(jī)的系統(tǒng)類型及開放端口
Get info about remote host ports and OS detection
nmap -sS -P0 -sV -O <target>
這里的 < target > 可以是單一 IP, 或主機(jī)名,或域名,或子網(wǎng)
-sS TCP SYN 掃描 (又稱半開放,或隱身掃描)
-P0 允許你關(guān)閉 ICMP pings.
-sV 打開系統(tǒng)版本檢測(cè)
-O 嘗試識(shí)別遠(yuǎn)程操作系統(tǒng)
-sS TCP SYN scanning (also known as half-open, or stealth scanning)
-P0 option allows you to switch off ICMP pings.
-sV option enables version detection
-O flag attempt to identify the remote operating system
Other option:
-A 同時(shí)啟用操作系統(tǒng)指紋識(shí)別和版本檢測(cè)
-A option enables both OS fingerprinting and version detection
-v use -v twice for more verbosity.
nmap -sS -P0 -A -v < target >
2)列出開放了指定端口的主機(jī)列表
Get list of servers with a specific port open
nmap -sT -p 80 -oG – 192.168.1.* | grep open
Change the -p argument for the port number. See “man nmap” for
different ways to specify address ranges.
3)在網(wǎng)絡(luò)尋找所有在線主機(jī)
Find all active IP addresses in a network
nmap -sP 192.168.0.*
或者也可用以下命令:
nmap -sP 192.168.0.0/24
指定 subnet
4)Ping 指定范圍內(nèi)的 IP 地址
Ping a range of IP addresses
nmap -sP 192.168.1.100-254
nmap accepts a wide variety of addressing notation, multiple
targets/ranges, etc.
5)在某段子網(wǎng)上查找未占用的 IP
Find unused IPs on a given subnet
nmap -T4 -sP 192.168.2.0/24 && egrep "00:00:00:00:00:00" /proc/net/arp
6)在局域網(wǎng)上掃找 Conficker 蠕蟲病毒
Scan for the Conficker virus on your LAN ect.
nmap -PN -T4 -p139,445 -n -v –script=smb-check-vulns –script-args
safe=1 192.168.0.1-254
replace 192.168.0.1-256 with the IP’s you want to check.
7)掃描網(wǎng)絡(luò)上的惡意接入點(diǎn) rogue APs.
Scan Network for Rogue APs.
nmap -A -p1-85,113,443,8080-8100 -T4 –min-hostgroup 50 –max-rtt-
timeout 2000 –initial-rtt-timeout 300 –max-retries 3 –host-timeout
20m –max-scan-delay 1000 -oA wapscan 10.0.0.0/8
I’ve used this scan to successfully find many rogue APs on a very,
very large network.
8)使用誘餌掃描方法來掃描主機(jī)端口
Use a decoy while scanning ports to avoid getting caught by the sys
admin
sudo nmap -sS 192.168.0.10 -D 192.168.0.2
Scan for open ports on the target device/computer (192.168.0.10) while
setting up a decoy address (192.168.0.2). This will show the decoy ip
address instead of your ip in targets security logs. Decoy address
needs to be alive. Check the targets security log at /var/log/secure
to make sure it worked.
9)為一個(gè)子網(wǎng)列出反向 DNS 記錄
List of reverse DNS records for a subnet
nmap -R -sL 209.85.229.99/27 | awk '{if($3=="not")print"("$2") no
PTR";else print$3" is "$2}' | grep '('
10)顯示網(wǎng)絡(luò)上共有多少臺(tái) Linux 及 Win 設(shè)備?
How Many Linux And Windows Devices Are On Your Network?
sudo nmap -F -O 192.168.1.1-255 | grep "Running: " > /tmp/os; echo
"$(cat /tmp/os | grep Linux | wc -l) Linux device(s)"; echo "$(cat
/tmp/os | grep Windows | wc -l) Window(s) devices"
相關(guān)文章
- Nmap是一款網(wǎng)絡(luò)掃描和主機(jī)檢測(cè)的非常有用的工具。Nmap是不局限于僅僅收集信息和枚舉,同時(shí)可以用來作為一個(gè)漏洞探測(cè)器或安全掃描器。它可以適用于winodws,linux,mac等操作2014-03-16
- Nmap這些年來功能越來越多, 它也是從一個(gè)高效的端口掃描器開始的,并且那仍然是它的核心功能,它把端口分成六個(gè)狀態(tài):open(開放的),closed(關(guān)閉的),filtered(被過濾的),u2008-10-08
- Nmap網(wǎng)絡(luò)安全掃描器說明(1) 作者:作者:Fyodor 譯者:quack發(fā)布日期:2002-2-6上傳日期:2002-2-6來源:不詳名稱----*nmap - 網(wǎng)絡(luò)勘察工具和安全掃描器摘要----*nmap [掃2008-10-08
- Nmap網(wǎng)絡(luò)安全掃描器說明(2) 作者:作者:Fyodor 譯者:quack發(fā)布日期:2002-2-6上傳日期:2002-2-6來源:不詳掃描類型--------*-sT TCP connect()掃描:這是對(duì)TCP的最基本2008-10-08
- Nmap網(wǎng)絡(luò)安全掃描器說明(4) 作者:作者:Fyodor 譯者:quack發(fā)布日期:2002-2-6上傳日期:2002-2-6來源:不詳定時(shí)選項(xiàng)--------*雖然nmap在一般情況下都能夠很好地在運(yùn)行時(shí)2008-10-08
- Nmap網(wǎng)絡(luò)安全掃描器說明(3) 作者:作者:Fyodor 譯者:quack發(fā)布日期:2002-2-6上傳日期:2002-2-6來源:不詳常規(guī)選項(xiàng)--------*這些選項(xiàng)并非必需的,但有些會(huì)非常實(shí)用。-P02008-10-08
- Nmap網(wǎng)絡(luò)安全掃描器說明(5) 作者:作者:Fyodor 譯者:quack發(fā)布日期:2002-2-6上傳日期:2002-2-6來源:不詳掃描范例--------*這里是一些運(yùn)用nmap的掃描范例,從最簡(jiǎn)單普2008-10-08
- nmap是一個(gè)網(wǎng)絡(luò)探測(cè)和安全掃描程序,系統(tǒng)管理者和個(gè)人可以使用這個(gè)軟件掃描大型的網(wǎng)絡(luò),獲取那臺(tái)主機(jī)正在運(yùn)行以及提供什么服務(wù)等信息2016-04-09