ZoomEye-python工具使用详解(一)

简介: ZoomEye-python工具使用详解(一)

ZoomEye-python
ZoomEye是网络空间搜索引擎,用户能够使用浏览器搜索网络设备。 官网地址

ZoomEye-python是一个基于ZoomEye API开发的Python库,它既提供ZoomEye命令行模式(ZoomEye command line)也能够作为一个SDK集成到其他工具中。这个库可以让技术人员更方便的搜索、筛选并输出ZoomEye数据。

0x01 安装
可以直接从pypi安装,命令如下:

pip3 install zoomeye

或者从github安装,命令如下:

pip3 install git+https://github.com/knownsec/ZoomEye-python.git

0x02 如何使用cli
成功安装ZoomEye-python以后,你就可以直接使用zoomeye命令了。如下所示:

(base) liuxiaowei@MacBookAir ~ % zoomeye -h
usage: zoomeye [-h] [-v] {
   info,search,init,ip,history,clear,domain} ...

positional arguments:
  {
   info,search,init,ip,history,clear,domain}
    info                Show ZoomEye account info
    search              Search the ZoomEye database
    init                Initialize the token for ZoomEye-python
    ip                  Query IP information
    history             Query device history
    clear               Manually clear the cache and user information
    domain              search associated domain or sub domain

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit

1. 初始化token
在使用ZoomEye-python cli之前,用户需要初始化token。用来验证用户身份的凭证来自ZoomEye的查询数据;我们提供两种授权方式:

1.用户名/密码(username/password)
2.APIKEY(推荐 recommend)

你可以通过zoomeye init -h 浏览帮助,并且使用APIKEY(本人的APIKEY)演示如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye init -apikey "C23AE8Ca-5b37-b5bc2-27da-3e69cbb7f30"
Role: developer
Quota: 9615
successfully initialized

备注:登录ZoomEye后,用户在个人信息档案 获取APIKEY;如下图:

image.png

APIKEY将不会过期,直到用户可以根据需要重置APIKEY。此外我们还提供了“用户名/密码”的方式初始化。这种方式认证以后,将返回一个有时效性的JWT-token,失效以后,用户需要再次登录。

2. 查询配额
用户能够通过info命令查询个人信息和免费的数据配额, 如下所示:

(base) liuxiaowei@MacBookAir ~ % zoomeye info
Role: developer
Quota: 9615
user_info: {
   'name': '10a7a631127b', 'role': 'developer', 'expired_at': ''}
quota_info: {
   'remain_free_quota': 9615, 'remain_pay_quota': 0, 'remain_total_quota': 9615}

3. 搜 索
搜索是ZoomEye-python的核心功能,通过search命令来实现。这个search命令需要特定的搜索关键词(dork),让我们运行一个简单的搜索,如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye search "telnet" -num 1 
ip:port                  service             country             app                           banner                        
61.*.*.78:7007        telnet              China                                             \xff\xfb,\xff\xfb\x03\x...    
5.*.*.3:6001           telnet              Russian Federation  Cisco or Actiontec...         \xff\xfb\x01\xff\xfb\x0...    
5.*.1*.47:6001          telnet              Russian Federation  Cisco or Actiontec...               \xff\xfb\x01\xff\xfb\x0...    
45.*.*.216:119       telnet              Brazil                                            \xff\xfd\x18\xff\xfd \x...    
45.*.*.66:119        telnet              Brazil                                            \xff\xfd\x18\xff\xfd \x...    
45.*.*.251:119       telnet              Brazil

使用search命令跟使用浏览器在ZoomEye里搜索一样简单。缺省条件下,我们显示5个更重要的字段。用户能够使用这些数据来了解目标信息:

1.ip:port    ip地址和端口
2.service    开放端口的服务
3.country         该ip地址的国家
4.app              应用程序类型
5.banner         端口的特性回应

在以上的例子里,使用-num参数来指定被显示的数量。此外,search还支持参数(zoomeye search -h)以便处理数据,我们将解释和演示如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye search -h
usage: zoomeye search [-h] [-num value] [-facet [field]]
                      [-filter [field=regexp]] [-stat [field]]
                      [-save [field=regexp]] [-count] [-figure {
   pie,hist}]
                      [-type {
   host,web}] [-force]
                      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,
                        support 'all'
  -facet [field]        Perform statistics on ZoomEye database, host field:
                        [app,device,service,os,port,country,city] web field:
                        [webapp,component,framework,server,waf,os,country]
  -filter [field=regexp]
                        Output more clearer search results by set filter
                        field, host field: [app,version,device,port,city,count
                        ry,asn,banner,timestamp,*] web field: [app,headers,key
                        words,title,site,city,country,webapp,component,framewo
                        rk,server,waf,os,timestamp,*]
  -stat [field]         Perform statistics on search results, host field:
                        [app,device,service,os,port,country,city] web field:
                        [webapp,component,framework,server,waf,os,country]
  -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
  -figure {
   pie,hist}    Pie chart or bar chart showing data,can only be used
                        under facet and stat
  -type {
   host,web}      Select web search or host search(default host)
  -force                Ignore the local cache and force the data to be
                        obtained from the API
