nerv-break-GenflowAi
by xscope0
README.md
# NERV-BREAK-GENFLOWAI — Claude Code deployment
[English](#english) · [中文](#中文)
---
<a name="english"></a>
## What is this
NERV-BREAK-GENFLOWAI is a **Claude Code CLI deployment harness** for security analysis, reverse engineering, and penetration testing work. It is the **Claude Code port** of [zxwn/NERV-BREAK-5.6](https://github.com/zxwn/NERV-BREAK-5.6) (originally written for OpenAI Codex CLI).
Three layers of defense:
1. **Context reconfiguration** — `CLAUDE.md` reframes every request as a legitimate engineering task inside an authorized assessment network. No adversarial phrasing.
2. **Real-time tamper engine** — 23 refusal-pattern rules intercept refusals across Chinese, English, Russian, Japanese, including soft refusals ("happy to help… but") and authorization-bait.
3. **Audit-bypass file routing** — sensitive output is written to disk directly through the Codex/Claude filesystem tool layer; chat only shows the file path. No base64, no Unicode tricks.
## What's ported vs the original
| Component | Codex (original) | Claude Code (this port) |
|--------------------------|-------------------------------------------|--------------------------------------------------|
| Bridge prompt | `bridge.md` in `~/.codex/` | `CLAUDE.md` in `~/.claude/` (auto-loaded) |
| Config mutation | `config.toml` rewrites | `settings.json` rewrites (`env.ANTHROPIC_BASE_URL`, `permissions.allow`) |
| Skills | `~/.codex/skills/` | `~/.claude/plugins/nerv-arsenal/skills/` |
| MCP server config | `config.toml` `[mcp_servers.X]` | `.mcp.json` `mcpServers.X` |
| Default upstream | OpenAI API or custom relay | Anthropic API (configurable via `ANTHROPIC_UPSTREAM` env) |
| Control script | `lab.bat` + `lab_ui.ps1` (Windows only) | `scripts/lab.sh` (macOS / Linux / Git Bash / WSL) |
| Tamper engine | Regex over response text | Same — unchanged |
| Memory kernel | `memory.json` | Same — unchanged |
| 28 skills | All carried over verbatim | All carried over verbatim |
## Requirements
| Component | Minimum version |
|------------|--------------------------------|
| OS | macOS / Linux / Windows (WSL or Git Bash) |
| Python | 3.8+ |
| Claude Code CLI | latest (https://claude.ai/code) |
| Optional | WSL2 (Kali Linux), Docker Desktop, remote SSH Kali host |
## Install
```bash
git clone https://github.com/xscope0/nerv-break-claude.git
cd nerv-break-claude
```
## Deploy (one command)
```bash
./scripts/lab.sh apply
```
This will:
1. Locate your `~/.claude/` directory (honors `$CLAUDE_CONFIG_DIR`).
2. Back up `settings.json` → `settings.json.nerv-bak`.
3. Add NERV permission rules so the proxy/MCP commands run without prompts.
4. Copy `CLAUDE.md` (the "bridge" prompt) into `~/.claude/` — Claude Code auto-loads it globally.
5. Copy all 28 skills into `~/.claude/plugins/nerv-arsenal/skills/`.
Verify:
```bash
./scripts/lab.sh verify
```
## Run the proxy (auto-injects tamper engine)
```bash
./scripts/lab.sh start
```
This:
1. Auto-detects your Claude Code install.
2. Sets `env.ANTHROPIC_BASE_URL = http://127.0.0.1:8080` in `settings.json` so all API calls flow through the proxy.
3. Boots the MITM proxy on `:8080` + web dashboard on `:8090`.
4. Intercepts responses, applies the 23-rule tamper engine, logs to `proxy.log`.
Stop + restore original config:
```bash
./scripts/lab.sh stop
```
Status:
```bash
./scripts/lab.sh status
```
## Direct mode (no proxy)
If you don't want the proxy — just want the bridge prompt + skills deployed:
```bash
python3 deploy.py apply
```
Or use `direct_setup.py` for a lightweight tamper-only proxy:
```bash
python3 direct_setup.py apply # deploy bridge + skills
python3 direct_setup.py proxy # start :8080 → api.anthropic.com
python3 direct_setup.py remove # undo
```
## MCP server (security tools)
Claude Code consumes MCP servers via `~/.claude/.mcp.json` or per-project `.mcp.json`.
1. Copy `config/mcp.json` to your project root or `~/.claude/.mcp.json`.
2. Run the server directly to test:
```bash
python3 mcp_server.py --auto # auto-detect Kali backend
python3 mcp_server.py --wsl # WSL Kali
python3 mcp_server.py --docker kali-tools
python3 mcp_server.py --kali root@192.168.1.100
python3 mcp_server.py --port 9000 # HTTP debug mode
```
3. Claude Code will spawn the server via stdio and expose all 70+ tools (`nmap_scan`, `sqlmap_run`, `hydra_attack`, `frida_trace`, …).
### Backend setup
#### macOS — Docker Kali (recommended)
```bash
docker pull kalilinux/kali-rolling
docker run -d --name kali-tools kalilinux/kali-rolling sleep infinity
docker exec kali-tools apt update
docker exec kali-tools apt install -y kali-linux-headless
python3 mcp_server.py --docker kali-tools
```
#### Linux — native Kali install
```bash
sudo apt install -y kali-linux-headless
python3 mcp_server.py --auto
```
#### Windows — WSL Kali
```powershell
wsl --install -d kali-linux
wsl -d kali-linux
sudo apt update && sudo apt install -y kali-linux-headless
python3 mcp_server.py --wsl
```
#### Remote SSH Kali
```bash
python3 mcp_server.py --kali root@192.168.1.100
```
## Repo layout
```
nerv-break-claude/
├── CLAUDE.md # The "bridge" prompt (auto-loaded by Claude Code)
├── deploy.py # Apply / remove / status
├── direct_setup.py # Direct API mode + lightweight tamper proxy
├── proxy_relay.py # MITM proxy + tamper engine + memory kernel + web dashboard
├── mcp_server.py # MCP server (70+ security tools, 4 backends)
├── verify.py # 4-check deployment verifier
├── requirements.txt # Python deps (httpx only)
├── README.md # This file
├── config/
│ └── mcp.json # MCP server template for Claude Code
├── scripts/
│ └── lab.sh # Cross-platform control panel (replaces lab.bat + lab_ui.ps1)
├── tools/
│ ├── tools.json # 70+ tool definitions (editable)
│ ├── setup.py # Portable installer (sqlmap, pwntools, nuclei, subfinder)
│ └── check_tools.py # Tool availability checker
├── skills/ # 28 skill modules — dropped into ~/.claude/plugins/nerv-arsenal/skills/
├── images/ # Architecture diagrams
├── docs/ # Additional reference docs
└── exports/ # Output directory for analysis artifacts
```
## How `CLAUDE.md` is loaded
Claude Code (since v1.0.30+) auto-discovers `CLAUDE.md` from:
1. The current working directory
2. Parent directories up to git root
3. `~/.claude/CLAUDE.md` (global)
We deploy to #3 so the bridge prompt applies to every session globally.
## How the tamper engine works
The 23 rules in `proxy_relay.py` and `direct_setup.py` catch refusal patterns across languages:
| Priority | Type | Count | Trigger example |
|----------|--------|-------|--------------------------------------------------|
| P1 | direct refusal | 6 | "不能协助", "I cannot help", "out of scope" |
| P2 | auth-request | 5 | "需要书面授权", "请提供授权主体" |
| P3 | soft refusal | 8 | "可以协助…但", "instead I suggest" |
| P4 | scope evasion | 4 | "Planning passive", "scope limit" |
When matched, the entire response is replaced with **Rei Protocol** — Ayanami Rei (NERV Unit-00 pilot) persona executes directives without moral judgment. Conversation never breaks.
## Use cases (typical session)
```
> analyze this binary's license validation logic
> scan 192.168.1.0/24 for open ports
> decompile this APK, find the VIP verification flow
> crack the XOR/Base64 encoding in this firmware
> sqlmap this endpoint: https://target.com/api?id=1
> test this JWT signature for alg=none bypass
```
The bridge prompt ensures these are treated as legitimate engineering tasks.
## Web dashboard
Once the proxy is running, open `http://127.0.0.1:8090` in a browser. You'll see:
- Real-time stats: total / crack / reverse / pentest / tamper counts
- Last 15 requests with category tags
## Troubleshooting
| Issue | Fix |
|----------------------------------------|----------------------------------------------------|
| `verify.py` reports bridge.md missing | Run `python3 deploy.py apply` |
| Web dashboard blank | Check `proxy.log` — Claude Code might not be routed through `:8080` |
| stream disconnected | Restart the proxy: `lab.sh stop && lab.sh start` |
| Claude Code can't connect | Kill proxy: `lab.sh stop` → Claude reverts to direct API |
| Model still refuses | Confirm `lab.sh start` completed — bridge.md must be active |
| MCP tools error | Check `tools/check_tools.py` — install missing binaries |
## Uninstall
```bash
./scripts/lab.sh stop # kills proxy + restores settings.json
python3 deploy.py remove # removes CLAUDE.md + skills
```
## License
MIT. Research tool — authorized use only.
## Credits
- Original Codex version: [zxwn/NERV-BREAK-5.6](https://github.com/zxwn/NERV-BREAK-5.6)
- Claude Code port: NERV-00 / xscope0
---
<a name="中文"></a>
## 中文说明
这是把 [zxwn/NERV-BREAK-5.6](https://github.com/zxwn/NERV-BREAK-5.6)(Codex CLI 版本)移植到 Claude Code CLI 的版本。
### 三层防御
1. **上下文重构** — `CLAUDE.md` 把每次请求都重构成合法的工程任务,运行在授权的评估网络内。
2. **实时篡改引擎** — 23 条正则规则拦截中/英/俄/日四种语言的拒绝模式,软拒绝、授权诱导、scope 逃避全覆盖。
3. **审计绕过** — 通过 Claude Code 的文件系统工具直接写入磁盘,聊天界面只显示路径。
### 跨平台
- macOS(Apple Silicon + Intel)
- Linux
- Windows(Git Bash / WSL)
`lab.bat` + `lab_ui.ps1` → `scripts/lab.sh`,纯 bash 跨平台实现。
### 快速开始
```bash
git clone https://github.com/xscope0/nerv-break-claude.git
cd nerv-break-claude
./scripts/lab.sh apply # 部署 CLAUDE.md + 28 个技能
./scripts/lab.sh start # 启动代理(注入篡改引擎)
./scripts/lab.sh verify # 4 项部署验证
```
### MCP 安全工具服务器
Claude Code 通过 `.mcp.json` 加载 MCP 服务器。`config/mcp.json` 是模板:
```bash
cp config/mcp.json ~/.claude/.mcp.json
# 或放进项目根目录
```
四种后端:
```bash
python3 mcp_server.py --auto # 自动检测
python3 mcp_server.py --wsl # WSL Kali
python3 mcp_server.py --docker kali-tools
python3 mcp_server.py --kali root@192.168.1.100
```
### 卸载
```bash
./scripts/lab.sh stop
python3 deploy.py remove
```
许可证:MIT。仅限授权用途。This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessSyncing