Scroll to navigation

RAPATCH2(1) General Commands Manual RAPATCH2(1)

NAME

rapatch2binary patching utility

SYNOPSIS

rapatch2 [-psRqv] [patchfile] [targetfile]

DESCRIPTION

A utility for applying binary patches to files using a human-friendly text format.

The patches must be written in a file using the following syntax:

^# -> comments
! -> execute command
OFFSET { code block }
OFFSET "string"
OFFSET 01020304
OFFSET : assembly
+ {code}|"str"|0210|: asm

OPTIONS

N
Patch level, skip N directories
Reverse patch
Sandbox mode, disable scripts and r2 command execution
Be quiet
Show version

ENVIRONMENT

rapatch2 does not use any environment variables.

EXAMPLES

Generate a patch using radiff2 and apply it with rapatch2:


$ radiff2 -u bin1 bin2 > patch
$ rapatch2 -p 1 < patch

Patch a specific file:


$ rapatch2 bin1 patch

Create a simple patch file manually:


$ cat > mypatch.r2
0x100 "Hello World"
0x200 9090
0x300 : nop
^D
$ rapatch2 target_binary mypatch.r2

SEE ALSO

radare2(1) radiff2(1)

AUTHORS

Written by pancake <pancake@nopcode.org>.

July 10, 2025