0x01 前言
ZoomEye作为一款网络空间搜索引擎,通过浏览器可以快速搜索网络设备。对于技术人员来说这并不是很友好,技术人员期待一款能够便捷有效的查询 ZoomEye的信息、数据以及格式化结果等操作并且还能作为 SDK 集成到其他的工具中,于是便有了 ZoomEye-python这样一个工具。
ZoomEye-python是一款基于 ZoomEye API开发的 Python 库,提供了 ZoomEye命令行模式,同时也可以作为 SDK集成到其他工具中。该库可以让技术人员更便捷地搜索、筛选、导出ZoomEye的数据。
0x02 ZoomEye API
ZoomEye官方提供了搜索数据,用户登陆,剩余资源以及设备历史接口,目前 ZoomEye API 对外开放开发者(developer) 权限,有一定的额度限制。每个月的额度为 10000 条,对外开放的开发者套餐每个月会重置相应资源的请求额度。注册用户即可获得 API 的开发者套餐使用权限。
0x03 安装步骤
可直接从 pypi进行安装:pip3 install zoomeye
也可以通过 github进行安装:pip3 install git+https://github.com/knownsec/zoomeye-python.git
0x04 如何使用
ZoomEye-python提供了 cli 和 SDK 两种工作模式。
1.使用cli
在完成安装后,可以使用 zoomeye -h命令验证是否安装成功。$ zoomeye -h
usage: zoomeye [-h] {info,search,init} ...
positional arguments:
{info,search,init}
info Show ZoomEye account info
search Search the ZoomEye database
init Initialize the token for ZoomEye-python
optional arguments:
-h, --help show this help message and exit
1.初始化
ZoomEye-python的初始化非常简单,使用下列方式中的一种就可以:
APIKEY (推荐)$ zoomeye init -apikey "01234567-acbd-00000-1111-22222222222"
successfully initialized
Role: developer
Quota: 10000
or
username/password$ zoomeye init -username "username@zoomeye.org" -password "password"
successfully initialized
Role: developer
Quota: 10000
这两种方式本质上没有区别,通过 username/password的方式初始化 cli ,这种方式认证后会返回 JWT-token,具有一定的时效性 (大概 12 个小时),JWT-toekn失效后需要用户重新登陆。而APIKEY不会过期,用户可根据需求在个人信息中进行重置。因此我们推荐 使用 APIKEY 的方式进行初始化。
2.账户资源
ZoomEye API规定每个账户注册即可获得 10000 条数据的额度,在使用搜索之前记得查看账户所剩下的配额。
使用命令 zoomeye info即可查询账户的剩余配额。$ zoomeye info
Role: developer
Quota: 10000需要注意:info 命令只显示了免费部分的配额,将在下个版本修复。
3.搜索$ zoomeye search -h
usage: zoomeye search [-h] [-num value] [-facet [field]]
[-filter [field=regexp]] [-stat [field]]
[-save [field=regexp]] [-count]
dork
positional arguments:
dork The ZoomEye search keyword or ZoomEye exported file
optional arguments:
-h, --help show this help message and exit
-num value The number of search results that should be returned
-facet [field] Perform statistics on ZoomEye database, field:
[app,device,service,os,port,country,city]
-filter [field=regexp]
Output more clearer search results by set filter
field, field:
[app,version,device,port,city,country,asn,banner,*]
-stat [field] Perform statistics on search results, field:
[app,device,service,os,port,country,city]
-save [field=regexp] Save the search results with ZoomEye json format, if
you specify the field, it will be saved with JSON
Lines
-count The total number of results in ZoomEye database for a
search
search命令提供了对数据进行 筛选、搜索、导出、聚合统计的能力,下面以 飞致云堡垒机为例展示 ZoomEye-python的功能:
搜索数据$ zoomeye search "app:"飞致云堡垒机""</