如何使用模組化的Hostintel收集惡意主機的情報資訊
今天給大家介紹的是一款模組化的Python應用程式,廣大研究人員可使用這款工具來收集關於惡意主機的情報資訊。
Hostintel
這款工具可以用來收集關於目標主機的各種情報資訊,Hostintel以模組化的形式進行開發,因此廣大使用者可以輕鬆新增新的情報源。
Hostintel通過FQDN主機名、域名或IP地址來進行主機識別。這款工具的當前版本僅支援IPv4。輸出資料為CSV格式,發動目的地為STDOUT,因此使用者可以直接儲存資料或將其轉發至其他軟體。由於資料的輸出格式為CSV格式,所以廣大使用者還可以根據自己的需要來將資料匯入到Excel表格或資料庫系統中。
工具演示視訊
幫助資訊
$python hostintel.py -h usage:hostintel.py [-h] [-a] [-d] [-v] [-p] [-s] [-c] [-t] [-o] [-i] [-r] ConfigurationFile InputFile Modular application to look up host intelligence information. Outputs CSV to STDOUT.This application will not output information until it has finished all ofthe input. positional arguments: ConfigurationFileConfiguration file InputFileInput file, one host per line (IP,domain, or FQDN host name) optional arguments: -h, --helpshow this help message and exit -a, --allPerform All Lookups. -d, --dnsDNS Lookup. -v, --virustotalVirusTotal Lookup. -p, --passivetotalPassiveTotal Lookup. -s, --shodanShodan Lookup. -c, --censysCensys Lookup. -t, --threatcrowdThreatCrowd Lookup. -o, --otxOTX by AlienVault Lookup. -i, --iscInternet Storm Center DShieldLookup. -r, --carriagereturnUse carriage returns with new lines on csv.
工具安裝
首先,確保你計算機或安裝裝置的配置檔案是正確的。這裡需要在配置檔案中新增你的API金鑰和使用者名稱。在執行該工具前,你還需要安裝Python(該工具採用Python2開發,但理論上支援Python3)和Pip。在工具的使用過程中,我們還需要從GitHub上安裝各種模組,因此git命令也是需要配置好的。對於任何一個平臺來說,使用Git來安裝軟體都是非常方便的。接下來,安裝Python依賴:
$ pip install -r requirements.txt
如果你在macOS上安裝遇到問題的話【 參考資料 】,,你可能還需要使用下列命令安裝部分程式碼庫:
$ pip install requests[security]
最後,我個人建議大家使用Python的virtualenv,來為該工具搭建自定義的本地Python環境:【 參考資料 】。
工具執行
$python hostintel.py myconfigfile.conf myhosts.txt -a > myoutput.csv
該命令的輸出檔案:myoutput.csv理論上可以直接匯入到任意資料庫或電子表格中。
注意:如果你的網路連線質量較差的話,工具搜尋資料的時間可能會比較長。因此建議使用者在這種情況下每次只使用一個模組,並手動進行資料匯出。
樣本資料
我們已經在專案的“sampledata”目錄中提供了一些簡單的樣本資料。其中的IP地址、域名和主機都是隨機選取的,不針對特定組織或個人。樣本資料的使用方法如下:
少量主機列表:
$python hostintel.py local/config.conf sampledata/smalllist.txt -a >sampledata/smalllist.csv ***Processing 8.8.8.8 *** ***Processing 8.8.4.4 *** ***Processing 192.168.1.1 *** ***Processing 10.0.0.1 *** ***Processing google.com *** ***Processing 212.227.247.242 *** ***Writing Output ***
大量主機列表:
$python hostintel.py local/config.conf sampledata/largerlist.txt -a >sampledata/largerlist.csv ***Processing 114.34.84.13 *** ***Processing 116.102.34.212 *** ***Processing 118.75.180.168 *** ***Processing 123.195.184.13 *** ***Processing 14.110.216.236 *** ***Processing 14.173.147.69 *** ***Processing 14.181.192.151 *** ***Processing 146.120.11.66 *** ***Processing 163.172.149.131 *** ... ***Processing 54.239.26.180 *** ***Processing 62.141.39.155 *** ***Processing 71.6.135.131 *** ***Processing 72.30.2.74 *** ***Processing 74.125.34.101 *** ***Processing 83.31.179.71 *** ***Processing 85.25.217.155 *** ***Processing 93.174.93.94 *** ***Writing Output ***
情報資源
大家可以從下列站點獲取API金鑰,並新增至專案的配置檔案中:
1、 GeoLite2 (不需要網路I/O): http://www.maxmind.com
2、 DNS (需要網路I/O): https://github.com/rthalley/dnspython
3、 VirusTotal (需要公共API金鑰和網路I/O): http://www.virustotal.com
4、 PassiveTotal (需要API、使用者名稱金鑰和網路I/O): http://www.passivetotal.com
5、 Shodan (需要API金鑰和網路I/O): http://www.shodan.io
6、 Censys (需要API、使用者名稱金鑰和網路I/O): http://www.censys.io
7、 ThreatCrowd (需要網路I/O): http://www.threatcrowd.org
8、 OTX by AlienVault (需要API金鑰和網路I/O): https://otx.alienvault.com
9、 Internet Storm Center (需要網路I/O): https://isc.sans.edu
程式碼庫資源
1、GeoIP2 Python 庫:
https://github.com/maxmind/GeoIP2-python
2、The Python DNS 庫:
https://github.com/rthalley/dnspython
http://www.iodigitalsec.com/performing-dns-queries-python/
3、VirusTotal Python 庫:
https://github.com/blacktop/virustotal-api
4、Shodan Python 庫:
http://shodan.readthedocs.io/en/latest/
https://github.com/achillean/shodan-python
5、Censys Python 庫:
https://github.com/censys/censys-python
6、PassiveTotal Python 庫:
https://passivetotal.readthedocs.io/en/latest/
https://github.com/passivetotal/python_api
7、ThreatCrowd Python 庫
https://github.com/threatcrowd/ApiV2
https://github.com/jheise/threatcrowd_api
8、OTX Python 庫:
https://github.com/AlienVault-Labs/OTX-Python-SDK
https://otx.alienvault.com/api/
9、Internet Storm CenterDShield Python 庫
https://github.com/rshipp/python-dshield
專案地址
Hostintel:【 GitHub傳送門 】
*參考來源: hostintel ,FB小編Alpha_h4ck編譯,轉載請註明來自FreeBuf.COM