A modern WPF / .NET 10 rebuild of the classic Ripper Studio code-ripper — the
reverse-engineering tool that traces a routine out of a PE image and re-emits it as
standalone, reassemblable MASM. It follows the routine's control flow from a start
address, stops at user-declared endpoints, labels every branch/call/data target,
and lets you classify the data it touches before saving to .asm.
Companion to SnippetCreatorModern — same stack (.NET 10, WPF, the
Iced x86/x64 disassembler), same hand-rolled
PeFile.
| Original Ripper Studio step | Here |
|---|---|
| 2. Browse / load file → "Reading 05h sections… / Found 18Eh imported functions." | Browse… button → RipSession.Load + <
8000
code>ImportTable.Parse; the same hex report prints in the Messages pane. Loading a new file (or opening a project) starts a clean session — endpoints, classifications, repoints and navigation history all reset. |
| 3. Enter the start Virtual address and an Identifier label | Trace setup box (StartVaBox, IdentifierBox). The start point receives the label you call from your keygen. |
| 4. Add the sprintf address as an Endpoint so it isn't ripped | Endpoints list. The trace never decodes inside an endpoint; calls to it become an external label you repoint later. A separate Stop after list is the inclusive counterpart — the instruction at that address is ripped, but the trace doesn't follow past it (handy to cap a rip at a known last instruction, e.g. a function's ret). |
| 5. Start trace → disassembly + data references; classify each as String/Dword | Start trace runs RipEngine.Trace. The Disassembly view shows the symbolicated listing (and is navigable — see below); the Data references grid + Reference type radios (String / Wide UTF-16 / Dword / Qword / Bytes) + File view (bytes / ascii / utf-16 preview + referenced-from) let you classify each ref. ASCII and wide (UTF-16LE) strings are auto-detected; wide strings dump as dw 'h','i',…,0. |
| 6. Save to .asm | Save to .asm → AsmExporter writes a complete listing: the assembler directives (.686p/.xmm/.model flat, stdcall for 32-bit; flat ml64 for 64-bit), a .drectve section embedding the entry point + subsystem, includelib lines for the imports the rip references, the externdef stubs, the .data block and the .code. The object self-links, so ml/ml64 <file>.asm builds a standalone EXE with no extra flags (see Building the rip). Or Export bytes… dumps the ripped code as a C unsigned char[] / raw .bin (ByteExporter). |
7. Swap call 467AB4 for call wsprintfA, add UI |
Repoint… assigns each external stub an import or custom name in-tool (see below); the rest (your own UI) is the hand-written half. |
src/RipperStudio.Core
Pe/ PeFile, PeSection, PeImports — read-only PE32/PE32+ parsing + IAT name map
Ripping/
RipEngine control-flow trace (worklist + Iced decoder), data-ref collection
RipRequest start VA, identifier, endpoints, follow-calls, instruction cap
RipResult instructions, symbols, data refs, warnings
DataReference a classified datum (String/Dword/Qword/Bytes) + dump rendering
RipFormatter shared Iced/MASM formatting + unique label assignment
AsmExporter full .asm emission (directives / .drectve entry+subsystem / includelib / externs / .data / .code)
SymbolRenames (on RipRequest) repoint external stubs to imports/custom names
Reassembler assemble the generated .asm with MASM (ml/ml64) to verify it
RoundTripVerifier re-encode each instruction and check it reproduces the original bytes
ByteExporter dump the ripped bytes as a C unsigned-char array / raw .bin
RipProject save/load a whole session to a .rsproj (RipProjectStore)
RipSession facade: load → report → trace → export → reassembly check
src/RipperStudio.Wpf the UI (MainWindow) driving RipSession
tools/RipperStudio.Smoke CLI harness: rip a routine and dump the .asm
tools/capture.ps1 dev helper: launch the app and screenshot the window
A worklist disassembles one instruction at a time with Iced and follows flow:
conditional branches queue both targets, direct calls (when Follow internal calls
is on) rip the callee and continue past the call, unconditional jumps follow their
target, and ret/endpoints/indirect targets end a path. Internal targets get
loc_ / sub_ labels, IAT references resolve to their import name, and memory
operands / pushed offsets into data become data references for you to classify.
A configurable instruction cap stops a runaway trace.
The ripped code is presented in control-flow order: the entry routine reads
top-to-bottom following its flow and ends at its ret, then each called sub is laid out
after as its own block. The rip reads like a function instead of burying the entry among
lower-addressed helpers (or trailing off on the highest-addressed jump thunk). The reorder
unit is a fall-through chain — a maximal run of instructions joined by fall-through,
emitted whole where possible. The exporter inserts explicit jumps whenever gaps or
overlapping instruction streams require reconnecting a sequential successor. The raw
byte export stays in address order and packs instruction bytes with an entry offset;
it does not relocate the packed code.
How direct internal calls are handled is controlled by RipRequest.CallMode:
- Recursive — follow every internal call, transitively (rip all helper subs).
- Non-recursive — follow none; the start routine only. Each call target becomes
an external
sub_stub (externdef … :proc), like an endpoint, so the rip still reassembles — you supply those, or re-rip recursively. - Selected — follow only the call sites you tick in the Calls list
(
RipRequest.FollowedCallSites, keyed by call-instruction VA). Following a call reveals the calls inside it as new rows, so you can drill in one level at a time. Switching into Selected mode seeds the ticks from whatever is currently followed, so you can start recursive and just untick the calls you don't want.
The picker is live: ticking/unticking a call (or switching mode) re-traces
immediately, so the disassembly and call list update as you drill in. Unfollowed
internal targets are emitted under a ; ---- internal calls not followed ----
section in the .asm.
The listing is interactive. Double-click a jmp/jcc/call (or press Enter) to
follow it to its target; the view scrolls and selects the destination label. A ◀ / ▶
history (also Esc = back, and the mouse back/forward buttons) walks your jumps, and a
Go to box jumps to any hex address (honouring the VA/RVA mode; a mid-instruction
address lands on its instruction). Right-click a line for Go to target and a
Referenced from (N) cross-reference list — click any caller to jump straight to it.
A Filter box above the listing narrows it to only the lines whose text contains what you
type (case-insensitive) — type call to see just the calls, jmp for the branches, or a
register/symbol name to find its uses. Multiple space-separated terms are OR'd by default, so
cmp mov shows every cmp and every mov (each line is one instruction, so a line matches
if it contains any term); tick All terms to switch to AND, where a line must contain
every term (e.g. mov eax then finds only the movs that touch eax). Wrap a term in
double quotes to match a literal phrase including its spaces — "cmp eax,5" matches only that
instruction. Reset clears the filter and shows the whole listing again. Navigating to a line (following a branch, a Go to, back/forward, an xref jump, or
syncing from a data reference) auto-clears the filter, so a jump target is never hidden by it.
The filter otherwise persists across re-traces; loading a new file clears it and resets the
All terms toggle to the OR default.
Endpoints, unfollowed calls and out-of-rip branch targets are emitted as externdef
stubs you'd otherwise patch by hand. Repoint… opens a dialog listing every stub with
an editable field — type an import name (e.g. wsprintfA, with the image's imports shown
alongside for reference) or your own label. The name replaces the stub at every call/jump
site and in the externdef, so call sub_467AB4 becomes call wsprintfA and the rip
assembles against the real import. Repoints are keyed by address (so they survive
re-traces) and are saved in the .rsproj.
A reversing job spans more than one sitting, so the whole session can be saved to a
.rsproj file and reopened later. Save project… writes the source file, start VA,
identifier, VA/RVA mode, call-follow mode, endpoints, the followed call-sites and every
data-reference classification to human-readable JSON (RipProjectStore); Open
project… reloads the file, restores all of it and re-traces, so you land exactly where
you left off. Addresses are stored as hex so the file is easy to read or hand-edit.
Verify bytes (RipSession.VerifyRoundTrip) re-encodes every ripped instruction with Iced
at its original address and compares to the original bytes. If all match, the disassembly is a
byte-faithful capture of the function. It's a pure byte comparison (not via MASM, whose output
differs by design). Mismatches are instructions the encoder renders in a different but
equivalent form — e.g. a redundant REX prefix the original carried that Iced drops canonically
— reported (original vs re-encoded hex) but not treated as errors; only a genuine encode
failure is. Typical results: x86 ~100%, x64 ~97–99% (the difference is redundant prefixes).
A rip is only useful if it actually assembles. Check reassembly
(RipSession.CheckReassembly) writes the export to a temp file and runs MASM —
ml64.exe for PE32+ rips, ml.exe for PE32 — with /c (assemble only), then reports
PASS or each error (line, code, message) in the Messages pane. The assembler is
auto-located via vswhere/PATH; the RIPPER_ML64 / RIPPER_ML environment variables
override it. A clean assemble proves the symbolication, externdef stubs and .data
dump are internally consistent; failures pinpoint the line to fix (a misclassified data
reference, a missing extern, …). Branch and call targets that fall outside the rip
(e.g. beyond the instruction cap) are emitted as external stubs, so even a capped rip
assembles.
Assembling (the reassembly check above, ml /c) and linking are different steps: the
check stops at the object file, so it never needs an entry point. The saved .asm makes its
object self-linking so a plain ml <file>.asm / ml64 <file>.asm (which assembles and
links) produces an EXE with no extra flags:
- An entry point + subsystem.
AsmExporteremits a.drectvesection carrying-entry:<entry>and-subsystem:<windows|console>(taken from the source image) — the same mechanism the C compiler uses for#pragma comment(linker, …). The linker reads these as if passed on its command line, so it never hitsLNK1561: entry point must be definedorLNK1221: a subsystem can't be inferred. This is the only way to set the entry for a 64-bit rip — ml64 forbids an operand onEND, soend <entry>(which 32-bitmlhonours) is not an option there. The entry is also exported as apubliclabel, and 32-bit additionally ends withend <entry>. - Import libraries. It emits an
includelibline for every import the rip references (and for any stub you repointed onto a real import name), mapping each DLL to its library by the SDK convention (USER32.dll→user32.lib). Edit a line if a DLL has no same-named.lib— e.g. an API-set umbrella likeapi-ms-win-core-*.dll, which has no standalone import lib.
Build from a Visual Studio Native Tools Command Prompt (so ml/ml64/link and the LIB
import-library path are set); the header of every saved .asm prints the exact command. A
clean standalone link additionally requires that no externdef stub is left unresolved —
rip recursively (or provide the stubs) and repoint endpoints/imports first, or those become
LNK2001 unresolved externals.
dotnet build RipperStudio.slnx
dotnet test RipperStudio.slnx --configuration Release
# UI
dotnet run --project src/RipperStudio.Wpf
# CLI smoke: rip <exe> from <startVaHex>, optional endpoint VAs
dotnet run --project tools/RipperStudio.Smoke -- C:\path\to\target.exe 407B47 467AB4
# Reassembly self-test (locate ml/ml64, prove a clean source PASSes and a broken one
# FAILs); pass a file to also run a real rip through the checker:
dotnet run --project tools/RipperStudio.Smoke -- --reasm C:\path\to\target.exe 407B47Addresses are hex (e.g. 407B47, with or without 0x/h). By default they are
full virtual addresses — the ones your debugger shows. Flip the VA/RVA
toggle (or prefix a single value with +) to type RVAs instead and have
ImageBase added automatically — handy for DLLs based at e.g. 0x52180000. A green
echo under the start field shows the resolved counterpart (VA↔RVA). Everything the
tool displays (disassembly, data refs, labels, .asm) stays in VA, the canonical
form; RVA is only an input convenience.
The generated .asm assembles as-is and its object self-links (the directives, .drectve
entry/subsystem and includelib lines a standalone link needs — see Building the rip into a
standalone EXE). It is still a starting point: the externdef endpoint/import stubs are the
parts you finish by hand — repointing them, exactly as the original tutorial's step 7
describes — before a clean standalone link.
Debug hook:
RipperStudio.exe --demo <file> <startVaHex> [endpointVaHex …]loads a file and runs a trace on startup (used for screenshots / driving the UI headless).
powershell -ExecutionPolicy Bypass -File installer\build-installer.ps1This publishes a self-contained win-x64 build (no .NET prerequisite on the target)
to dist\publish, then compiles installer\RipperStudio.iss with Inno Setup into
dist\RipperStudioSetup.exe (~45 MB). Install Inno Setup first if needed:
winget install JRSoftware.InnoSetup.
The app requests requireAdministrator (see src\RipperStudio.Wpf\app.manifest), so
the installer installs per-machine into Program Files and the app prompts for UAC on
launch. dist\ is git-ignored.
Loading copies the source under a read lease into a private, automatically deleted file-backed snapshot. Later patches or rebuilds of the source cannot change a completed trace. PE machine and optional-header pairs must describe x86/PE32 or x64/PE32+; other architectures are rejected. Trace results own immutable request snapshots, including endpoints, call selection and renames.
Assembly export preserves each instruction's sequential successor with an explicit jump when layout changes, overlapping instructions, a cap, cancellation or an excluded endpoint interrupt fall-through. Exits outside the rip receive external symbols and warnings; the user must provide those destinations. XBEGIN follows both its success and abort paths. Unresolved indirect jumps and contextual transaction aborts produce diagnostics, also during live retraces.
IAT slots have separate pointer storage initialized with the imported procedure's address, so both loading a function pointer and calling through that slot preserve indirection. Overlapping data references share one emitted byte interval with labels at their original offsets. Known memory operand widths determine minimum storage requirements; undersized classifications fail export with an actionable message. These checks cannot infer arbitrary arrays, pointer graphs or runtime jump-table destinations. Assembly success and instruction re-encoding do not prove that a rip has every dependency needed to execute independently.
Project restore uses the same cancellable 4DBA background trace as Start trace. Loading a different file clears call rows, follow selections, pending navigation/retrace state and entryless start addresses. Save actions are mutually exclusive and commit via a temporary file and rename. Closing stops new work, cancels tracing/verification/assembly and waits for existing operations and saves to finish before disposing the session and closing the window.