This document provides detailed reference documentation for the RE-Architect Python API.
- Core Pipeline
- Configuration
- Decompiler Integration
- Binary Loading
- Analysis Components
- LLM Integration
- Test Generation
- Visualization
- Data Models
- Error Handling
- Examples
- Version Compatibility
- Support
Main entry point for binary analysis.
from src.core.pipeline import ReversePipeline
from src.core.config import Config
config = Config.from_file("config.yaml")
pipeline = ReversePipeline(config)
results = pipeline.analyze(
binary_path="path/to/binary.exe",
output_dir="./output",
decompiler="ghidra",
generate_tests=True
)__init__(config: Config)
Initialize the pipeline with a configuration.
-
Parameters:
config(Config): Analysis configuration
analyze(binary_path, output_dir=None, decompiler="auto", generate_tests=False)
Perform complete analysis of a binary.
-
Parameters:
binary_path(str | Path): Path to binaryoutput_dir(str | Path, optional): Output directorydecompiler(str):"ghidra" | "ida" | "binja" | "auto"generate_tests(bool): Whether to generate test harnesses
-
Returns:
dict: Results with functions, data structures, and metadata
-
Raises:
DecompilerError,AnalysisError,FileNotFoundError
Manages configuration from YAML or dictionaries.
from src.core.config import Config
# Load from file
config = Config.from_file("config.yaml")
# Load from dict
config = Config({
"decompiler": {"default": "ghidra"},
"llm": {"enable": True, "provider": "openai"}
})from_file(path: str) -> Config— load from YAMLget(key: str, default=None)— retrieve using dot notationset(key: str, value)— update valuedisable_llm()/enable_llm()— toggle LLM features
Factory for decompiler instances.
from src.decompilers.decompiler_factory import DecompilerFactory
factory = DecompilerFactory()
decompiler = factory.create("ghidra")
if decompiler.is_available():
results = decompiler.decompile(binary_info)create(name: str) -> BaseDecompiler- Returns a decompiler instance (
ghidra,ida,binja, orauto)
Abstract base class for all decompilers.
is_available() -> booldecompile(binary_info: BinaryInfo) -> DecompiledCodeget_decompiler_info() -> dict
Loads and parses binaries.
from src.core.binary_loader import BinaryLoader
loader = BinaryLoader()
binary_info = loader.load("binary.exe", auto_unpack=True)
print(binary_info.format, binary_info.architecture)Container with attributes:
path,format,architecture,bit_width,endiannessentry_point,sections,symbols,imports,exportscompiler,stripped
- StaticAnalyzer — static analysis of code
- DataStructureAnalyzer — recover structs
- EnhancedStaticAnalyzer — deeper function analysis
from src.analysis.static_analyzer import StaticAnalyzer
analyzer = StaticAnalyzer(config)
results = analyzer.analyze(decompiled_code)Generates LLM-based summaries.
from src.llm.function_summarizer import FunctionSummarizer
summarizer = FunctionSummarizer(config)
summary = summarizer.analyze_function_enhanced(func_info, context)
batch = summarizer.analyze_batch_enhanced(functions, context)Outputs: FunctionSummary objects with attributes:
name,purpose,behavior,complexity_analysisarguments,return_value,side_effects,security_notesoptimization_suggestions,confidence_score
Generates per-function harnesses.
from src.test_generation.test_generator import TestGenerator
generator = TestGenerator(config)
tests = generator.generate(functions, data_structures)python -m src.visualization.server --host 0.0.0.0 --port 8080from src.visualization.server import app
app.run(host="localhost", port=5000, debug=True)- DecompiledCode: container for functions, strings, types
- FunctionInfo: function attributes (name, address, size, calls, etc.)
- Instruction: assembly instruction details
Custom exceptions:
DecompilerError— decompilation failureAnalysisError— analysis failure
from src.core.exceptions import DecompilerError, AnalysisErrorfrom src.core.pipeline import ReversePipeline
from src.core.config import Config
config = Config.from_file("config.yaml")
pipeline = ReversePipeline(config)
results = pipeline.analyze("sample_binary.exe", "./analysis", "ghidra", True)
print(f"Functions: {len(results['functions'])}")
print(f"Data structures: {len(results['data_structures'])}")from src.decompilers.base_decompiler import BaseDecompiler, DecompiledCode
class CustomDecompiler(BaseDecompiler):
def is_available(self): return True
def decompile(self, binary_info):
dc = DecompiledCode(binary_info)
dc.add_function(address=0x401000, code="int main(){return 0;}", name="main")
return dc- v1.0+: Static analysis, LLM integration, web UI
- v1.1+: Dynamic analysis, batch mode
- v1.2+: Custom decompiler plugins, advanced test generation
- Source code:
src/directory - Examples:
tests/directory - Issues: GitHub Issues
- Docs: User Manual