此工具用于收集主机的各种情报来源。 Hostintel 采用模块化编写,因此可以轻松添加新的情报来源。
主机通过 FQDN 主机名、域名或 IP 地址来识别。此工具目前仅支持 IPv4。输出为 CSV 格式,发送到标准输出,因此数据可以保存或通过管道传输到其他程序。由于输出为 CSV 格式,电子表格软件(如 Excel)或数据库系统可以轻松导入数据。
我在 YouTube 上为这个工具做了一个简短的介绍:https://youtu.be/aYK0gILDA6w
此工具适用于 Python v2 和 Python v3。如果你发现它不适用于 Python v3,请提交一个 issue。
$ 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
of the input.
positional arguments:
ConfigurationFile Configuration file
InputFile Input file, one host per line (IP, domain, or FQDN
host name)
optional arguments:
-h, --help show this help message and exit
-a, --all Perform All Lookups.
-d, --dns DNS Lookup.
-v, --virustotal VirusTotal Lookup.
-p, --passivetotal PassiveTotal Lookup.
-s, --shodan Shodan Lookup.
-c, --censys Censys Lookup.
-t, --threatcrowd ThreatCrowd Lookup.
-o, --otx OTX by AlienVault Lookup.
-i, --isc Internet Storm Center DShield Lookup.
-r, --carriagereturn Use carriage returns with new lines on csv.
首先,确保你的配置文件正确适配你的计算机/安装环境。在配置文件中添加你的 API 密钥和用户名。运行此工具需要 Python 和 Pip。有些模块必须从 GitHub 安装,因此请确保 git 命令在你的命令行中可用。Git 在任何平台上都很容易安装。接下来,安装 Python 依赖包(每次 git pull 这个仓库后也要运行此命令):
$ pip install -r requirements.txt
Mac OSX 上自带的 Python 版本存在一些问题(http://stackoverflow.com/questions/31649390/python-requests-ssl-handshake-failure)。你可能需要使用以下命令安装 requests 库的安全部分:
$ pip install requests[security]
最后,我个人喜欢 virtualenv 来管理 Python 环境。要为该工具创建自定义的本地 Python 安装,我建议阅读:http://docs.python-guide.org/en/latest/dev/virtualenvs/
$ python hostintel.py myconfigfile.conf myhosts.txt -a > myoutput.csv
你应该可以将 myoutput.csv 导入任何数据库或电子表格程序。
注意,根据你的网络状况、API 密钥限制以及搜索的数据,此脚本可能会运行很长时间!请谨慎使用每个模块!尽管等待时间长,但你无需手动拉取这些数据。
“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 密钥,用于你的配置文件。
粗略的说明见此处。
此应用程序采用 Creative Commons BY-SA 许可证。
This product includes GeoLite2 data created by MaxMind, available from
<a href="http://www.maxmind.com">http://www.maxmind.com</a>.