Expose rop3 as a Python library and add an interactive mode (#24)#26
Merged
Conversation
Closes #24. - api.py: a small, stable `Rop3` class exposes rop3 programmatically (gadgets(), find_op(), ropchain()). Gadgets are scanned once and cached on the instance. Rop3.from_args() reuses the CLI's parsed flags. - interactive.py: `--interactive` scans the binary once and drops into a cmd-based REPL (gadgets/search, count, op, chain, help, quit), reusing the cached gadgets so each command is cheap. - __init__.py: main() now drives everything through Rop3, and `from rop3 import Rop3` is the public entry point. - README: document the interactive mode and library usage. Tests: 85 pass (3.11/3.13). New test_api.py covers the Rop3 API (caching, single-vs-list binaries, find_op) and the interactive shell commands, driven over an in-memory generated ELF. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24.
Library API (
rop3.api.Rop3)A small, stable entry point so rop3 can be used from other Python tools. Gadgets are scanned once and cached on the instance, so repeated queries (and the interactive mode) don't re-scan.
Rop3.from_args(args)reuses the CLI's already-parsed flags, andmain()now drives everything throughRop3(no behaviour change for the CLI).Interactive mode (
--interactive)Scans the binary once and drops into a
cmd-based REPL, so exploring gadgets no longer pays the start-up/scan cost per query:Commands:
gadgets/search [substring],count,op <name> [dst] [src],chain <file>,help,quit.Testing
test_api.pycovers theRop3API (caching, single-vs-list binaries,find_op) and the interactive shell commands, driven over an in-memory generated ELF.🤖 Generated with Claude Code