burhanmoin1/nextscope

GitHub: burhanmoin1/nextscope

一款基于真实浏览器拦截的 Next.js 及现代前端框架 API 端点发现工具,无需字典即可从 JS bundle 中提取隐藏接口。

Stars: 1 | Forks: 0

# nextscope — Next.js API 端点发现工具 🔭 ![Python](https://img.shields.io/badge/python-3.10%2B-blue) ![License](https://img.shields.io/badge/license-MIT-green) ![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey) ![Stars](https://img.shields.io/github/stars/burhanmoin1/nextscope?style=social) **nextscope** 是一款专为 Bug Bounty 猎人和渗透测试人员设计的 Next.js API 端点扫描器和 JavaScript bundle 侦察工具。它使用真实的 Chromium 浏览器抓取目标,在每个页面懒加载时拦截所有的 JS chunk,并直接从 bundle 中提取所有硬编码的 API 端点 —— 无需猜测,无需字典。 支持 **Next.js, React, Vue, Nuxt, Remix** 以及任何将路由编译到 bundle 中的现代 JS 框架。 ## 为什么 nextscope 优于字典扫描工具 | | nextscope | ffuf / dirsearch / gobuster | |---|---|---| | **方法** | 拦截真实的 JS chunk | 使用字典进行暴力破解 | | **误报** | 零 —— 仅包含真实端点 | 较多 | | **发现懒加载路由** | ✅ 是 | ❌ 否 | | **发现内部 API 路径** | ✅ 是 | ❌ 极少 | | **检测 bundle 中的敏感信息** | ✅ 即将推出 | ❌ 否 | | **需要字典** | ❌ 否 | ✅ 是 | | **产生大量噪音 (大量 404)** | ❌ 否 | ✅ 非常多 | ## 工作原理 现代 Web 应用会将所有的 API 路径字符串直接编译到其 JavaScript bundle 中。当用户浏览不同的页面时,不同的 chunk 会进行懒加载。`nextscope` 通过以下方式实现了这一过程的自动化: 1. 使用真实的 Chromium 浏览器抓取目标的所有内部页面 2. 在加载时实时拦截每一个 `.js` chunk 响应 3. 从字符串字面量和模板字面量中提取 `/api/...` 路径 4. 可选地探测每个发现的端点并报告 HTTP 状态码 ## 安装 ``` # 1. 克隆 repo git clone https://github.com/burhanmoin1/nextscope.git cd nextscope # 2. 安装 — 自动安装包括 Chromium 在内的依赖项 pip3 install playwright playwright install chromium ``` ## 使用方法 ``` # 基础 discovery python3 nextscope.py https://www.example.com # 带有 endpoint 探测 (检查 status codes) python nextscope.py https://www.example.com --probe # 将结果保存为 JSON python nextscope.py https://www.example.com --probe --output results.json # 爬取更多页面 (默认: 50) python nextscope.py https://www.example.com --max-pages 200 # 更快的爬取 (减少 delay) python nextscope.py https://www.example.com --delay 0.5 ``` ## 输出 ``` [001] https://www.example.com/ + /api/get-country/ ← main-abc123.js + /api/general-settings/ ← main-abc123.js [002] https://www.example.com/login + /api/login/ ← login-def456.js + /api/token/refresh/ ← login-def456.js + /api/signup/ ← login-def456.js ════════════════════════════════ RESULTS ════════════════════════════════ Pages crawled : 12 JS chunks : 34 Endpoints found: 47 All discovered endpoints: → /api/backup/ → /api/general-settings/ → /api/login/ ... ``` 使用 `--probe` 参数时: ``` PUBLIC GET /api/general-settings/ AUTH GET /api/me/ ERROR POST /api/backup/ FORBID GET /api/admin/ ``` ## 为什么这会奏效 `Content-Security-Policy` 响应头会暴露所有的 API 主机名。JS bundle 包含了所有的端点字符串。这两者都不需要身份验证即可读取 —— 它们在设计上就是公开的。这款工具将手动攻击者需要花费数分钟才能完成的工作实现了自动化。 ## 法律声明 仅供经授权的渗透测试和 Bug Bounty 项目使用。请勿对未经授权测试的系统使用本工具。
标签:API发现, API枚举, Bundle分析, Chromium, EndpointDiscovery, Python, React安全, Web安全, 前端安全, 实时处理, 数据展示, 无后门, 无字典, 浏览器拦截, 特征检测, 红队, 自动化爬虫, 蓝队分析, 路径扫描, 逆向工具