All-in-one CLI toolkit for binary disassembly, analysis, visualization and local-AI annotation
β¨ Features β’ β‘ Quick start β’ π§° Usage β’ π§© Architecture β’ π Roadmap β’ π€ Contributing
Reverse engineering workflows are fragmented across Ghidra, radare2, custom scripts and steep learning curves. RevKit unifies the most-used capabilities into a single fast CLI augmented by local LLMs for naming and semantic understanding. Perfect for security researchers, CTF players, firmware analysts and maintainers who need speed without context switching.
- One-command pipeline β load, disassemble, annotate and report with
revkit analyze - Local AI only β function renaming, variable suggestions and comments via Ollama (no cloud, no telemetry)
- Rich visuals β CFG graphs, embedded SVGs, interactive HTML reports with zero external dependencies
- Python first β import
Binary,analyze(),CFGBuilderorAIAnnotatorfor custom automation pipelines - Extensible β plugin system for third-party analyzers via Python entry points
- Headless Ghidra decompilation β obtain high-quality C pseudocode for functions via Ghidra (optional, set
GHIDRA_HOME)
|
π Universal Loader Auto-detects and parses ELF, PE, Mach-O, DEX, and raw/flat binaries (including shellcode) using LIEF with dedicated native parsers for Mach-O (segments/load commands) and DEX (classes/methods) |
β‘ Capstone Disasm Lightning-fast disassembly for x86, ARM, MIPS, RISC-V and WebAssembly |
π Advanced CFG Generates control-flow graphs with NetworkX. Uses Radare2 bridge for precise basic-block level graphs and ESIL emulation when available |
|
π§ Local AI Helper Ollama integration renames functions, suggests variable names and adds comments |
π Pattern Scanner Detects common vulnerabilities, anti-debug tricks and library function signatures using FLIRT database downloader + matcher |
π Rich Reports Creates Markdown, JSON and interactive HTML reports with embedded visuals |
|
π Python Library Importable API for scripting custom analysis pipelines and automation |
π€ String Explorer Advanced string extraction, decoding and cross-reference mapping |
π Dynamic Tracing Unicorn-based emulation with per-instruction and register tracing (x86/ARM) |
|
π§© Headless Ghidra Decompiles functions to C using analyzeHeadless with embedded postScript (requires GHIDRA_HOME) |
Β | Β |
|
π Plugin System for Third-Party Analyzers Write custom analyzers by subclassing revkit.Analyzer, implement .analyze(binary), and register them using the revkit.analyzers entry point in your pyproject.toml. Results are automatically included in reports and the analyze() dict.
|
||
Requires Python 3.9+, matplotlib (for CFG visualization) and (optionally) an Ollama instance with a code model for AI features. Radare2 + r2pipe are optional for the advanced graph and emulation bridge.
pip install revkitFor AI support:
ollama pull codellama
ollama serveFor Radare2 support:
pip install r2pipe
# install radare2 from https://rada.reFor Ghidra decompilation support, install Ghidra and set the GHIDRA_HOME environment variable.
revkit analyze firmware.bin --ai --r2 --flirt --ghidra --report html --output report.html
revkit trace firmware.bin --steps 500 --regsOr via the Python API:
from revkit import analyze, trace, match_flirt, decompile
result = analyze(
"firmware.bin",
arch="auto",
ai=True,
r2=True,
flirt=True,
ghidra=True,
report="html",
output="report.html"
)
log = trace("firmware.bin", steps=100, trace_regs=True)
print(f"Traced {len(log)} instructions, first: {log[0]}")
flirt_matches = match_flirt("binary")
print("FLIRT library functions:", len(flirt_matches))
print(decompile("firmware.bin", "main"))Display binary metadata:
revkit info sample.elf --arch x86_64Disassemble a function:
revkit disassemble sample.elf --function main --length 128Generate a control-flow graph:
revkit visualize sample.elf --function main --output cfg.png --format png --r2Dynamic tracing:
revkit trace crackme.bin --steps 200 --regs --output trace.jsonAI annotation + report pipeline
from revkit import annotate, generate_report, CFGBuilder
from revkit.core import Binary
binary = annotate("crackme.bin") # runs AIAnnotator.batch_annotate
report = generate_report(binary, fmt="markdown", output="annotated.md")
builder = CFGBuilder(binary)
builder.build_cfg("main")
builder.export_svg("main_cfg.svg")Ghidra decompilation usage
from revkit.core import Binary
from revkit import decompile
binary = Binary("sample.elf")
binary.enable_ghidra()
print(binary.decompile("main"))
# High-level helper
print(decompile("sample.elf", function="main"))Custom scanner + library usage (CTF example)
from revkit.core import Binary
from revkit.scanner import VulnScanner
from revkit import disassemble
binary = Binary("ctf_crackme.bin")
scanner = VulnScanner(binary)
print("Anti-debug tricks:", len(scanner.find_anti_debug()))
print("Stack smash candidates:", len(scanner.detect_stack_smash()))
asm = disassemble("ctf_crackme.bin", start=0x401000, length=64)
print(asm)Radare2 bridge usage
from revkit.core import Binary
from revkit.r2bridge import R2Bridge
binary = Binary("sample.elf")
r2 = R2Bridge(binary)
print("Advanced CFG nodes:", r2.advanced_cfg("main").number_of_nodes())
emu = r2.emulate(binary.entry_point(), steps=20)
print("Emulated PC:", hex(emu.get("registers", {}).get("rip", 0) or 0))
r2.close()Dynamic tracing usage
from revkit import trace
from revkit.core import Binary
log = trace("shellcode.bin", steps=50, trace_regs=True)
for entry in log[:5]:
print(entry["address"], entry["instruction"])
binary = Binary("shellcode.bin")
trace_log = binary.trace(steps=100)
print(f"Executed {len(trace_log)} instructions")Plugin system usage
from revkit import analyze
from revkit.plugin import Analyzer
from revkit.core import Binary
from revkit.utils import calculate_entropy
class CustomVulnAnalyzer(Analyzer):
name = "custom_vuln"
description = "Looks for suspicious constants"
def analyze(self, binary: Binary) -> dict:
findings = []
for s in binary.strings():
if "password" in s.lower() or "secret" in s.lower():
findings.append(s)
return {
"suspicious_strings": findings,
"count": len(findings),
}
# Register in your plugin package's pyproject.toml:
# [project.entry-points."revkit.analyzers"]
# custom_vuln = "myplugin.analyzers:CustomVulnAnalyzer"
result = analyze("firmware.bin", plugins=["custom_vuln"])
print(result["plugins"])FLIRT matching usage
from revkit.core import Binary
from revkit.scanner import VulnScanner
from revkit import match_flirt
binary = Binary("libc_linked.bin")
scanner = VulnScanner(binary)
scanner.flirt.download()
matches = scanner.match_flirt()
print("Identified library functions:")
for addr, name in matches.items():
print(f" {hex(addr)} : {name}")
# High-level API
print(match_flirt("binary"))| Option | Default | Description |
|---|---|---|
arch |
auto |
Architecture hint passed to Capstone (x86, arm, riscv, auto) |
ai |
False |
Enable local Ollama annotation via AIAnnotator |
r2 |
False |
Enable Radare2 bridge (requires r2pipe and radare2) for advanced features |
flirt |
False |
Enable FLIRT signature database matching for library function identification |
ghidra |
False |
Enable headless Ghidra decompilation (requires GHIDRA_HOME) |
report |
html |
Report format β one of "html", "markdown", "json" |
output |
None |
Path to write report (CLI uses revkit_report.{fmt} by default) |
model |
codellama |
Ollama model used by AIAnnotator.init |
steps |
10000 |
Maximum instructions to emulate in dynamic tracing |
trace_regs |
False |
Log CPU registers on each instruction (Unicorn) |
plugins |
None |
List of plugin names to execute (or all if omitted). Registered via entry points. |
flowchart TD
CLI[cli.py β Typer commands] --> API[__init__.py β analyze / disassemble / annotate]
API --> Binary[core.Binary β LIEF loader + native Mach-O/DEX parsers]
Binary --> Disasm[disasm.py β Capstone + Function]
Binary --> R2[R2Bridge β advanced graph + ESIL emulation]
Binary --> Ghidra[GhidraDecompiler β headless decompilation to C]
Binary --> Tracer[tracer.py β UnicornTracer for dynamic execution tracing]
Binary --> Scanner[scanner.py β VulnScanner + FlirtMatcher]
Binary --> Annotator[annotator.py β AIAnnotator + Ollama]
Binary --> Plugins[plugin.py β Analyzer base, entry-point discovery]
Annotator --> Binary
Binary --> Graph[graph.py β CFGBuilder + NetworkX]
Binary --> Report[report.py β ReportGenerator]
R2 --> Graph
Tracer --> Binary
Ghidra --> Binary
Graph --> Report
Scanner --> Report
Plugins --> Report
Report --> Outputs[HTML / Markdown / JSON + embedded SVGs]
The central Binary class (powered by LIEF) is passed between modules. Dedicated MachOParser and DEXParser classes provide format-specific handling (segments/load commands for Mach-O, classes/methods for DEX). Raw/flat binaries (including empty files and shellcode) are supported as format="RAW". Disassembly, AI annotation and CFG generation are lazily executed only when needed. The public API and CLI both call the same underlying functions, guaranteeing identical results whether used interactively or in scripts. When r2=True (or binary.enable_r2()), R2Bridge augments CFGBuilder with radare2's aaa + afbJ for accurate basic-block CFGs and ESIL emulation. The new UnicornTracer (or binary.trace()) provides instruction-level dynamic execution tracing with optional register dumps. The new plugin system lets third-party packages register Analyzer subclasses via the revkit.analyzers entry point; analyze(..., plugins=[...]) runs them and merges results into the returned dictionary and reports. FlirtMatcher (integrated in VulnScanner and Binary.match_flirt()) downloads a signature database to ~/.cache/revkit/flirt and performs masked byte-pattern matching on function prologues for common library identification (x86_64/ARM). The new GhidraDecompiler (activated via binary.enable_ghidra() or analyze(ghidra=True)) runs Ghidra's analyzeHeadless with an embedded Python post-analysis script to produce accurate C decompilation; results are attached to Binary and included in reports.
src/revkit/
βββ __init__.py # Public API: Binary, analyze(), disassemble(), annotate(), generate_report(), match_flirt(), decompile()
βββ cli.py # Typer CLI: info, analyze, disassemble, annotate, visualize, report
βββ core.py # Binary class + MachOParser/DEXParser β LIEF parsing, strings(), symbols(), entropy(), read_bytes(), enable_r2(), enable_ghidra(), decompile(), match_flirt()
βββ disasm.py # Capstone wrapper, disassemble_range(), get_function(), Function.to_asm()
βββ graph.py # CFGBuilder β build_cfg(), export_png(), export_svg(), export_dot()
βββ r2bridge.py # R2Bridge for advanced graph (afbJ) and emulation (ESIL)
βββ annotator.py # AIAnnotator β suggest_name(), explain_function(), batch_annotate()
βββ ghidra.py # GhidraDecompiler β headless analyzeHeadless + postScript for C output
βββ plugin.py # Analyzer ABC + get_analyzers() / run_plugins() via entry points
βββ scanner.py # VulnScanner + FlirtMatcher (downloader + byte pattern matcher for FLIRT sigs)
βββ report.py # ReportGenerator β to_html(), to_markdown(), to_json()
βββ tracer.py # UnicornTracer β trace(), instruction + register logging
βββ utils.py # detect_format(), map_arch_to_capstone(), calculate_entropy()
βββ __version__ # dynamic via importlib.metadata
tests/
βββ conftest.py # fixtures: sample_elf, mocked_ollama_response, temp_binary
βββ test_core.py # Binary loader, strings, symbols, entropy, R2Bridge integration, FlirtMatcher, GhidraDecompiler
βββ test_disasm.py # Capstone accuracy on x86/ARM snippets
examples/
βββ ctf_crackme.py # Full AI annotation β solve-script generation example
pytestThe test suite covers Binary loading (including RAW binaries), string extraction, symbol table parsing, entropy calculation, Capstone disassembly accuracy on known x86/ARM snippets, mocked Ollama responses for annotation tests, R2Bridge integration (with graceful fallback when r2pipe/radare2 is unavailable), Unicorn tracing (skipped when unicorn is not installed), and the new FlirtMatcher (builtin signatures, download, matching). New tests cover match_flirt(), VulnScanner.match_flirt(download=False) and integration in analyze(flirt=True). The plugin system (mocked entry points and custom Analyzer subclasses) is also tested. GhidraDecompiler tests cover availability detection, graceful fallback when not installed, and integration with Binary.decompile() / analyze(ghidra=True) (using mocks).
- v0.1.0 β first release: Universal Loader, Capstone Disasm, CFG Builder, Local AI Helper
- Add Mach-O and Android DEX native parsers
- Radare2 bridge for advanced graph and emulation
- Unicorn-based dynamic tracing command
- Plugin system for third-party analyzers
- FLIRT signature database downloader and matcher
- Headless Ghidra integration for decompilation
- WebAssembly and .NET binary support
- Parallel processing for large firmware images
- Interactive terminal explorer (REPL mode)
- Export to IDA .idb and Binary Ninja .bndb
- HTML dashboard with zoomable CFGs
- YARA rule integration for malware family detection
π€ This roadmap is worked through continuously β ideas and PRs welcome!
Contributions are welcome and appreciated! Whether it's a bug fix, new scanner pattern, improved CFG layout or documentation tweak, please read our CONTRIBUTING.md and adhere to the CODE_OF_CONDUCT.md. Good-first-issue PRs are especially encouraged β just open a PR against main.
MIT Β© RevKit Contributors β see LICENSE for details.