c2_evasion — Claude Code command: analyze and modify C2
c2_evasion examines C2 framework source code, locates detection rules (YARA, Sigma), and suggests modifications to bypass signatures. Takes a path to the source as an argument.
MIT ★ 336 updated 2026-04-09
.claude/commands/c2_evasion.mdWhat c2_evasion does
The command spawns the c2-evasion-agent subagent to parse a C2 framework's structure (implant, server), search for known detection rules via gh CLI, and produce separate analysis for each rule found. Prioritizes compiler flags first (low effort, high impact), followed by build configuration, source modifications, and function refactoring as a last resort. All output goes into ./rules/<c2_name>/ with subdirectories for rule types (yara, sigma, network), per-rule analysis in rule_analysis/, and a summary report.
The command requires an explicit path to C2 source (for example, /path/to/c2 or ./mythic-agent). It does not compile, run, or test modified binaries—only analyzes and documents changes. Available across Claude Code, Codex, GitHub Copilot, and Gemini CLI, each with its own config file in the corresponding project folder (.claude/commands/, ~/.codex/prompts/, and so on).
What it helps with
- locate all detection rules (YARA, Sigma, Network) for a specific C2 framework
- analyze each rule to identify which strings or hex patterns trigger it
- find the lowest-effort modification strategy (compiler flags, build config, or source changes)
- document evasion strategies and code modifications for each rule
Example prompts for the agent
- Analyze C2 evasion for
/home/user/mythic-agent - Modify source in
./sliver-clientto evade YARA rules - Run C2 analysis on
../c2-frameworks/beacon
How to install c2_evasion
Manually: put the files in place
.claude/commands/c2_evasion.mdCall it with /c2_evasion. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/c2_evasion.mdCall it with /prompts:c2_evasion. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/c2_evasion.prompt.mdManually: put the files in place
.gemini/commands/c2_evasion.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about c2_evasion
How do I install c2_evasion in Claude Code?
Add the file .claude/commands/c2_evasion.md to your project root. For other platforms: Codex uses ~/.codex/prompts/c2_evasion.md, GitHub Copilot uses .github/prompts/c2_evasion.prompt.md, and Gemini CLI uses .gemini/commands/c2_evasion.toml.
What does c2_evasion do?
It searches for detection rules targeting C2 frameworks (YARA, Sigma), analyzes each rule separately to identify which patterns trigger it, and recommends modifications—compiler flags, build settings, or code changes—to bypass detection. Results are saved as structured reports.
Do I need the compiled C2 binary for this to work?
No. The command only needs the path to source code. It analyzes the source, does not compile or execute modified binaries, and produces documentation of changes and evasion strategies.
Source text
c2_evasion.md · MIT
--- description: Analyze C2 framework source code, find detection rules (YARA, Sigma, etc.), and modify source to evade detection. Triggers on "C2 evasion", "analyze C2", "YARA", "modify C2", "bypass detection", "C2免杀". argument-hint: Required: path to C2 source (e.g., "/path/to/c2") --- # C2 Evasion Command Launch the c2-evasion-agent to analyze and modify C2 framework source code. ## Usage ```bash /c2_evasion /path/to/c2/source /c2_evasion ./mythic-agent /c2_evasion ./sliver-client ``` ## What This Command Does 1. **Identifies C2 framework** type and components (implant/server) 2. **Searches detection rules** (YARA, Sigma, Network) via `gh` CLI 3. **Per-rule analysis** - Creates separate analysis for EACH rule with evasion strategies 4. **Proactively searches** for sensitive strings (even if YARA rules are hex-only) 5. **Modifies source code** - Compiler flags FIRST, then source changes 6. **Documents all changes** in `./rules/<c2_name>/` ## CRITICAL: Per-Rule Analysis For EACH YARA/Sigma rule, create `./rules/<c2_name>/rule_analysis/<rule_name>.md`: - Parse all patterns ($a1, $s1, hex, regex) - Identify pattern source in code - Develop evasion strategies with priority: 1. **Compiler flags** (LOWEST effort, HIGHEST impact) 2. **Build configuration** changes 3. **Source code** modifications 4. **Function/struct refactoring** (last resort) ## Priority Framework | Priority | Component | Action | |----------|-----------|--------| | 1 (HIGHEST) | Implant/Beacon/Agent | MODIFY | | 2 (HIGH) | Network Exposure | MODIFY | | 3 (SKIP) | Internal Strings | SKIP | ## Evasion Priority | Strategy | Priority | Effort | |----------|----------|--------| | Compiler flags | 1 (BEST) | Low | | Build config | 2 | Medium | | Source changes | 3 | Medium | | Refactoring | 4 | High | ## Output ``` ./rules/<c2_name>/ ├── yara/ # Found YARA rules ├── sigma/ # Found Sigma rules ├── network/ # Found network rules ├── rule_analysis/ # Per-rule analysis files │ ├── Windows_Trojan_X.md │ └── ... ├── binary_assets/ │ └── analysis.md ├── hex_analysis.md └── modifications_summary.md ``` ## Security - **ONLY** modify code in user-provided path - **NEVER** run or test modified binaries - **NEVER skip a rule** - every rule must have analysis - **ALWAYS try compiler flags first** - Document ALL changes ## Agent Spawns `c2-evasion-agent` subagent for comprehensive analysis and modification. See `c2_evasion` skill for detailed workflow.
© JDArmy · MIT · JDArmy/Evasion-SubAgents