天天看點

kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍

測試網絡範圍

通過測試網絡範圍内地IP位址或域名,可以确定是否有人入侵自己的網絡并損害系統。kali提供了DMitry和Scapy工具 ,DMitry工具用來查詢目标網絡中的IP位址或域名資訊Scapy用來掃描網絡及修談資料包。

域名查詢工具 

DMitry

DMitry是一個用來查詢IP或域名WHOIS資訊的。WHOIS是用來查詢域名是否已經被注冊以及注冊域名的詳細資訊的資料庫。使用此工具可以查詢到域名的注冊商和過期時間等。

官方用途說明:

DMitry(Deepmagic資訊收集工具)是用C編碼的UNIX /(GNU)Linux指令行應用程式.DMitry能夠收集盡可能多的關于主機的資訊。基本功能可以收集可能的子域,電子郵件位址,正常運作時間資訊,tcp端口掃描,whois查找等。

以下是目前功能的清單:

  • 一個開源項目。
  • 執行Internet編号whois查找。
  • 檢索可能的正常運作時間資料,系統和伺服器資料。
  • 在目标主機上執行子域搜尋。
  • 在目标主機上執行電子郵件位址搜尋。
  • 在主機目标上執行TCP端口掃描。
  • 子產品化程式,允許使用者指定的子產品

來源:https://tools.kali.org/information-gathering/dmitry

執行個體:dmitry -wnpb baidu.com; dmitry -wnpb rzchina.net 這裡我做了兩個個實驗

[email protected] ~                                                                                                                                                                                              [19:25:25] 
> $ dmitry -wnpb baidu.com                                                                                                                                                                                        
Deepmagic Information Gathering Tool
"There be some deep magic going on"

HostIP:220.181.57.216 //主機IP
HostName:baidu.com    //主機名

Gathered Inic-whois information for baidu.com
---------------------------------
   Domain Name: BAIDU.COM                            //域名
   Registry Domain ID: 11181110_DOMAIN_COM-VRSN      //注冊域名ID
   Registrar WHOIS Server: whois.markmonitor.com     //注冊商WHOIS伺服器
   Registrar URL: http://www.markmonitor.com         //注冊商網址
   Updated Date: 2019-01-25T04:08:55Z                //更新時間
   Creation Date: 1999-10-11T11:05:17Z               //注冊時間
   Registry Expiry Date: 2026-10-11T11:05:17Z        //到期時間
   Registrar: MarkMonitor Inc.                       //注冊商
   Registrar IANA ID: 292                          //注冊商IANA(網際網路号碼配置設定局) ID
   Registrar Abuse Contact Email: [email protected] //注冊商e-mail
   Registrar Abuse Contact Phone: +1.2083895740                //注冊商電話
   Domain Status: clientDeleteProhibited              //域狀态 禁止删除用戶端https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
   Domain Status: serverDeleteProhibited https://icann.org/epp#serverDeleteProhibited
   Domain Status: serverTransferProhibited https://icann.org/epp#serverTransferProhibited
   Domain Status: serverUpdateProhibited https://icann.org/epp#serverUpdateProhibited
   Name Server: NS1.BAIDU.COM       //名稱伺服器
   Name Server: NS2.BAIDU.COM
   Name Server: NS3.BAIDU.COM
   Name Server: NS4.BAIDU.COM
   Name Server: NS7.BAIDU.COM
   DNSSEC: unsigned          //域名系統安全擴充
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2019-04-12T11:26:15Z <<<

××× 這裡是關于whois的更多提示内容,省略×××

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.

Gathered Netcraft information for baidu.com
---------------------------------

Retrieving Netcraft.com information for baidu.com
Netcraft.com Information gathered

Gathered TCP Port information for 220.181.57.216
---------------------------------

 Port		State

80/tcp		open            //查到的部分端口資訊

Portscan Finished: Scanned 150 ports, 69 ports were in state closed


All scans completed, exiting
           
[email protected] ~                                                                                                                                                                                              [19:31:08] 
> $ dmitry -wnpb rzchina.net                                                                                                                                                                                      
Deepmagic Information Gathering Tool
"There be some deep magic going on"

HostIP:180.178.61.83
HostName:rzchina.net

Gathered Inic-whois information for rzchina.net
---------------------------------
   Domain Name: RZCHINA.NET
   Registry Domain ID: 965877923_DOMAIN_NET-VRSN
   Registrar WHOIS Server: whois.bizcn.com
   Registrar URL: http://www.bizcn.com
   Updated Date: 2017-05-02T01:50:14Z
   Creation Date: 2007-05-09T10:08:08Z
   Registry Expiry Date: 2019-05-09T10:08:08Z
   Registrar: Bizcn.com, Inc.
   Registrar IANA ID: 471
   Registrar Abuse Contact Email:
   Registrar Abuse Contact Phone:
   Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Name Server: DNS1.BIZMOTO.COM
   Name Server: DNS2.BIZMOTO.COM
   DNSSEC: unsigned
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2019-04-12T11:31:17Z <<<

