ropcatalog is a post-extraction x86/x64 ROP gadget finder and structured catalogue for exploit development. It consumes dumps from rp++, ROPgadget, and Ropper, then makes useful gadgets fast to find, compare, and reuse.
This is a post-processing layer for gadget extractors, not another disassembler or symbolic execution engine. ropcatalog filters unstable and bad-character addresses, normalizes extractor records, and removes duplicate gadgets per module. Use the interactive REPL while building an exploit, concise commands in shell pipelines, or bounded JSONL when a script or AI agent needs a small deterministic candidate set.
Built during an OffSec journey, primarily for the EXP-301 and EXP-401 courses focused on Windows exploit development and ROP-chain construction.
- Query by exact instructions, regex, or exploit intent such as
pivot reg,copy rax,writeptr rcx, andsyscall. - Filter bad-character addresses and normally unstable instruction sequences.
- Format selected addresses for Python, C++, or JavaScript exploit code, including ASLR-relative expressions.
- Parse multiple modules once and save a reusable catalog for low-latency queries.
- Give scripts and agents bounded JSONL output, stable gadget IDs, source provenance, and deterministic artifacts.
ropcatalog does not scan binaries. Use your preferred gadget extractor, then pass its text output to ropcatalog.
Install from GitHub with uv:
uv tool install git+https://github.com/n3rada/ropcatalog.gitPython 3.10 or later is required.
Or run it once without installing:
uvx --from git+https://github.com/n3rada/ropcatalog.git ropcatalog --helpFor a Windows rp++ dump, start the REPL with bad-character filtering and Python output:
rp-win.exe -f "C:\target\libeay32IBM019.dll" --va=0 -r 5 > libeay32IBM019.txt
ropcatalog libeay32IBM019.txt -b '\x00\x09\x0a\x0b\x0c\x0d\x20' --offset --style pythonOn Linux, query ROPgadget output directly without an intermediate file:
ROPgadget --binary /usr/lib/x86_64-linux-gnu/libc.so.6 | ropcatalog --stdin-module libc.so.6 --address-kind rva --command 'pop rdi'Add --jsonl and --limit when another process consumes the result:
ROPgadget --binary ./target | ropcatalog --stdin-module target --address-kind rva --query 'pop rdi ; ret' --jsonl --limit 5 | jq 'select(.status == "ok") | .gadgets[] | {id, address, raw}'Ropper works through the same pipe:
ropper --file ./target --nocolor | ropcatalog --stdin-module target --address-kind rva --query 'pop rdi ; ret' --jsonl --limit 5Pass a file or a directory of extractor output to enter the REPL:
ropcatalog ./gadgets/ --offset --style pythonRun help in the REPL for the complete command list. Common operations include:
| Goal | Commands | Example |
|---|---|---|
| Exact, partial, or regex search | ?, /, . |
? pop rax ; ret |
| Memory displacement search | memoff |
memoff rbx+0x20 |
| Move or preserve a value | copy, copyto, save, saveto |
copyto r9 |
| Set or modify a register | zero, neg, not, inc, dec, add, sub, swap |
neg eax |
| Read or write memory | read, writereg, writeptr, writeimm, writebyte |
writeptr rax |
| Find stack operations | push, pop, pushad, popad, ppr, pivot |
pivot reg |
| Find control transfers | ret, jump, call, syscall, transition |
call rax |
Append /v to restrict command results to volatile registers. Append /n to include candidates rejected by normal stability filtering. Modifiers can appear in either order.
For a single shell-friendly operation, use --command:
ropcatalog target.txt --command 'pivot reg'
ropcatalog target.txt --command 'pop eax' --style pythonThe available output styles are plain, python, cpp, and js. With --offset, virtual addresses become base-relative expressions suitable for targets with ASLR:
rop += pack("<L", ba__target + 0x10001000) # pop eax ; ret [target]The machine interface is designed to avoid repeatedly loading a large gadget dump into context. Parse once, request only the fields needed for the current decision, and retain stable IDs for follow-up queries or chain changes.
--batch accepts one UTF-8 request per line. Plain lines are exact gadget queries. JSON objects support exact queries, named commands, and stable-ID lookup:
pop rdi ; ret
{"id":"pivot","command":"pivot reg"}
{"id":"arg0","command":"pop rdi"}ropcatalog target.txt --batch requests.jsonl --jsonl --limit 10Each response reports the total match count, bounded results, deterministic instruction-count ranking, and an explicit failure when no candidate exists. Gadget records contain source provenance, architecture, address kind, opcode bytes, normalized instructions, and copy-paste output.
Use --fields to reduce output volume:
ropcatalog target.ropcatalog --batch requests.jsonl --jsonl --fields id,module,address,rawSave extractor output in ropcatalog.catalog.v1 format:
ROPgadget --binary ./target | ropcatalog --stdin-module target --address-kind rva --catalog-out target.ropcatalogUse --serve when a long-running process needs many sequential requests. The catalog stays in memory and one flushed JSON response is emitted for each input line:
ropcatalog target.ropcatalog --serve --fields id,module,address,address_kind,rawBy default, --jsonl writes only JSONL to standard output and suppresses routine diagnostics. --artifact-dir writes module-named .ropcatalog.jsonl files instead of printing results. --verbose intentionally restores diagnostic text and cannot be combined with --artifact-dir.
ropcatalog target.txt --batch requests.jsonl --jsonl --artifact-dir artifactsDefault stability filtering removes candidates that are normally unsuitable inside a chain:
- conditional or uncontrolled control transfers;
- interrupts, traps, halts, and privileged instructions;
- oversized
retnstack adjustments.
Bad-character filtering applies to each gadget address. Duplicate instruction sequences are removed per module unless --all is set. Command implementations perform targeted instruction-order checks but do not claim a complete execution model.
Ranks are deterministic and prefer fewer instructions before using module, source, address, and raw text as tie breakers. ROPcatalog deliberately leaves full side-effect and chain reasoning to the human or agent consuming the candidate records.
ropcatalog [-h] [-b BAD_CHARACTERS] [-a] [-s {plain,python,js,cpp}] [-o]
[-e ENCODING] [--address-kind {unknown,rva,va}]
[-c COMMAND | -q QUERY | --batch PATH | --serve] [--jsonl]
[--limit LIMIT] [--artifact-dir ARTIFACT_DIR]
[--catalog-out CATALOG_OUT] [--stdin-module NAME]
[--fields FIELD,...] [--capabilities] [--verbose] [paths ...]
| Argument | Description |
|---|---|
paths |
Extractor dumps, reusable catalogs, or directories. Use - for gadget input on standard input. |
-b, --bad-characters |
Exclude addresses containing specified bytes, for example \x00\x0a\x0d. |
-a, --all |
Disable per-module instruction uniqueness filtering. |
-s, --style |
Select plain, python, js, or cpp output. |
-o, --offset |
Emit base-relative addresses. Rejected for sources marked as va. |
-e, --encoding |
Force source encoding instead of auto-detection. |
--address-kind |
Mark extractor addresses as unknown, rva, or va. |
-c, --command |
Run one named search command and exit. |
-q, --query |
Run one exact query and exit. Repeat for multiple queries. |
--batch |
Read plain or JSON requests from a file. Use - for request input on standard input. |
--serve |
Keep a file-backed catalog loaded and read JSON requests from standard input. |
--jsonl |
Emit one JSON response per query, suitable for jq and agent pipelines. |
--limit |
Bound returned gadgets while retaining total-match metadata. |
--artifact-dir |
Write JSONL results to <module>.ropcatalog.jsonl rather than standard output. |
--catalog-out |
Save a reusable parsed catalog and exit. |
--stdin-module |
Name an extractor source read from standard input. |
--fields |
Select fields in JSONL responses. |
--capabilities |
Print the complete machine-readable interface contract. |
--verbose |
Keep routine diagnostics in machine-readable modes. |
Input/output arguments that compete for standard input or produce incompatible output are rejected by argparse. In particular, standard input cannot carry both a gadget stream and --batch -, and --catalog-out, --artifact-dir, interactive mode, and --serve have separate output contracts.
Start with CONTRIBUTING.md for the contribution workflow and DEVELOPMENT.md for architecture and implementation guidance.
uv run pytestGPL-3.0-only. Use ropcatalog against binaries and systems you own or are authorized to assess, including private labs, CTFs, OffSec exam environments, and documented security engagements.