Nmap是一款開源免費的網絡發現(Network Discovery)和安全審計(Security Auditing)工具。軟件名字Nmap是Network Mapper的簡稱。Nmap最初是由Fyodor在1997年開始創建的。隨後在開源社區衆多的志願者參與下,該工具逐漸成爲最爲流行安全必備工具之一。官網爲:www.nmap.org。
Zenmap是Nmap官方提供的圖形界面,通常隨Nmap的安裝包發佈。Zenmap是用Python語言編寫而成的開源免費的圖形界面,能夠運行在不同操作系統平臺上(Windows/Linux/Unix/Mac OS等)。Zenmap旨在爲nmap提供更加簡單的操作方式。簡單常用的操作命令可以保存成爲profile,用戶掃描時選擇profile即可;可以方便地比較不同的掃描結果;
Nmap包含四項基本功能:
- 主機發現 (Host Discovery)
- 端口掃描 (Port Scanning)
- 版本偵測 (Version Detection) (用於確定目標主機開放端口上運行的具體的應用程序及版本信息。)
- 操作系統偵測 (Operating System Detection)
zenmap 的十種掃描方式介紹
第一種:Intense scan
(nmap -T4 -A -v)
一般來說,Intense scan可以滿足一般掃描
-T4 加快執行速度
-A 操作系統及版本探測
-v 顯示詳細的輸出
第二種:Intense scan plus UDP
(nmap -sS -sU -T4 -A -v)
即UDP掃描
-sS TCP SYN 掃描
-sU UDP 掃描
第三種:Intense scan,all TCP ports
(nmap -p 1-65536 -T4 -A -v)
掃描所有TCP端口,範圍在1-65535,試圖掃描所有端口的開放情況,速度比較慢。
-p 指定端口掃描範圍
第四種:Intense scan,no ping
(nmap -T4 -A -v -Pn)
非ping掃描
-Pn 非ping掃描
第五種:Ping scan
(nmap -sn)
Ping 掃描
優點:速度快。
缺點:容易被防火牆屏蔽,導致無掃描結果
-sn ping掃描
第六種:Quick scan
(nmap -T4 -F)
快速的掃描
-F 快速模式。
第七種:Quick scan plus
(nmap -sV -T4 -O -F --version-light)
快速掃描加強模式
-sV 探測端口及版本服務信息。
-O 開啓OS檢測
--version-light 設定偵測等級爲2。
第八種:Quick traceroute
(nmap -sn --traceroute)
路由跟蹤
-sn Ping掃描,關閉端口掃描
-traceroute 顯示本機到目標的路由躍點。
第九種:Regular scan
規則掃描
第十種:Slow comprehensive scan
(nmap -sS -sU -T4 -A -v -PE -PP -PS80,443,-PA3389,PU40125 -PY -g 53 --script all)
慢速全面掃描。
.掃描一個IP地址範圍
你可以在nmap執行掃描時指定IP範圍。
[root@server1 ~]# nmap 192.168.0.101-110
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 16:09 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
957/tcp open unknown
3306/tcp open mysql
8888/tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 10 IP addresses (1 host up) scanned in 0.542 seconds
22.掃描指定範圍內的端口
您可以使用表達式來掃描某個範圍內的端口。
[root@server1 ~]# nmap -p 80-160 192.168.0.101
24.使用TCP ACK (PA)和TCP Syn (PS)掃描遠程主機
有時候包過濾防火牆會阻斷標準的ICMP ping請求,在這種情況下,我們可以使用TCP ACK和TCP Syn方法來掃描遠程主機。
[root@server1 ~]# nmap -PS 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 17:51 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
957/tcp open unknown
3306/tcp open mysql
8888/tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.360 seconds
You have new mail in /var/spool/mail/root
25.使用TCP ACK掃描遠程主機上特定的端口
[root@server1 ~]# nmap -PA -p 22,80 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 18:02 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.166 seconds
You have new mail in /var/spool/mail/root
26. 使用TCP Syn掃描遠程主機上特定的端口
[root@server1 ~]# nmap -PS -p 22,80 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 18:08 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.165 seconds
You have new mail in /var/spool/mail/root
27.執行一次隱蔽的掃描
[root@server1 ~]# nmap -sS 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 18:10 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
957/tcp open unknown
3306/tcp open mysql
8888/tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.383 seconds
You have new mail in /var/spool/mail/root
28.使用TCP Syn掃描最常用的端口
[root@server1 ~]# nmap -sT 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 18:12 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
957/tcp open unknown
3306/tcp open mysql
8888/tcp open sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 0.406 seconds
You have new mail in /var/spool/mail/root
29.執行TCP空掃描以騙過防火牆
[root@server1 ~]# nmap -sN 192.168.0.101
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2013-11-11 19:01 EST
Interesting ports on server2.tecmint.com (192.168.0.101):
Not shown: 1674 closed ports
PORT STATE SERVICE
22/tcp open|filtered ssh
80/tcp open|filtered http
111/tcp open|filtered rpcbind
957/tcp open|filtered unknown
3306/tcp open|filtered mysql
8888/tcp open|filtered sun-answerbook
MAC Address: 08:00:27:D9:8E:D7 (Cadmus Computer Systems)
Nmap finished: 1 IP address (1 host up) scanned in 1.584 seconds
You have new mail in /var/spool/mail/root
以上就是NMAP的基本使用
一個非常簡單的開源端口掃描工具
常用參數:
Intense scan |
(nmap -T4 -A -v) |
一般來說,Intense scan可以滿足一般掃描 |
|
-T4 |
加快執行速度 |
|
-A |
操作系統及版本探測 |
|
-v |
顯示詳細的輸出 |
Intense scan plus UDP |
(nmap -sS -sU -T4 -A -v) |
即UDP掃描 |
|
-sS |
TCP SYN 掃描 |
|
-sU |
UDP 掃描 |
Intense scan,all TCP ports |
(nmap -p 1-65536 -T4 -A -v) |
掃描所有TCP端口,範圍在1-65535,試圖掃描所有端口的開放情況,速度比較慢。 |
|
-p |
指定端口掃描範圍 |
Intense scan,no ping |
(nmap -T4 -A -v -Pn) |
非ping掃描 |
|
-Pn |
非ping掃描 |
Ping scan |
(nmap -sn) |
Ping 掃描 優點:速度快。 缺點:容易被防火牆屏蔽,導致無掃描結果 |
|
-sn |
ping掃描 |
Quick scan |
(nmap -T4 -F) |
快速的掃描 |
|
-F |
快速模式。 |
Quick scan plus |
(nmap -sV -T4 -O -F –version-light) |
快速掃描加強模式 |
|
-sV |
探測端口及版本服務信息。 |
|
-O |
開啓OS檢測 |
|
–version-light |
設定偵測等級爲2。 |
Quick traceroute |
(nmap -sn –traceroute) |
路由跟蹤 |
|
-sn Ping |
掃描,關閉端口掃描 |
|
-traceroute |
顯示本機到目標的路由躍點。 |
Regular scan |
規則掃描 |
|
Slow comprehensive scan |
(nmap -sS -sU -T4 -A -v -PE -PP -PS80,443,-PA3389,PU40125 -PY -g 53 –script all) |
慢速全面掃描。 |