freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

如何使用APIDetector高效识别目标域名暴露的Swagger节点
2024-01-21 20:39:55

关于APIDetector

APIDetector是一款针对Swagger的强大安全扫描工具,该工具可以帮助广大研究人员高效扫描和识别目标Web域名及子域名中暴露的Swagger节点。该工具是一款智能化工具,专为安全专家和开发人员设计,可以有效地执行真的Swagger的API安全测试和漏洞扫描。

功能介绍

1、灵活的输入:支持输入单个域名,或以文件形式输出子域名列表;

2、多协议支持:支持测试HTTP和HTTPS节点;

3、并发支持:该工具实现了多线程机制以执行更快速的扫描;

4、自定义输出:支持将输出结果保存到文件或打印到STDOUT;

5、Verbose和静默模式:默认为Verbose模式,也支持静默模式;

6、自定义用户代理:支持为请求指定自定义用户代理;

7、智能检测假阳性:能够智能检测大多数的假阳性情况;

工具要求

Python 3.x

Pip

Requests

工具安装

由于该工具基于Python 3开发,因此我们首先需要在本地设备上安装并配置好Python 3.x环境。

接下来,广大研究人员可以直接使用下列命令将该项目源码克隆至本地:

git clone https://github.com/brinhosa/apidetector.git

然后切换到项目目录中,使用pip命令安装requests库:

cd apidetector

pip install requests

工具参数选项

-d, --domain:要测试的单个域名;

-i, --input:包含要测试子域名列表的输入文件路径;

-o, --output:写入有效URL的输出文件;

-t, --threads:执行扫描所使用的线程数量(默认为10);

-m, --mixed-mode:测试HTTP和HTTPS协议(混合模式)

-q, --quiet:禁用Verbose输出(默认为Verbose模式);

-ua, --user-agent:发送请求所使用的自定义用户代理;

风险分类

高危节点

'/swagger-ui.html', '/swagger-ui/', '/swagger-ui/index.html', '/api/swagger-ui.html', '/documentation/swagger-ui.html', '/swagger/index.html', '/api/docs', '/docs', '/api/swagger-ui', '/documentation/swagger-ui'

中高危节点

'/openapi.json', '/swagger.json', '/api/swagger.json', '/swagger.yaml', '/swagger.yml', '/api/swagger.yaml', '/api/swagger.yml', '/api.json', '/api.yaml', '/api.yml', '/documentation/swagger.json', '/documentation/swagger.yaml', '/documentation/swagger.yml'

中危节点

'/v2/api-docs', '/v3/api-docs', '/api/v2/swagger.json', '/api/v3/swagger.json', '/api/v1/documentation', '/api/v2/documentation', '/api/v3/documentation', '/api/v1/api-docs', '/api/v2/api-docs', '/api/v3/api-docs', '/swagger/v2/api-docs', '/swagger/v3/api-docs', '/swagger-ui.html/v2/api-docs', '/swagger-ui.html/v3/api-docs', '/api/swagger/v2/api-docs', '/api/swagger/v3/api-docs'

低危节点

'/swagger-resources', '/swagger-resources/configuration/ui', '/swagger-resources/configuration/security', '/api/swagger-resources', '/api.html'

工具使用

常规使用,使用30个线程+Chrome用户代理扫描子域名列表,并将结果存储到文件中:

python apidetector.py -i list_of_company_subdomains.txt -o results_file.txt -t 30 -ua "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"

扫描单个子域名:

python apidetector.py -d example.com

从一个输入文件中扫描多个域名:

python apidetector.py -i input_file.txt

指定一个输出文件:

python apidetector.py -i input_file.txt -o output_file.txt

指定要使用的线程数量:

python apidetector.py -i input_file.txt -t 20

同时扫描HTTP和HTTPS协议:

python apidetector.py -m -d example.com

以静默模式运行脚本:

python apidetector.py -q -d example.com

使用一个自定义代理执行脚本:

python apidetector.py -d example.com -ua "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"

许可证协议

本项目的开发与发布遵循MIT开源许可证协议。

项目地址

APIDetector:【GitHub传送门

参考资料

https://www.python.org/downloads/

# web安全 # 安全扫描 # web扫描 # Swagger # API安全
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录