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

本文涉及的产品
Web应用防火墙 3.0,每月20元额度 3个月
简介: 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

相关文章
|
1月前
|
存储 安全 数据安全/隐私保护
打造安全防线!Python AES&RSA加密工具,黑客绕道走的秘籍
【9月更文挑战第9天】随着数字化时代的到来,信息安全问题日益凸显。本文将介绍如何使用Python结合AES与RSA两种加密算法,构建强大的加密工具。AES以其高效性和强安全性著称,适用于大量数据的快速加密;RSA作为非对称加密算法,在加密小量数据及实现数字签名方面表现卓越。通过整合两者,可以构建既安全又灵活的加密系统。首先,需要安装pycryptodome库。接着,实现AES加密与解密功能,最后利用RSA加密AES密钥,确保其安全传输。这种设计不仅提高了数据传输效率,还增强了密钥交换的安全性,为敏感数据提供坚实保护。
180 43
|
4天前
|
数据处理 开发者 Python
Python编程中的列表推导式:简洁而强大的工具
【9月更文挑战第35天】在Python的众多特性中,列表推导式以其简明扼要和强大功能脱颖而出。本文不仅将介绍列表推导式的基础知识,还将探讨其背后的逻辑,并辅以实际代码示例。无论你是初学者还是有经验的开发者,都能从中获取新的见解和应用技巧。
14 5
|
10天前
|
测试技术 Python
Python MagicMock: Mock 变量的强大工具
Python MagicMock: Mock 变量的强大工具
25 8
|
15天前
|
Python
python第三方库-字符串编码工具 chardet 的使用(python3经典编程案例)
这篇文章介绍了如何使用Python的第三方库chardet来检测字符串的编码类型,包括ASCII、GBK、UTF-8和日文编码的检测示例。
45 6
|
1月前
|
Python
Python的编辑工具-Jupyter notebook实战案例
这篇博客介绍了Jupyter Notebook的安装和使用方法,包括如何在本地安装Jupyter、启动和使用Jupyter Notebook进行编程、文档编写和数据分析,以及如何执行和管理代码单元(Cell)的快捷键操作。
35 4
Python的编辑工具-Jupyter notebook实战案例
|
1天前
|
存储 缓存 JSON
ZoomEye-python工具使用详解(二)
ZoomEye-python工具使用详解(二)
11 0
|
1天前
|
安全 网络安全 数据安全/隐私保护
Python渗透测试之流量分析:流量嗅探工具编程
Python渗透测试之流量分析:流量嗅探工具编程
10 0
|
1天前
|
缓存 监控 程序员
Python装饰器:深入探索功能增强的神奇工具(特点+应用+举例)
Python装饰器:深入探索功能增强的神奇工具(特点+应用+举例)
5 0
|
1天前
|
程序员 Python 容器
python 中的 collections 模块:常用数据结构和工具详解
python 中的 collections 模块:常用数据结构和工具详解
5 0
|
24天前
|
机器学习/深度学习 算法 开发工具
Python Web开发工具
Python Web开发工具
18 3