cc1a2b/APIHunter
GitHub: cc1a2b/APIHunter
APIHunter 是一款用 Go 编写的综合性 API 发现与安全测试工具,通过多来源 endpoint 提取和八大类安全检查帮助安全研究人员发现隐藏 API 及其漏洞。
Stars: 0 | Forks: 0
# APIHunter
*APIHunter — 发现 API,进行指纹识别,扫描它们。*
## 📑 目录
- [关于](#-about)
- [功能](#-features)
- [安装](#-installation)
- [快速开始](#-quick-start)
- [用法示例](#-usage-examples)
- [命令参考](#-command-reference)
- [高级用法](#-advanced-usage)
- [贡献](#-contributing)
- [许可证](#-license)
- [支持](#-support)
## ✨ 功能
### 🎯 核心能力
- **🔍 多源 API 发现**:JavaScript (AST + 正则表达式)、OpenAPI v2/v3、Android APK、HAR 流量、实时爬取
- **🔐 身份验证指纹识别**:Bearer token、API 密钥、会话 cookie — 以及角色分离(管理员/用户/公开)
- **🛡️ 八大安全检查类别**:IDOR、身份验证绕过、大规模赋值、速率限制、GraphQL、CORS、HTTP 走私、OpenAPI 不匹配
- **⚡ 高性能扫描**:具有可配置速率限制和超时的并发 worker pool
- **🎭 隐秘操作**:代理支持、自定义 worker、为敏感任务刻意调整请求节奏
### 🧠 智能发现引擎
- **🎯 基于 AST 的 JavaScript 解析**:捕捉正则表达式会遗漏的 `fetch()`、`axios`、`XMLHttpRequest`、GraphQL 查询
- **🏢 移动应用提取**:直接从 Android APK 文件中提取 endpoint
- **🧠 版本检测**:识别路径、header 或查询参数中的 API 版本
- **📊 环境泄漏检测**:在发现的 endpoint 中揭示开发、预发布和生产环境
### 🔐 安全扫描套件
### 🌐 HTTP 与网络
### 📤 输出与报告
## 📦 安装
### Go Install(推荐)
```
go install -v github.com/cc1a2b/APIHunter/cmd/apihunter@latest
apihunter --help
```
### 从源码构建
```
git clone https://github.com/cc1a2b/APIHunter.git
cd APIHunter
go build -o apihunter ./cmd/apihunter
```
### 二进制发布
从 [Releases](https://github.com/cc1a2b/APIHunter/releases) 页面下载预构建的二进制文件。
### 系统要求
- **Go 1.21+**(用于从源码构建)
- **Linux、macOS 或 Windows**(64 位)
- 对目标的**网络访问权限**
## 🚀 快速开始
### 从 JavaScript 提取 API
```
apihunter extract --js https://target.com/app.js -o endpoints.json
```
### 从 OpenAPI / HAR 提取
```
apihunter extract --openapi swagger.json -o endpoints.json
apihunter extract --har traffic.har -o endpoints.json
```
### 运行完整的安全扫描
```
apihunter scan \
-u https://api.target.com \
--js \
--idor --auth --rate \
-o report.json
```
## 💡 用法示例
```
# 基础发现与扫描
apihunter scan -u https://api.target.com --js --idor --auth --rate -o report.json
# 认证扫描
apihunter scan \
-u https://api.target.com \
--auth-token "Bearer eyJ..." \
--idor --mass \
-o report.json
# 多目标扫描
apihunter scan \
-l targets.txt \
--graphql --cors \
-o report.json
# 通过 Burp 进行隐秘扫描
apihunter scan \
-u https://api.target.com \
--js --idor --auth --rate --graphql --cors \
--stealth \
--proxy http://127.0.0.1:8080 \
--workers 50 \
--rate-limit 10 \
--timeout 8s \
--format json \
-o report.json
# 移动应用 endpoint 提取
apihunter extract --apk app.apk -o mobile-endpoints.json
```
## 📋 命令参考
```
Usage:
apihunter [flags]
Commands:
extract Pull endpoints from a source without scanning
scan Discover + scan target(s)
version Show version
Input Sources:
-u, --url URL Target URL
-l, --targets-file FILE File of target URLs
--js Extract from JavaScript bundles
--openapi FILE Parse OpenAPI v2/v3 spec
--har FILE Parse HAR traffic capture
--apk FILE Extract from Android APK
Security Checks:
--idor IDOR detection
--auth Auth bypass detection
--mass Mass assignment detection
--rate Rate limiting tests
--graphql GraphQL introspection + depth tests
--cors CORS misconfiguration checks
--smuggle HTTP smuggling header confusion
--openapi-mismatch Compare OpenAPI vs live behaviour
HTTP & Performance:
--auth-token TOKEN Authorization header value
--workers INT Concurrent worker pool (default: 50)
--rate-limit INT Max requests per second
--timeout DUR Per-request timeout (e.g. 8s)
--proxy URL HTTP/HTTPS/SOCKS proxy
--stealth Slower, evasive scanning
Output:
--format FMT table | json | burp
-o, --output FILE Output path
-v, --verbose Detailed output
-h, --help Show help
```
## 🔧 高级用法
### 漏洞赏金工作流
```
# 1. 发现所有内容
apihunter extract --js https://target.com/app.js -o js-apis.json
apihunter extract --har capture.har -o har-apis.json
# 2. 使用完整 check suite 扫描合并集
apihunter scan -l discovered.txt \
--idor --auth --mass --rate --graphql --cors --smuggle --openapi-mismatch \
--proxy http://127.0.0.1:8080 \
--workers 30 --rate-limit 5 \
-o full-report.json
# 3. 仅使用提升的 auth tokens 重新运行 IDOR
apihunter scan -l discovered.txt \
--idor --auth-token "Bearer $LOW_PRIV_TOKEN" \
-o idor-report.json
```
### CI / 持续发现
```
# 合并到 main 分支时进行每日扫描
apihunter scan -u https://api.staging.example.com \
--js --openapi-mismatch --cors --rate \
--format json -o "scan-$(date +%F).json"
```
## 📄 许可证
APIHunter 在 **MIT License** 下发布。详情请参阅 [LICENSE](https://github.com/cc1a2b/APIHunter/blob/main/LICENSE)。
```
Copyright (c) 2025-2026 Hussain Alsharman
Licensed under MIT License — free for commercial and personal use
```
[](LICENSE)
[](https://golang.org)
[](https://github.com/cc1a2b/APIHunter/releases)
[](https://github.com/cc1a2b/APIHunter/stargazers)
[](https://github.com/cc1a2b/APIHunter/releases)
**🛰️ 全面的 API 发现与安全测试**
*发现隐藏的 API,指纹识别身份验证模型,并揭示 IDOR、大规模赋值、GraphQL、CORS 和 HTTP 走私漏洞 — 专为漏洞赏金猎人、红队和安全研究人员打造。*
## 📖 关于
**APIHunter** 是一个使用 Go 编写的全面 API 发现和安全测试工具。它从 JavaScript bundle、OpenAPI/Swagger 规范、Android APK、HAR 抓包和实时爬取中提取 endpoint — 然后对其发现的所有内容运行针对性的安全检查(IDOR、身份验证绕过、大规模赋值、速率限制、GraphQL 内省、CORS 配置错误、HTTP 走私、OpenAPI 不匹配)。
映射到真实漏洞赏金的八大检查类别
**授权与访问:** - **🔑 IDOR 检测** (`--idor`):针对发现的 endpoint 进行不安全的直接对象引用检查 - **🎫 身份验证绕过** (`--auth`):受保护路由上缺失或可选的身份验证 - **🔥 大规模赋值** (`--mass`):接受额外的 JSON 字段以进行权限提升 **速率与数量:** - **⏱️ 速率限制** (`--rate`):突发和基于 token 的速率限制测试 - **📋 GraphQL** (`--graphql`):开启内省、缺失深度限制、批量查询滥用 - **🛡️ CORS** (`--cors`):通配符来源、带有凭证的通配符配置错误 **协议层:** - **🔗 HTTP 走私** (`--smuggle`):Header 混淆漏洞检查 - **📊 OpenAPI 不匹配** (`--openapi-mismatch`):文档与实际情况对比,以发现影子 endpoint生产级 HTTP 层
- **🔗 代理支持** (`--proxy`):Burp Suite 和其他拦截代理 - **⚡ 并发 Worker** (`--workers`):可调的 worker pool,默认 50 - **⏱️ 速率限制** (`--rate-limit`):每秒请求数上限 - **⏰ 自定义超时** (`--timeout`):单次请求超时调整 - **🎭 隐秘模式** (`--stealth`):更慢、随机化的请求节奏 - **🔧 Auth Token** (`--auth-token`):用于已认证扫描的 Bearer / API 密钥 header为三种受众提供的三种格式
- **🖥️ 表格**(默认):颜色编码的控制台输出 - **📊 JSON** (`--format json`):适用于自动化 pipeline 的机器可读格式 - **🔴 Burp Suite 导出**:直接导入以进行后续手动测试标签:API安全, CISA项目, EVTX分析, Go, JSON输出, Ruby工具, 主机安全, 密码管理, 日志审计