🔴 RedChain
Autonomous AI Red Team Agent
LangGraph-powered penetration testing pipeline with multi-LLM support, active exploitation, subdomain takeover detection, nuclei scanning, default credential testing, threat intelligence, and AI-generated kill chain reports.
## 目录
- [功能](#features)
- [架构](#architecture)
- [流水线阶段](#pipeline-phases)
- [安装](#installation)
- [快速入门](#quick-start)
- [Docker (推荐)](#docker-recommended-for-teams)
- [Kali Linux (最简单)](#kali-linux-easiest)
- [macOS](#macos)
- [Linux (Ubuntu/Debian)](#linux-ubuntudebian)
- [Linux (Arch)](#linux-arch)
- [Windows (WSL2)](#windows-wsl2)
- [配置](#configuration)
- [使用](#usage)
- [多 LLM 支持](#multi-llm-support)
- [报告格式](#report-formats)
- [插件系统](#plugin-system)
- [项目结构](#project-structure)
- [支持的语言](#supported-languages)
- [贡献](#contributing)
- [许可证](#license)
## 功能
| 功能 | 描述 |
|---------|-------------|
| 🤖 **AI Kill Chain 报告** | Gemini / GPT-4o / Ollama 生成的渗透测试叙述 |
| 🔍 **OSINT** | theHarvester, crt.sh, Amass, Shodan, Passive DNS, Google Dorks |
| 🌐 **子域名枚举** | 多工具发现与存活主机验证 |
| 🕸️ **Web 应用指纹识别** | WhatWeb, Nikto, Gobuster, WAF 检测 (wafw00f) |
| ⚡ **Nuclei 扫描** | 7000+ 模板,感知技术栈的模板选择 |
| 🎯 **子域名接管** | 20 项服务指纹数据库 (GitHub, AWS S3, Azure, Vercel…) |
| 🔑 **默认凭证测试** | SSH, FTP, HTTP Basic Auth, 表单登录 — 30 组顶级凭证对 |
| 🛡️ **漏洞扫描** | Nmap 深度扫描 + 20 个高价值脚本 (ssl-heartbleed, ftp-anon, smtp-relay…) |
| 🐛 **CVE 匹配** | 通过 cvemap、NVD、Vulners 进行版本规范化的 CVE 查询 |
| 🔮 **威胁情报** | VirusTotal, AbuseIPDB, GreyNoise — 完全接入流水线 |
| 📊 **合规性映射** | 针对每项发现的动态 OWASP Top 10 与 MITRE ATT&CK 映射 |
| 🌍 **10 种语言** | 支持 EN, ES, FR, DE, JA, ZH, AR, PT, KO, HI 报告 |
| 🔌 **插件系统** | 使用社区扫描器扩展 RedChain |
| 🐳 **Docker** | 一键部署,预装所有工具 |
| ⚡ **扫描配置** | Quick, Full, Stealth, Compliance 模式 |
| 🌐 **跨平台** | macOS, Linux, Windows WSL2 — 感知平台的 ping, proxy, paths |
## 架构
```
┌──────────┐ ┌───────────┐ ┌──────────┐ ┌────────┐ ┌─────────┐ ┌──────────┐ ┌──────┐ ┌────────┐
│ OSINT │─▶│ Subdomain │─▶│ Takeover │─▶│ WebApp │─▶│ Nuclei │─▶│ Scanner │─▶│ CVE │─▶│ Report │
│ Agent │ │ Agent │ │ Agent │ │ Agent │ │ Agent │ │ Agent │ │Agent │ │ Agent │
└──────────┘ └───────────┘ └──────────┘ └────────┘ └─────────┘ └──────────┘ └──────┘ └────────┘
│ │ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
theHarvester subfinder 20 CNAME wafw00f 7000+ nmap + cvemap Gemini/
crt.sh amass fingerprints whatweb templates 20 scripts NVD OpenAI/
Shodan Passive DNS nikto tech-aware ExploitDB+ Vulners Ollama
HackerTarget AXFR capture gobuster proxy/stealth proxychains PDF/MD/
GreyNoise DNS/HTTP/ping aware aware JSON/CSV
VT/AbuseIPDB checks
```
由 **LangGraph** 编排,每个节点具有错误隔离、状态验证和优雅降级功能。
## 流水线阶段
| 阶段 | Agent | 功能描述 |
|-------|-------|-------------|
| **1** | `osint_agent` | theHarvester, crt.sh, Amass, Shodan, Passive DNS (HackerTarget), Google Dorks, AXFR 区域传输捕获,威胁情报 (VT/AbuseIPDB/GreyNoise) |
| **2** | `subdomain_agent` | subfinder + 存活主机验证 (DNS → Ping → HTTP),跨平台 ping |
| **2.5** | `takeover_agent` | 检查 20 项云服务 (GitHub Pages, AWS S3, Heroku, Azure, Netlify, Vercel, Shopify 等) 的悬空 CNAME 接管 |
| **3** | `webapp_agent` | WAF 检测 (wafw00f),技术栈指纹识别,漏洞扫描,目录暴力破解 |
| **3.5** | `nuclei_agent` | 模板化扫描 — 根据技术栈自动选择模板 (WordPress→wordpress, Jenkins→default-logins…),支持代理/隐秘模式感知 |
| **4** | `scanner_agent` | 具有 20+ 脚本的 Nmap 深度扫描 (ssl-heartbleed, ftp-anon, smtp-open-relay, ms-sql-info, ldap-rootdse…),ExploitDB + GHDB 映射 |
| **4.5** | `credential_agent` | 使用 30 组顶级默认凭证对测试 SSH, FTP, HTTP Basic Auth 和 Web 表单 |
| **5** | `cve_agent` | 版本规范化的 CVE 查询 (将 `7.4p1` 截断为 `7.4`),通过 cvemap 查询,带有 NVD/Vulners 备用方案 |
| **6** | `report_agent` | AI Kill Chain 叙述,动态 MITRE ATT&CK 映射,OWASP 映射,PDF/MD/JSON/CSV |
## 安装
### 快速入门
```
git clone https://github.com/Beast000009/redchain.git
cd redchain
pip install . # Installs 'redchain' as a system command
cp .env.example .env # Add your API keys
redchain update # Install/update all external tools
redchain man # View full manual
redchain scan -t scanme.nmap.org --no-scope-check # Test scan
```
### Docker (推荐团队使用)
所有工具均已预装。无需系统设置。
```
# 克隆并配置
git clone https://github.com/Beast000009/redchain.git
cd redchain
cp .env.example .env
# 构建镜像(约4GB,包含 nmap, nikto, gobuster, subfinder, nuclei 等)
docker build -t redchain .
# 运行扫描
docker run --rm -v ./reports:/app/reports --env-file .env \
redchain scan -t target.com --no-scope-check
# 或者使用 Docker Compose
docker compose run --rm redchain scan -t target.com --no-scope-check
# 在容器内查看手册
docker run --rm redchain man
```
### Kali Linux (最简单)
Kali 预装了**大部分工具** (nmap, nikto, whatweb, amass, gobuster, theharvester, seclists, whois, dnsutils)。
```
# 更新系统
sudo apt update && sudo apt upgrade -y
# 安装任何缺失的工具
sudo apt install -y python3-venv subfinder wafw00f
# 安装 Go 工具
go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
nuclei -update-templates
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
# 克隆并设置 RedChain
git clone https://github.com/Beast000009/redchain.git
cd redchain
python3 -m venv .venv
source .venv/bin/activate
pip install .
# 可选:SSH 凭证测试支持
pip install paramiko
# 配置 API keys
cp .env.example .env
nano .env
# 验证
redchain scan --help
```
### macOS
#### 前置条件
```
# 安装 Homebrew(如果尚未安装)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 安装 Python 3.11+ 和 Go
brew install python@3.12 go
```
#### 第 1 步 — 安装系统工具
```
# 核心扫描工具
brew install nmap amass subfinder gobuster
# Python 工具
pip3 install theHarvester wafw00f
# 通过 Ruby gem 安装 WhatWeb
brew install whatweb || sudo gem install whatweb
# Nikto
brew install nikto
# SecLists 字典
brew install seclists
```
#### 第 2 步 — 安装 Go 工具
```
# 将 Go bin 添加到 PATH
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# CVE 查询
go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest
# Subfinder
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
# Nuclei(模板化扫描 — 强烈推荐)
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
nuclei -update-templates
```
#### 第 3 步 — 设置 RedChain
```
git clone https://github.com/Beast000009/redchain.git
cd redchain
python3 -m venv .venv
source .venv/bin/activate
pip install .
# 可选:SSH 凭证测试
pip install paramiko
cp .env.example .env
# 使用你的 API keys 编辑 .env
redchain --help
redchain scan --help
```
### Linux (Ubuntu/Debian)
#### 第 1 步 — 系统依赖
```
sudo apt update && sudo apt install -y \
python3 python3-pip python3-venv \
nmap \
amass \
nikto \
whatweb \
gobuster \
theharvester \
subfinder \
seclists \
git curl wget \
dnsutils whois \
golang-go \
ruby ruby-dev \
libpango1.0-dev libcairo2-dev libgdk-pixbuf2.0-dev
```
#### 第 2 步 — 安装 Python 工具
```
pip3 install wafw00f theHarvester paramiko
```
#### 第 3 步 — 安装 Go 工具
```
echo 'export PATH="$HOME/go/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
go install github.com/OJ/gobuster/v3@latest
go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
nuclei -update-templates
```
#### 第 4 步 — 设置 RedChain
```
git clone https://github.com/Beast000009/redchain.git
cd redchain
python3 -m venv .venv
source .venv/bin/activate
pip install .
cp .env.example .env
# 使用你的 API keys 编辑 .env
redchain --help
```
### Linux (Arch)
```
# 系统工具
sudo pacman -S python python-pip nmap nikto whois dnsutils go git ruby curl wget
# AUR 工具(通过 yay)
yay -S amass subfinder gobuster whatweb seclists
# Python 工具
pip install wafw00f theHarvester paramiko
# Go 工具
go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest
go install github.com/projectdiscovery/nuclei/v3/cmd/nuclei@latest
nuclei -update-templates
# 设置 RedChain
git clone https://github.com/Beast000009/redchain.git
cd redchain
python -m venv .venv
source .venv/bin/activate
pip install .
cp .env.example .env
redchain --help
```
### Windows (WSL2)
RedChain 在 **WSL2** 上原生运行。并非所有工具都支持完全的 Windows 原生运行。
#### 第 1 步 — 安装 WSL2
```
# 在 PowerShell 中以管理员身份运行
wsl --install -d Ubuntu-24.04
```
重启计算机,然后从“开始”菜单打开 **Ubuntu**。
#### 第 2 步 — 遵循 Linux 设置步骤
在 WSL2 中,请遵循上述的 [Linux (Ubuntu/Debian)](#linux-ubuntudebian) 说明。
#### 第 3 步 — Docker 替代方案 (更简单)
如果你启用了 **Docker Desktop for Windows** 的 WSL2 后端:
```
git clone https://github.com/Beast000009/redchain.git
cd redchain
docker build -t redchain .
docker run --rm -v ./reports:/app/reports --env-file .env redchain scan -t target.com --no-scope-check
```
## 配置
### API Keys (`.env`)
将 `.env.example` 复制到 `.env` 并添加你的 API 密钥。**所有密钥均为可选** — RedChain 会跳过缺少密钥的集成。
```
cp .env.example .env
```
```
# LLM Provider(选择一个)
GEMINI_API_KEY=your_key_here # Google AI Studio → https://aistudio.google.com/apikey
OPENAI_API_KEY=your_key_here # OpenAI → https://platform.openai.com/api-keys
# LLM 选择
LLM_PROVIDER=gemini # gemini | openai | ollama
# LLM_MODEL=gemini-2.5-flash # 覆盖默认模型
# 安全工具
SHODAN_API_KEY=your_key_here # https://account.shodan.io
VULNERS_API_KEY=your_key_here # https://vulners.com
NVD_API_KEY=your_key_here # https://nvd.nist.gov/developers/request-an-api-key
# 威胁情报(这三个现在已全部在流水线中使用)
VIRUSTOTAL_API_KEY=your_key_here # https://www.virustotal.com/gui/my-apikey
ABUSEIPDB_API_KEY=your_key_here # https://www.abuseipdb.com/account/api
GREYNOISE_API_KEY=your_key_here # https://viz.greynoise.io/account/api-key
```
### 范围文件 (`scope.json`)
定义授权目标。支持精确匹配、通配符、CIDR 和排除项:
```
{
"allowed": [
"example.com",
"*.staging.example.com",
"192.168.1.0/24",
"10.0.0.1"
],
"excluded": [
"prod.example.com",
"10.0.1.5"
]
}
```
使用 `--no-scope-check` 绕过 (仅限授权测试)。
## 使用
### 命令概述
```
redchain --help # Show top-level commands
redchain scan --help # Full scan options
redchain man # Full interactive manual
redchain update # Install/update all tools
```
### `redchain scan` — 所有标志
| 标志 | 简写 | 默认值 | 描述 |
|------|-------|---------|-------------|
| `--target` | `-t` | — | 单个目标:域名、IP、CIDR 或 URL |
| `--file` | `-f` | — | 包含目标的文件路径,每行一个 |
| `--output` | `-o` | `both` | `pdf \| md \| json \| csv \| both` |
| `--profile` | `-p` | `full` | `quick \| full \| stealth \| compliance` |
| `--ports` | — | `0` (自动) | `50 \| 100 \| 200 \| 1000` |
| `--threads` | — | `10` | 并发工作线程数 |
| `--llm-provider` | — | `gemini` | `gemini \| openai \| ollama` |
| `--llm-model` | — | auto | 覆盖模型名称 |
| `--language` | `-l` | `en` | 报告语言 |
| `--proxy` | — | — | `http://` 或 `socks5://` 代理 |
| `--wordlist` | `-w` | built-in | 用于 Gobuster 的自定义字典 |
| `--stealth` | `-s` | false | 启用隐秘模式 |
| `--no-scope-check` | — | false | 绕过范围验证 |
| `--config` | `-c` | `.env` | 自定义环境文件路径 |
### 目标类型
```
# 域名
redchain scan -t example.com
# IP 地址
redchain scan -t 192.168.1.10
# IPv6
redchain scan -t "2001:db8::1"
# CIDR 范围(扫描所有主机)
redchain scan -t 10.0.0.0/24
# URL(自动剥离至域名)
redchain scan -t https://example.com/login?id=1
# 子域名
redchain scan -t api.staging.example.com
# 从文件读取多个目标(每行一个)
redchain scan -f targets.txt
# 绕过范围检查(用于授权测试)
redchain scan -t example.com --no-scope-check
```
### 扫描配置
```
# quick — 跳过 OSINT,最小化 nmap,前 50 个端口(约 2 分钟)
redchain scan -t example.com --profile quick
# full — 所有阶段,前 200 个端口(默认,约 10-15 分钟)
redchain scan -t example.com --profile full
# stealth — 慢速计时,感知 WAF,低线程,前 100 个端口
redchain scan -t example.com --profile stealth
# compliance — 完整扫描 + OWASP/NIST 映射侧重
redchain scan -t example.com --profile compliance
# 混合:quick 流水线但彻底的端口扫描
redchain scan -t example.com --profile quick --ports 1000
# 包含全部 1000 个端口的完整流水线
redchain scan -t example.com --profile full --ports 1000
```
### 端口控制
```
# 前 50 个端口(约 30 秒/主机)— 最快
redchain scan -t 10.0.0.0/24 --ports 50
# 前 100 个端口(约 1 分钟/主机)
redchain scan -t example.com --ports 100
# 前 200 个端口(约 2 分钟/主机)— 配置文件默认值
redchain scan -t example.com --ports 200
# 全部 1000 个端口(约 5-10 分钟/主机)— 最深入
redchain scan -t example.com --ports 1000
```
### 输出格式
```
# 仅 Markdown
redchain scan -t example.com --output md
# 仅 JSON(用于流水线/SIEM 集成)
redchain scan -t example.com --output json
# 仅 CSV(用于电子表格导入)
redchain scan -t example.com --output csv
# 仅 PDF
redchain scan -t example.com --output pdf
# PDF + Markdown(默认)
redchain scan -t example.com --output both
```
### LLM 提供商
```
# Gemini(默认)— 需要在 .env 中配置 GEMINI_API_KEY
redchain scan -t example.com --llm-provider gemini
# 使用特定模型的 Gemini
redchain scan -t example.com --llm-provider gemini --llm-model gemini-2.0-flash
# OpenAI GPT-4o — 需要在 .env 中配置 OPENAI_API_KEY
redchain scan -t example.com --llm-provider openai
# 使用更便宜模型的 OpenAI
redchain scan -t example.com --llm-provider openai --llm-model gpt-4o-mini
# Ollama — 完全离线,无需 API key
ollama pull llama3.1
redchain scan -t example.com --llm-provider ollama
# 使用自定义模型的 Ollama
redchain scan -t example.com --llm-provider ollama --llm-model mistral
# 无 API key — 仍会生成完整的原始 MD/JSON/CSV 报告
redchain scan -t example.com --output md # raw report, no AI narrative
```
### 报告语言
```
redchain scan -t example.com --language en # English (default)
redchain scan -t example.com --language es # Español
redchain scan -t example.com --language fr # Français
redchain scan -t example.com --language de # Deutsch
redchain scan -t example.com --language ja # 日本語
redchain scan -t example.com --language zh # 中文
redchain scan -t example.com --language ar # العربية
redchain scan -t example.com --language pt # Português
redchain scan -t example.com --language ko # 한국어
redchain scan -t example.com --language hi # हिन्दी
```
### 代理与隐秘模式
```
# 通过 Tor 路由(匿名扫描)
redchain scan -t example.com --proxy socks5://127.0.0.1:9050
# 通过 Burp Suite 代理路由(用于人工审查)
redchain scan -t example.com --proxy http://127.0.0.1:8080
# 企业代理
redchain scan -t example.com --proxy http://proxy.corp.local:3128
# Stealth 配置 + 代理 + 低线程(最大程度规避)
redchain scan -t example.com --profile stealth --proxy socks5://127.0.0.1:9050 --threads 2
# 仅 Stealth 标志(无代理)
redchain scan -t example.com --stealth
```
### 自定义字典 (目录爆破)
```
# SecLists common.txt
redchain scan -t example.com -w /usr/share/seclists/Discovery/Web-Content/common.txt
# 大型目录字典
redchain scan -t example.com -w /usr/share/wordlists/dirb/big.txt
# 特定于 API 的字典
redchain scan -t example.com -w /usr/share/seclists/Discovery/Web-Content/api/api-endpoints.txt
# Kali SecLists 路径
redchain scan -t example.com -w /usr/share/seclists/Discovery/Web-Content/raft-large-directories.txt
```
### 自定义配置与范围
```
# 使用不同的 .env 文件(例如:特定客户的密钥)
redchain scan -t client.com --config /path/to/client.env
# 使用自定义范围文件
# (首先编辑 scope.json,然后在不加 --no-scope-check 的情况下运行)
redchain scan -t staging.client.com # validated against scope.json
# 强制绕过范围检查,用于实验/授权渗透测试
redchain scan -t scanme.nmap.org --no-scope-check
```
### 并发
```
# 默认 10 个线程
redchain scan -t example.com
# Aggressive — 更多并行任务(在大型 CIDR 上更快)
redchain scan -t 10.0.0.0/24 --threads 30
# Conservative — 适用于 stealth 或缓慢的目标
redchain scan -t example.com --threads 3
# 单线程(调试)
redchain scan -t example.com --threads 1
```
### 强力组合 (实际场景)
```
# Bug bounty — 快速侦察,用于工具链的 JSON 输出
redchain scan -t target.com --profile quick --output json --no-scope-check
# 使用 Gemini AI 生成法语 PDF 报告的完整外部渗透测试
redchain scan -t client.com --profile full --output pdf --language fr
# 内部网络扫描 — CIDR 中的所有主机,全部 1000 个端口
redchain scan -t 192.168.1.0/24 --profile full --ports 1000 --threads 20
# 红队交战 — stealth,Tor 代理,合规报告
redchain scan -t bank.com \
--profile stealth \
--proxy socks5://127.0.0.1:9050 \
--output both \
--language en \
--threads 2
# 隔离实验室 — Ollama LLM,无互联网,markdown 报告
redchain scan -t 10.10.10.10 \
--llm-provider ollama \
--llm-model llama3.1 \
--output md \
--no-scope-check
# 合规审计 — 完整范围,侧重 OWASP/NIST,PDF+JSON
redchain scan -t corp.internal \
--profile compliance \
--output both \
--language en \
--ports 200
# 针对特定 API 端点的快速检查
redchain scan -t https://api.example.com/v2 \
--profile quick \
--output json \
--no-scope-check
```
### Docker 使用
```
# 最小化扫描(无 API keys)
docker run --rm -v ./reports:/app/reports \
redchain scan -t scanme.nmap.org --no-scope-check --profile quick
# 使用 .env 文件中的 API keys
docker run --rm \
-v ./reports:/app/reports \
--env-file .env \
redchain scan -t example.com --no-scope-check
# 使用 Docker 包含所有选项的完整渗透测试
docker run --rm \
-v ./reports:/app/reports \
-v ./scope.json:/app/scope.json \
--env-file .env \
redchain scan -t example.com \
--profile full \
--output both \
--language ja \
--ports 200
# Docker Compose
docker compose run --rm redchain scan -t example.com --no-scope-check
# 在容器内运行手册
docker run --rm redchain man
# 在容器内查看帮助
docker run --rm redchain scan --help
# 在容器内检查工具版本
docker run --rm --entrypoint="" redchain sh -c \
"nmap --version; nuclei -version; subfinder -version"
```
### 更新与维护
```
# 安装 / 更新所有外部工具
# (gobuster, cvemap, subfinder, nuclei + 模板, nikto, whatweb)
redchain update
# 检查已安装的工具
redchain scan --help # runs deps check automatically before scan
# 拉取最新的 Nikto 签名
git -C /opt/nikto pull # (Linux/macOS)
# 手动更新 nuclei 模板
nuclei -update-templates
# 验证 Python 包健康状况
pip show redchain
```
## 多 LLM 支持
| 提供商 | 模型 (默认) | 需要 API Key | 离线使用 |
|----------|----------------|------------------|---------|
| **Gemini** | `gemini-2.5-flash` | ✅ `GEMINI_API_KEY` | ❌ |
| **OpenAI** | `gpt-4o` | ✅ `OPENAI_API_KEY` | ❌ |
| **Ollama** | `llama3.1` | ❌ 无 | ✅ 离线隔离 |
```
# Gemini(默认)
redchain scan -t target.com --llm-provider gemini
# OpenAI
redchain scan -t target.com --llm-provider openai --llm-model gpt-4o-mini
# Ollama(本地,不需要互联网)
ollama pull llama3.1
redchain scan -t target.com --llm-provider ollama
```
## 报告格式
| 格式 | 标志 | 内容 |
|--------|------|----------|
| **PDF** | `--output pdf` | 带有严重性徽章的专业样式报告 |
| **Markdown** | `--output md` | 完整的叙述 + 表格 + 接管/nuclei/凭证部分 |
| **JSON** | `--output json` | 机器可读的结构化数据,包含所有最新发现 |
| **CSV** | `--output csv` | 适合电子表格的漏洞列表 |
| **Both** | `--output both` | PDF + Markdown (默认) |
报告包括:
- 执行摘要 (AI 生成)
- Kill Chain 叙述
- 攻击路径 ASCII 图表
- 带有 CVSS 评分的 CVE 发现
- **Nuclei 模板扫描发现**
- **子域名接管漏洞** (包含 CNAME 详情)
- **默认凭证命中** (用户名/密码表)
- OWASP Top 10 映射 (关键字驱动)
- MITRE ATT&CK 技术映射 (动态,按每次发现)
- 带有优先级的修复计划
- Web 应用指纹识别详情 (Nikto, Gobuster)
## 插件系统
使用社区插件扩展 RedChain。将 `.py` 文件放入 `~/.redchain/plugins/` 中:
```
from plugins import RedChainPlugin
class MasscanPlugin(RedChainPlugin):
name = "masscan_scanner"
description = "Fast port scanning with masscan"
version = "1.0.0"
phase = "scan" # osint | scan | exploit | report | post
def run(self, state):
# Your scanning logic here
return {"masscan_results": [...]}
def get_requirements(self):
return ["masscan"]
```
插件在启动时会被自动发现。
## 项目结构
```
redchain/
├── cli.py # CLI entry point (Typer)
├── config.py # Configuration (Pydantic Settings)
├── utils.py # Cross-platform utilities (ping, proxy, paths)
├── models.py # Pydantic data models
├── agents/
│ ├── osint_agent.py # Phase 1: OSINT + Threat Intel + Passive DNS
│ ├── subdomain_agent.py # Phase 2: Subdomain enumeration (cross-platform)
│ ├── takeover_agent.py # Phase 2.5: Subdomain takeover (20 services) ← NEW
│ ├── webapp_agent.py # Phase 3: Web app fingerprinting
│ ├── nuclei_agent.py # Phase 3.5: Nuclei templated scanning ← NEW
│ ├── scanner_agent.py # Phase 4: Nmap + ExploitDB (disk-cached)
│ ├── credential_agent.py # Phase 4.5: Default credential testing ← NEW
│ ├── cve_agent.py # Phase 5: CVE matching (version-normalized)
│ ├── report_agent.py # Phase 6: AI report + dynamic MITRE mapping
│ └── threat_intel.py # VirusTotal / AbuseIPDB / GreyNoise
├── orchestrator/
│ └── graph.py # LangGraph pipeline (9-phase)
├── llm/
│ ├── __init__.py # LLM adapter factory
│ ├── gemini_adapter.py # Google Gemini
│ ├── openai_adapter.py # OpenAI / Azure
│ └── ollama_adapter.py # Ollama (offline)
├── i18n/
│ └── __init__.py # 10-language support
├── plugins/
│ ├── __init__.py # Plugin base class
│ └── loader.py # Auto-discovery
├── report/
│ └── generator.py # PDF/MD/JSON/CSV generation
├── tests/ # Unit tests
├── Dockerfile # Container support
├── docker-compose.yml # One-command deployment
├── requirements.txt # Python dependencies
├── pyproject.toml # Linting & tooling config
├── .env.example # API key template
└── scope.json # Authorized targets
```
## 支持的语言
| 代码 | 语言 | 标志 |
|------|----------|------|
| `en` | English | `--language en` |
| `es` | Español | `--language es` |
| `fr` | Français | `--language fr` |
| `de` | Deutsch | `--language de` |
| `ja` | 日本語 | `--language ja` |
| `zh` | 中文 | `--language zh` |
| `ar` | العربية | `--language ar` |
| `pt` | Português | `--language pt` |
| `ko` | 한국어 | `--language ko` |
| `hi` | हिन्दी | `--language hi` |
## 贡献
有关开发设置、插件编写和 PR 指南,请参见 [CONTRIBUTING.md](CONTRIBUTING.md)。
## 安全
有关漏洞报告和负责任的使用政策,请参见 [SECURITY.md](SECURITY.md)。
## 许可证
[MIT 许可证](LICENSE) — 详情请参见 [LICENSE](LICENSE)。
## ⚠️ 免责声明
RedChain 专为**授权安全测试**设计。在扫描任何目标之前,请务必获取**书面许可**。未经的扫描是非法的。作者不对本工具的滥用行为负责。