面向 React 和 Next.js 应用程序的 Web 应用安全评估框架
此工具仅用于授权安全测试。
用户须自行负责确保遵守所有适用法律。
React2Shell Scanner 是一个命令行安全评估框架,旨在帮助安全专业人员识别 React 和 Next.js Web 应用程序中的潜在漏洞。它专注于分析 React Server Components (RSC) 实现中的常见安全配置错误。
| 功能 | 描述 |
|---|---|
| 🎯 多目标扫描 | 扫描单个 URL 或目标列表 |
| 🔄 并发测试 | 多线程实现高效评估 |
| 🛡️ WAF 检测 | 识别并分析 WAF 响应 |
| 📊 进度跟踪 | 使用 tqdm 的可视化进度条 |
| 🔧 可配置请求头 | 自定义请求头注入 |
| 🌐 代理支持 | 通过 HTTP/HTTPS 代理路由 |
| 📝 输出格式 | 生成 JSON 和文本报告 |
| 🎨 彩色 CLI | 清晰、颜色编码的终端输出 |
# 克隆仓库
git clone https://github.com/wi3memake/React2Shell-Scanner.git
cd react2shell-scanner
# 创建虚拟环境(推荐)
python -m venv venv
source venv/bin/activate # Linux/Mac
.\venv\Scripts\activate # Windows
# 安装依赖
pip install -r requirements.txt
requests>=2.28.0 # HTTP 客户端库
tqdm>=4.64.0 # 进度条可视化
urllib3>=1.26.0 # URL 处理
# 单个目标
python react2shell.py.py -u https://example.com
# 详细输出
python react2shell.py.py -u https://example.com -v
# 从文件扫描
python react2shell.py.py -l targets.txt
# 使用并发线程
python react2shell.py.py -l targets.txt -t 10
# 自定义请求头
python react2shell.py.py -u https://example.com -H "Authorization: Bearer token"
# 通过代理
python react2shell.py.py -u https://example.com --proxy http://127.0.0.1:8080
# 跳过 SSL 验证
python react2shell.py.py -u https://example.com --no-verify
# 输出到文件
python react2shell.py.py -u https://example.com -o results.json
| 参数 | 简写 | 描述 | 默认值 |
|---|---|---|---|
--url | -u | 单个目标 URL | - |
--list | -l | 包含目标 URL 的文件 | - |
--threads | -t | 并发线程数 | 5 |
--timeout | - | 请求超时(秒) | 10 |
--proxy | - | 代理 URL(http/https) | - |
--headers | -H | 自定义请求头 | - |
--output | -o | 输出文件路径 | - |
--no-verify | - | 跳过 SSL 验证 | False |
--verbose | -v | 详细输出 | False |
--waf-bypass | - | WAF 绕过模式 | False |
--bypass-size | - | 绕过载荷大小(KB) | 128 |
React2Shell Web Application Security Assessment Framework
[*] Starting assessment of https://example.com
[*] Analyzing React Server Components...
[*] Testing redirect behavior...
[+] Assessment complete
Target: https://example.com
Status: Analyzed
Response Code: 200
Server: Next.js
React Version: 18.2.0
RSC Detected: Yes
Assessment Time: 1.23s
{
"target": "https://example.com",
"timestamp": "2025-01-15T10:30:00Z",
"results": {
"status_code": 200,
"server": "Next.js",
"rsc_detected": true,
"headers": {
"content-type": "text/html",
"x-powered-by": "Next.js"
},
"assessment_time": 1.23
}
}
React2Shell-Scanner/
├── react2shell.py.py # 主扫描脚本
├── requirements.txt # Python 依赖
└── README.md # 文档
创建一个文本文件,每行一个 URL:
https://target1.com
https://target2.com
https://target3.com/api
使用重复的 -H 标志传递多个请求头:
python react2shell.py.py -u https://example.com \
-H "Authorization: Bearer token123" \
-H "X-Custom-Header: value" \
-H "Cookie: session=abc123"
# HTTP 代理
--proxy http://127.0.0.1:8080
# HTTPS 代理
--proxy https://proxy.example.com:8443
# 需要认证的代理
--proxy http://user:[email protected]:8080
# GitHub Actions 示例
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run security scan
run: python react2shell.py.py -u ${{ secrets.TARGET_URL }} -o results.json
import subprocess
import json
# 运行扫描器
result = subprocess.run(
['python', 'react2shell.py.py', '-u', 'https://example.com', '-o', 'results.json'],
capture_output=True,
text=True
)
# 解析结果
with open('results.json') as f:
findings = json.load(f)
连接超时
# 增加超时时间
python react2shell.py.py -u https://example.com --timeout 30
SSL 证书错误
# 跳过验证(仅限测试)
python react2shell.py.py -u https://example.com --no-verify
速率限制
# 减少线程数
python react2shell.py.py -l targets.txt -t 2
我们欢迎以下方面的改进贡献:
请在 GitHub 上提交 issue 和 pull request。
本项目采用 MIT 许可证。
让安全测试更高效
🔒 始终负责任地测试 🔒