---------------------------------

Retrieving Netcraft.com information for rzchina.net
Netcraft.com Information gathered

Gathered TCP Port information for 180.178.61.83
---------------------------------

 Port		State

21/tcp		open
>> 220 Welcome

22/tcp		open
>> SSH-2.0-OpenSSH_4.3

80/tcp		open

Portscan Finished: Scanned 150 ports, 141 ports were in state closed


All scans completed, exiting
           
常用選項
-w 進行域whois查找
-n 檢查netcraft資訊
-p 進行tcp端口掃描
-b 讀入從掃描端口收到的橫幅
官方提供完整選項:
dmitry:無效選項 - 'h' 
用法:dmitry [-winsepfb] [-t 0-9] [-o%host .txt] host 
-o 将輸出儲存到%host.txt或由-o file指定的檔案
-i 對主機的IP位址
-w 對主機的域名執行whois查找
-n 檢索主機上的Netcraft.com資訊
-s 執行可能的子域搜尋
-e 執行搜尋可能的電子郵件位址
-p 在主機上執行TCP端口掃描
* -f 在主機上執行TCP端口掃描,顯示輸出報告過濾端口
* -b讀入從掃描端口收到的橫幅
* -t 0-9設定掃描TCP端口時的TTL(預設值為2)*需要-p标記為傳遞
           

雖然DMitry可以獲得IP或域名資訊,但是不能判斷網絡範圍,是以可以将IP位址轉換為子網路遮罩的格式、CIDR格式和思科反向子網路遮罩的格式等。kali中使用netmask可以進行轉換。

執行個體:netmask -s 220.181.57.216 上文擷取的

[email protected] ~/文檔/txt                                                                                                                                                                                       [20:03:32] 
> $ netmask -s 220.181.57.216                                                                                                                                                                                     
 220.181.57.216/255.255.255.255
           
[email protected] ~/文檔/txt                                                                                                                                                                                       [19:57:53] 
> $ netmask -h                                                                                                                                                                                                    
This is netmask, an address netmask generation utility
Usage: netmask spec [spec ...]
  -h, --help			Print a summary of the options
  -v, --version			Print the version number
  -d, --debug			Print status/progress information
  -s, --standard		Output address/netmask pairs
  -c, --cidr			Output CIDR format address lists
  -i, --cisco			Output Cisco style address lists
  -r, --range			Output ip address ranges
  -x, --hex			Output address/netmask pairs in hex
  -o, --octal			Output address/netmask pairs in octal
  -b, --binary			Output address/netmask pairs in binary
  -n, --nodns			Disable DNS lookups for addresses
  -f, --files			Treat arguments as input files
Definitions:
  a spec can be any of:
    address
    address:address
    address:+address
    address/mask
  an address can be any of:
    N		decimal number
    0N		octal number
    0xN		hex number
    N.N.N.N	dotted quad
    hostname	dns domain name
  a mask is the number of bits set to one from the left
           

路由跟蹤工具

Scapy

Scapy是一款強大的互動式資料包處理工具、資料包生成工具、網絡掃描器、網絡發現工具和包嗅探工具。他提供多種類别的生成資料包或資料包集合、對資料包進行操作、發送資料包、包嗅探、應答、回報比對等功能。

這裡以使用Scapy實作多行并行跟蹤路由功能為例:

必須用root權限打開才可以正常使用,如果出于安全性使用非root使用者登入的話可以 sudo scapy或采取下面連結給出的意見:https://stackoverflow.com/questions/22421290/scapy-operation-not-permitted-when-sending-packets

(1)啟用scapy

kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍
 (2) 使用sr()函數實作發送和接收資料包。
kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍
(3) 使用表的形式檢視資料包
kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍
(4) 檢視TCP路由跟蹤資訊
kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍
kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍

可以單獨查找,也可以查找一個清單,其中SA表示服務區。

(5) 使用res.graph()以圖形顯示路由跟蹤結果

這裡當使用scapy 2.4版本的時候可能報錯是以隻需使用語句:res.graph(ASres=AS_resolver_radb() ,type="svg") 或 res.graph(target="> /home/root/圖檔/graph.svg", ASres=AS_resolver_radb() ,type="svg")來代替res.graph()即可

kali linux 滲透技術學習筆記 2.資訊收集——測試網絡範圍測試網絡範圍
res.trace3D()可以制作3d圖檔,不過需要vpython的支援
           
(6) exit()退出

部落客還在學習kali的相關内容,如有錯誤,還請各位指出,謝謝支援。 

繼續閱讀