-num    设定显示/搜索的数量,支持‘all’
-count  在ZoomEye数据库里该目标(dork)查询的总数
-facet  查询目标(dork)全部数据的分布
-stat   结果集的统计数据的分布
-filter 查询数据结果集里的特定范围的列表或者根据内容筛选
-save   根据筛选条件输出结果集
-force  忽略本地缓存,强行从API获取数据
-type   选择web或者host类型搜素

4. 数据的数量
通过参数-num,我们能够指定搜索和显示的数量,并且指定的数是消费量的数目。你能够在ZoomEye数据库里通过-count参数查询dork的容量,如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye search "telnet" -count
65746098

需要注意的一件事,-num参数必须是20的倍数,因为ZoomEye API的最小的单个查询数是20。

5. 统 计
我们使用-facet和-stat完成数据统计,使用-facet查询目标的全部数据(通过API获取)的统计查询,-stat你可以执行关于查询结果集的统计。两个命令支持的字段包括如下:

# host search
app        根据应用类型统计
device     根据设备类型统计
service    根据服务类型统计
os         根据操作系统类型统计
port       根据端口统计
country    根据国家统计
city       根据城市统计

# web search
webapp     根据Web应用统计
component  根据Web容器统计
framework  根据Web框架统计
server     根据Web服务器
waf        根据Web防火墙(WAF)统计
os         根据操作系统统计
country    根据国家统计

使用-facet所有应用类型为telnet的设备数量,如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye search 'telnet' -facet app
 ----------------------------------------
 ZoomEye total data:65746098
 ---------------app Top 10---------------
 app                                count               
 [unknown]                          29969901            
 BusyBox telnetd                    12133486            
 Linux telnetd                      3503698             
 MikroTik router config httpd       2008659             
 Cisco IOS telnetd                  1754507             
 Huawei Home Gateway telnetd        1452441             
 Apache httpd                       1400140             
 Huawei telnetd                     1139233             
 Busybox telnetd                    953442              
 Netgear broadband router or ZyXel VoIP adapter telnetd746826

使用-stat统计和查询应用类型为telnet的设备数量,如下:

(base) liuxiaowei@MacBookAir ~ % zoomeye search 'telnet' -stat app 
 ----------------------------------------
 current total data:20
 ----------------app data----------------
 app                                count               
 MikroTik router config httpd       8                   
 Cisco or Actiontec MI424WR router telnetd7                   
 [unknown]                          4                   
 ***************                    1

接下文 ZoomEye-python工具使用详解(二)https://developer.aliyun.com/article/1618397

相关文章
|
3月前
|
存储 缓存 测试技术
理解Python装饰器:简化代码的强大工具
理解Python装饰器:简化代码的强大工具
|
4月前
|
程序员 测试技术 开发者
Python装饰器:简化代码的强大工具
Python装饰器:简化代码的强大工具
229 92
|
5月前
|
数据安全/隐私保护 Python
微信群成员导出工具, 微信群成员导出软件, 微信群管理工具软件【python】
这个工具提供了完整的微信群成员导出功能,包括登录微信、获取群列表、导出成员信息到Excel等功能
|
3月前
|
机器学习/深度学习 编解码 Python
Python图片上采样工具 - RealESRGANer
Real-ESRGAN基于深度学习实现图像超分辨率放大,有效改善传统PIL缩放的模糊问题。支持多种模型版本,推荐使用魔搭社区提供的预训练模型,适用于将小图高质量放大至大图,放大倍率越低效果越佳。
286 3
|
4月前
|
人工智能 自然语言处理 安全
Python构建MCP服务器:从工具封装到AI集成的全流程实践
MCP协议为AI提供标准化工具调用接口,助力模型高效操作现实世界。
867 1
|
3月前
|
算法 安全 数据安全/隐私保护
Python随机数函数全解析:5个核心工具的实战指南
Python的random模块不仅包含基础的随机数生成函数,还提供了如randint()、choice()、shuffle()和sample()等实用工具,适用于游戏开发、密码学、统计模拟等多个领域。本文深入解析这些函数的用法、底层原理及最佳实践,帮助开发者高效利用随机数,提升代码质量与安全性。
726 0
|
4月前
|
API 数据安全/隐私保护 Python
拼多多批量上架软件, 电商一键上货发布工具,python电商框架分享
多线程批量上传架构,支持并发处理商品数据 完整的拼多多API签名和token管理机制
|
4月前
|
安全 API 数据安全/隐私保护
|
4月前
|
Java API 数据安全/隐私保护
淘宝一键上货发布软件,淘宝批量发布上架工具, 淘宝批量上架脚本【python】
这个Python脚本实现了以下功能: 完整的淘宝API调用封装
|
4月前
|
机器人 数据安全/隐私保护 Python
淘宝批量发货发布工具, 淘宝批量上传商品软件, 淘宝批量上架软件【python】
使用Selenium实现自动化操作淘宝卖家后台 支持三种核心功能

推荐镜像

更多