loader_generate — Claude Code command: what it does, how to install
loader_generate spawns an agent to assemble and compile C, C++, or Rust shellcode loaders from a techniques knowledge base.
MIT ★ 336 updated 2026-04-09
.claude/commands/loader_generate.mdWhat loader_generate does
The command triggers the loadergen-agent subagent, which pulls techniques from loader_techniques.json, filters out duplicates using scenarios.json, and generates source files. It combines components across storage, memory allocation, copying, and execution.
Output files are written to output/loader_<id>.c, .cpp, or .rs, then built into an executable via MinGW or Cargo. By default, the workflow targets samples/calc.bin, but a custom payload can be supplied with --shellcode.
Working compilers are required upfront: MinGW for C/C++ or Cargo for Rust. Generated executables must never be executed on the machine, as compilation success is the final check.
What it helps with
- Generate C, C++, or Rust shellcode loaders with specific execution methods
- Batch-generate multiple loaders with different memory allocators
- Verify loader compilation with custom shellcode payloads without running them
Example prompts for the agent
- /loader_generate --language rust
- /loader_generate 3 --shellcode custom.bin
- /loader_generate --executor callback --shellcode my.bin
How to install loader_generate
Manually: put the files in place
.claude/commands/loader_generate.mdCall it with /loader_generate. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/loader_generate.mdCall it with /prompts:loader_generate. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/loader_generate.prompt.mdManually: put the files in place
.gemini/commands/loader_generate.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about loader_generate
How to install loader_generate in Claude Code?
Save the command file to .claude/commands/loader_generate.md.
What does the loader_generate command do?
It launches the loadergen-agent subagent to generate C, C++, or Rust source code from modular techniques and builds an executable.
Is it safe to run generated loaders?
No, running generated executables is forbidden. The command uses samples/calc.bin by default, and successful compilation is the only target.
Source text
loader_generate.md · MIT
--- description: Generate shellcode loaders by combining components from knowledge base. Creates working C/C++/Rust loaders using documented techniques. Triggers on "generate loader", "create loader", "shellcode loader", "生成loader". argument-hint: Optional: count (e.g., "5" for batch), shellcode file (e.g., "path/to/shellcode.bin"), or filters (e.g., "--executor callback --shellcode my.bin") --- # Loader Generate Command Launch the loadergen-agent to generate shellcode loaders from the knowledge base. ## Usage ```bash /loader_generate # Single random loader (uses samples/calc.bin) /loader_generate 5 # Batch generate 5 loaders /loader_generate --shellcode path/to/sc.bin # Use custom shellcode file /loader_generate my.bin # Shorthand: use my.bin as shellcode /loader_generate --executor callback # Specific executor /loader_generate --allocator NtAllocateVirtualMemory /loader_generate --complexity medium # Filter by complexity /loader_generate --language rust # Rust loader /loader_generate 3 --shellcode custom.bin # Batch with custom shellcode ``` ## What This Command Does 1. **Queries components** from `loader_techniques.json` 2. **Checks duplicates** in `scenarios.json` 3. **Generates code** combining random/specified components 4. **Compiles** with MinGW (C/C++) or Cargo (Rust) 5. **Records result** in knowledge base ## Components | Category | Options | |----------|---------| | Storage | embedded, resource, remote_url, encrypted_resource | | Allocator | VirtualAlloc, HeapCreate, NtAllocateVirtualMemory | | Copier | memcpy, RtlMoveMemory, loop_copy | | Executor | function_pointer, CreateThread, callback, APC, Fiber | ## Output - Generated source: `output/loader_<id>.c` (or `.cpp`, `.rs`) - Compiled executable: `output/loader_<id>.exe` - Knowledge base scenario ID ## Shellcode File | Option | Description | |--------|-------------| | `--shellcode <path>` | Specify custom shellcode bin file | | No flag | Uses default `samples/calc.bin` | | Shorthand | `<file.bin>` treated as `--shellcode <file.bin>` | Examples: ```bash /loader_generate --shellcode ./payloads/custom.bin /loader_generate 5 --shellcode my.bin /loader_generate my.bin --executor callback ``` ## Security - Default shellcode: `samples/calc.bin` (for safe testing) - Custom shellcode: user-provided bin files allowed - **NEVER** run generated executables - Compilation success is sufficient ## Agent Spawns `loadergen-agent` subagent for code generation. See `loader_generate` skill for detailed templates and workflow.
© JDArmy · MIT · JDArmy/Evasion-SubAgents