- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| src | ||
| .gitignore | ||
| .python-version | ||
| HARNESS.md | ||
| main.py | ||
| pyproject.toml | ||
| README.md | ||
| scratch_version.py | ||
| uv.lock | ||
RePy Toolkit
RePy (Reverse Engineering Python Toolkit) is an extensible suite of binary analysis, instrumentation, and proxying tools designed for Windows PE binaries.
Architecture & Tool Suite
RePy is organized as a modular toolkit containing individual, specialized tools built with future expansion in mind:
| Tool | Purpose | Status |
|---|---|---|
lintercept |
Automatic PE DLL proxying, C++ class reconstruction, live memory introspection & telemetry hook engine | Active (v0.2.0) |
| (Future Tools) | Function tracer, patch generator, memory dumper, etc. | Extensible |
Installation Guide
Prerequisites
- Python 3.10+: Ensure Python is installed and available on PATH.
- Rust & Cargo (required for compiling generated proxy DLLs):
- Install via rustup.rs
- Ensure the 64-bit MSVC toolchain is set as default:
rustup default stable-x86_64-pc-windows-msvc - If you plan on proxying 32-bit (x86) DLLs, add the 32-bit target:
rustup target add i686-pc-windows-msvc
- Visual Studio C++ Build Tools:
- Ensure the Desktop C++ workload and Windows SDK are installed (provides
link.exeanddbghelp.dll).
- Ensure the Desktop C++ workload and Windows SDK are installed (provides
uv(recommended modern Python package runner):powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # Or via winget: winget install astral-sh.uv
Install Methods
Method 1: Global CLI Tool via uv tool (Recommended)
Installs repy and lintercept globally into your user environment so they can be run from any terminal:
# From local repository clone:
uv tool install .
# Or directly from a Git repository:
uv tool install git+ssh://git@direct.cthulhub.net:2222/7S/RePy.git
To update later:
uv tool upgrade repy
Method 2: Zero-Install Ephemeral Execution (uvx)
Run the toolkit or individual tools instantly without installing them:
# Run the RePy toolkit runner
uvx --from . repy --help
# Run lintercept directly
uvx --from . lintercept <path\to\target.dll>
Method 3: Development / Editable Clone
For developing or contributing to RePy:
git clone <repo_url>
cd RePy
uv sync
Run any tool in the local virtual environment:
uv run repy list
uv run lintercept <path\to\target.dll>
Method 4: Standard pip Installation
# In your active Python environment:
pip install .
# Or for editable/development mode:
pip install -e .
Quick Start
Once installed or running via uv:
# RePy toolkit entry point
repy list
repy --version
# Direct lintercept execution
lintercept <path\to\target.dll>
# Root script wrapper
python main.py [args]
Tool: lintercept
lintercept analyzes target 32-bit and 64-bit Windows PE DLLs, reconstructs C++ class hierarchies from mangled symbols, and generates an optimized, thread-safe Rust proxy (cdylib) with live memory introspection, floating-point XMM capture, microsecond call profiling, and user-defined override hooks.
Usage
# Standard proxy generation & swap (auto-builds release Rust proxy and drops into place)
lintercept proxy path\to\target.dll
# Shorthand invocation
lintercept path\to\target.dll
# Flags:
# --no-swap Compile the proxy without replacing the target DLL
# --skip-build Generate Rust source code only without building
# --out-dir Specify a custom output directory for the Rust crate
# --harness Enable the full in-memory executable Harness + one-shot Easytable generator
# -F, --features <feat1,feat2>
# Pass specific Cargo features (e.g. unpack,generate_easytable,override_instructions)
Host Executable Instrumentation (The Harness)
Every lintercept project includes an optional, zero-overhead Harness (src/harness.rs, src/harness_config.rs, src/easytable.rs) for unpacking packed host executables from memory, generating an RVA-indexed symbol table (easytable.rs), slicing arbitrary assembly instruction ranges (override_instructions!), replacing internal functions (replace_functions!), and tracing memory writes / JMPs. All RVAs are 1:1 aligned with the in-memory unpacked executable.
See HARNESS.md for full documentation and examples.
Inspecting DLLs Without Modifying Files
lintercept inspect path\to\target.dll
Writing Custom Overrides
Inside the generated proxy directory (<target>_proxy_src/src/overrides.rs), add custom Rust functions to hook or spoof behaviors:
pub unsafe extern "system" fn override_is_mule_pc() -> i32 {
crate::log_override("COperatingSystem::IsMRIMulePC() called -> returning 1");
1
}
pub fn get_custom_override(index: usize, _mangled: &str, demangled: &str) -> Option<usize> {
// Match by demangled C++ symbol:
if demangled.contains("IsMRIMulePC") {
return Some(override_is_mule_pc as *const () as usize);
}
// Or match by export table index:
match index {
487 => Some(override_is_mule_pc as *const () as usize),
_ => None,
}
}
Whenever you modify src/overrides.rs, rebuild and swap using either:
lintercept path\to\target.dll
or manually from within the proxy source folder:
cargo build --release --target x86_64-pc-windows-msvc
Copy-Item "target\x86_64-pc-windows-msvc\release\<name>_proxy.dll" "..\<target>.dll" -Force
Toolkit Management
Self-Update
RePy detects your installation mode (Git repository, uv tool, or pip) and updates to the latest version:
repy update
lintercept update
# Check for updates without applying
repy update --check
System Diagnostics
repy --version
lintercept --version
Codebase Structure
RePy/
├── src/
│ ├── repy/ # Toolkit core & master CLI
│ │ ├── __init__.py # Toolkit metadata & version
│ │ ├── __main__.py # python -m repy entry point
│ │ └── cli.py # Tool registry & master command dispatcher
│ └── lintercept/ # Tool: DLL Proxy & Class Reconstructor
│ ├── __init__.py # Tool exports
│ ├── __main__.py # python -m lintercept entry point
│ ├── analyzer.py # PE export analysis & class intuition
│ ├── cli.py # lintercept CLI logic
│ ├── codegen.py # Rust crate generation, build & deploy
│ ├── demangler.py # DbgHelp undecoration & signature cleanup
│ ├── harness_templates.py# In-memory unpacked EXE Harness, Easytable & ASM slice macros
│ ├── templates.py # Naked ASM stubs, memory introspection & logging
│ └── updater.py # Environment detection & self-update logic
├── main.py # Root CLI wrapper
├── pyproject.toml # Build & dependency configuration
├── HARNESS.md # Host executable Harness documentation
└── README.md