Riskiq Rest API客户端
riskiq的Python项目详细描述
riskiq api服务的python客户端
riskiq在riskiq api中提供了一个python客户端库实现 服务。库当前支持以下服务:
- 被动DNS查询
- 黑名单URL搜索
- 黑名单事件URL搜索
- zlist下载
- 爬虫登录页提交
命令行脚本
以下命令行脚本随库一起安装:
- riq config:设置或查询 库(API令牌和私钥)。
- riq dns:向riskiq被动dns数据库服务发出查询的客户端。
- riq黑名单:客户端对要标识的域和url发出查询 在RiskIQ黑名单上的列表。
- riq zlist:在zlist中查询时间范围内的条目
- riq登录页:获取并提交新的登录页
- riq binary:从二进制源中列出并下载文件
有关详细信息,请参阅用法部分。
安装
从下载的源发行版:
$ python setup.py install
或者来自pypi:
$ pip install riskiq
这个包依赖于pythonRequests库。 如果未安装请求,则会将其作为依赖项安装。
设置
首次安装需要配置用于身份验证的API令牌和私钥:
$ riq-config setup <API_TOKEN> <API_PRIVATE_KEY>
任何时候,都可以使用相同的实用程序查询当前的api配置参数:
$ riq-config show
配置参数存储在$home/.config/riskiq/api_config.json中。
用法
每个命令行脚本都有几个子命令可以传递给它。这个 命令的用法可以用-h/--help选项描述。
例如:
$ riq-blacklist -h usage: riq-blacklist [-h] {lookup,incident,incidentlist,list,malware} ... positional arguments: {lookup,incident,incidentlist,list,malware} lookup Query blacklist on URL incident Query blacklist incident on URL incidentlist query blacklist incidents within timeframe list query blacklisted resources malware Query for all discovered malware resources generated within a particular period. optional arguments: -h, --help show this help message and exit
每个子命令都有进一步的帮助选项:
$ riq-blacklist lookup -h usage: riq-blacklist lookup [-h] [-l] [-j] urls [urls ...] positional arguments: urls optional arguments: -h, --help show this help message and exit -l, --oneline Output one line per entry -j, --json Output as JSON
所有命令都有-j/--json选项以返回json格式的原始响应 格式,通常包含的信息比默认值中的更多, 人类可读格式。
版本历史记录
0.2.7之前的版本主要是基本实现和错误修复。 我们不建议使用低于0.2.7的任何东西。
0.4.10: | Added support for whois history lookups in API. |
---|---|
0.4.9: | Added support for bulk blacklist lookups in API. |
0.4.8: | Added custom jinja2 template option to CLI render script (–template/-T) Fixed whitespace rendering when incidents are empty |
0.4.7: | Hotfix for rendering bug |
0.4.6: | Fixed multiple blacklist templates Fixed verbose flag for riq-blacklist submodules |
0.4.5: | Fixed bugs in riskiq.cli.blacklist scripts |
0.4.4: | Refactored riskiq.cli.blacklist scripts |
0.4.3: | Fixed issue where Python 2.6 sys.version_info is a tuple, not namedtuple. |
0.4.2: | Fixed config bug |
0.4.1: | Disable httplib if in Python 3+ |
0.4.0: | Working on Python 3 compatibility |
0.3.2: | Updated ^{tt3}$ output formats. Default output format is now a shortened one-line format per record. A more verbose one-line format is available with the ^{tt4}$ option. The previous text-based “human-readable” format is available using the ^{tt5}$ option. |
0.2.7: | Fixed template bug in ^{tt6}$ |
0.2.6: | Fix landingpage submissions to allow md5, project, keyword, fields |
0.2.5: | Added binary download options –output and –output-dir 8f540b0 List and download suspicious binaries via CLI fix MANIFEST.in installation bug |
0.2.3: | Documentation changes |
0.2.1: | Added documentation |
<= 0.2.0: | Most implementation of CLI tools and client API |