轻量级检测工具,用于识别 React 服务端组件和 Next.js 应用程序
RSC-Detect 是一个简洁、专注的工具,用于识别使用 React 服务端组件 (RSC) 和 Next.js 框架的网站。它适用于:
# 克隆
git clone https://github.com/vijay-shirhatti/RSC-Detect-CVE-2025-55182.git
cd rsc-detect
# 安装
pip install -r requirements.txt
# 运行
python main.py
requests)编辑 main.py 中的 targetList:
if __name__ == "__main__":
targetList = [
"https://example.com",
"https://another-site.com",
]
for urlItem in targetList:
analyzeTarget(urlItem)
python main.py
Analyzing target: https://example.com
[Framework Indicators] Detected: ['__NEXT_DATA__', '/_next/static/']
[Framework Headers] Detected: ['x-powered-by: next.js']
Analyzing target: https://another-site.com
No framework indicators detected
1. 向目标 URL 发送 HTTP GET 请求
2. 解析 HTML 内容和响应头
3. 与已知指示器进行模式匹配
4. 报告结果
HTML_RSC_PATTERNS = [
'__flight__', # RSC 流式标记
'react-server-streaming', # 服务端流式指示器
'__REACT_SERVER_APP__', # RSC 应用标志
]
CONTENT_TYPE_RSC_PATTERNS = [
'text/x-component', # RSC 内容类型
'text/vnd.rsc', # 供应商 RSC 类型
'application/x-react-server-component', # 完整 RSC MIME
]
HTML_NEXTJS_PATTERNS = [
"__NEXT_DATA__", # Next.js 数据水合
"/_next/static/", # 静态资源路径
"/_next/data/", # 数据获取路由
"next-head", # Head 组件
"next-font", # 字体优化
"next/script", # Script 组件
]
RSC-Detect-CVE-2025-55182/
├── main.py # 主检测脚本
├── requirements.txt # Python 依赖
└── README.md # 文档
targetList = [
"https://site1.com",
"https://site2.com",
"https://site3.com/app",
]
# 添加新的 RSC 模式
HTML_RSC_PATTERNS.append('your-custom-pattern')
# 添加新的 Next.js 模式
HTML_NEXTJS_PATTERNS.append('custom-next-indicator')
# 修改请求超时时间(默认:10 秒)
httpResponse = requests.get(targetUrl, timeout=30)
def loadTargetsFromFile(filepath):
with open(filepath, 'r') as f:
return [line.strip() for line in f if line.strip()]
if __name__ == "__main__":
targetList = loadTargetsFromFile('targets.txt')
for urlItem in targetList:
analyzeTarget(urlItem)
import json
def analyzeTargetJson(targetUrl):
results = {
'url': targetUrl,
'rsc_markers': [],
'content_types': [],
'nextjs_html': [],
'nextjs_headers': []
}
try:
httpResponse = requests.get(targetUrl, timeout=10)
htmlContentLower = httpResponse.text.lower()
headersContentLower = str(httpResponse.headers).lower()
results['rsc_markers'] = [p for p in HTML_RSC_PATTERNS if p.lower() in htmlContentLower]
results['content_types'] = [p for p in CONTENT_TYPE_RSC_PATTERNS if p.lower() in headersContentLower]
results['nextjs_html'] = [p for p in HTML_NEXTJS_PATTERNS if p.lower() in htmlContentLower]
results['nextjs_headers'] = [p for p in HEADER_NEXTJS_PATTERNS if p.lower() in headersContentLower]
except Exception as e:
results['error'] = str(e)
return results
# 使用
results = [analyzeTargetJson(url) for url in targetList]
print(json.dumps(results, indent=2))
from concurrent.futures import ThreadPoolExecutor
def scanConcurrently(targets, maxWorkers=5):
with ThreadPoolExecutor(max_workers=maxWorkers) as executor:
executor.map(analyzeTarget, targets)
# 添加重试逻辑
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
session = requests.Session()
retries = Retry(total=3, backoff_factor=0.5)
session.mount('https://', HTTPAdapter(max_retries=retries))
# 禁用 SSL 验证(不推荐用于生产环境)
httpResponse = requests.get(targetUrl, timeout=10, verify=False)
# 处理不同编码
httpResponse.encoding = httpResponse.apparent_encoding
本工具旨在用于:
在扫描不属于你的目标之前,请务必确保已获得许可。
requests>=2.28.0
urllib3>=1.26.0
欢迎贡献!你可以通过以下方式提供帮助:
MIT 许可证 — 免费用于个人和商业用途。
简单 • 快速 • 高效
⭐ 觉得有用就点个星吧!
| 分类 | 检测模式 |
|---|
| 🔵 RSC 标记 | __flight__, react-server-streaming, __REACT_SERVER_APP__ |
| 📄 Content-Type | text/x-component, text/vnd.rsc, application/x-react-server-component |
| ⚡ Next.js HTML | __NEXT_DATA__, /_next/static/, next-font, next/script |
| 📋 响应头 | x-powered-by: next.js |
| 框架 | 检测率 | 备注 |
|---|
| Next.js 13+ | 高 | 存在多种指示器 |
| Next.js 12 | 高 | __NEXT_DATA__ 可靠 |
| React RSC | 中等 | 取决于实现 |
| 自定义 React | 低 | 需要自定义模式 |