NMAP高級用法的一些例子

定製探測包

Nmap提供–scanflags選項,用戶能夠對須要發送的TCP探測包的標誌位進行徹底的控制。能夠使用數字或符號指定TCP標誌位:URG, ACK, PSH,RST, SYN,and FIN。sql

例如,安全

nmap -sX -T4 –scanflags URGACKPSHRSTSYNFINtargetip網絡

此命令設置所有的TCP標誌位爲1,能夠用於某些特殊場景的探測。tcp

另外使用–ip-options能夠定製IP包的options字段。ide

使用-S指定虛假的IP地址,-D指定一組誘騙IP地址(ME表明真實地址)。-e指定發送探測包的網絡接口,-g(–source- port)指定源端口,-f指定使用IP分片方式發送探測包,–spoof-mac指定使用欺騙的MAC地址。–ttl指定生存時間。spa

掃描防火牆

防火牆在今天網絡安全中扮演着重要的角色,若是能對防火牆系統進行詳細的探測,那麼繞開防火牆或***防火牆就更加容易。因此,此處講解利用Nmap獲取防火牆基本信息典型的用法。命令行

爲了獲取防火牆全面的信息,需儘量多地結合不一樣掃描方式來探測其狀態。在設計命令行參數時,能夠綜合網絡環境來微調時序參數,以便加快掃描速度。設計

SYN掃描code

首先能夠利用基本的SYN掃描方式探測其端口開放狀態。接口

nmap -sS -T4 www.91ri.org

掃描輸出爲:

Default

All 997 ports are filtered      PORT    STATE  SERVICE      80/tcp  open   http      113/tcp closed auth      507/tcp open   crs

1

2

3

4

5

6

7

8

9

    All 997 ports are filtered  

 

    PORT    STATE  SERVICE  

 

    80/tcp  open   http  

 

    113/tcp closed auth  

 

    507/tcp open   crs

咱們能夠看到SYN方式探測到3個端口開放,而有997個端口被過濾。Nmap默認掃描只掃描1000個最可能開放的端口,若是想掃描所有的端口.

使用命令nmap -sS -T4-p- www.91ri.org

FIN掃描

而後能夠利用FIN掃描方式探測防火牆狀態。FIN掃描方式用於識別端口是否關閉,收到RST回覆說明該端口關閉,不然說明是open或filtered狀態。

nmap -sF -T4 www.91ri.org

Default

PORT      STATE         SERVICE      7/tcp     open|filtered echo      9/tcp     open|filtered discard      11/tcp    open|filtered systat      13/tcp    open|filtered daytime      23/tcp    open|filtered telnet      25/tcp    open|filtered smtp      37/tcp    open|filtered time      79/tcp    open|filtered finger      80/tcp    open|filtered http      更多端口,此處省略

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

    PORT      STATE         SERVICE  

 

    7/tcp     open|filtered echo  

 

    9/tcp     open|filtered discard  

 

    11/tcp    open|filtered systat  

 

    13/tcp    open|filtered daytime  

 

    23/tcp    open|filtered telnet  

 

    25/tcp    open|filtered smtp  

 

    37/tcp    open|filtered time  

 

    79/tcp    open|filtered finger  

 

    80/tcp    open|filtered http  

 

    更多端口,此處省略

ACK掃描

而後利用ACK掃描判斷端口是否被過濾。針對ACK探測包,未被過濾的端口(不管打開、關閉)會回覆RST包。

nmap -sA -T4 www.91ri.org

掃描輸出爲:

Default

Not shown: 997 unfiltered ports      PORT      STATE    SERVICE      135/tcp   filtered msrpc      1434/tcp  filtered ms-sql-m      32777/tcp filtered sometimes-rpc17

1

2

3

4

5

6

7

8

9

    Not shown: 997 unfiltered ports  

 

    PORT      STATE    SERVICE  

 

    135/tcp   filtered msrpc  

 

    1434/tcp  filtered ms-sql-m  

 

    32777/tcp filtered sometimes-rpc17

從結果能夠997個端口是未被過濾的(unfiltered),而3個(135/1434/32777)被過濾了。因此,將ACK與FIN掃描 的結果結合分析,咱們能夠找到不少開放的端口。例如7號端口,FIN中得出的狀態是:open或filtered,從ACK中得出的狀態是 unfiltered,那麼該端口只能是open的。

相關文章
相關標籤/搜索