2016-05-25 23:37:41 +02:00
|
|
|
RAPATCH
|
|
|
|
=======
|
|
|
|
|
|
|
|
Human friendly text format to apply patches to binary files.
|
|
|
|
|
|
|
|
Patch format
|
|
|
|
------------
|
|
|
|
|
|
|
|
Those patches must be written in files and the syntax looks like the following:
|
|
|
|
|
2018-02-27 03:54:54 -06:00
|
|
|
```
|
2016-05-25 23:37:41 +02:00
|
|
|
^# -> comments
|
|
|
|
. -> execute command
|
|
|
|
! -> execute command
|
|
|
|
OFFSET { code block }
|
|
|
|
OFFSET "string"
|
|
|
|
OFFSET 01020304
|
|
|
|
OFFSET : assembly
|
|
|
|
+ {code}|"str"|0210|: asm
|
2018-02-27 03:54:54 -06:00
|
|
|
```
|
2016-05-25 23:37:41 +02:00
|
|
|
|
|
|
|
Example scripts
|
|
|
|
---------------
|
2018-02-27 03:54:54 -06:00
|
|
|
This script will run the `?e ..` command in r2 and then write the string 'Hello' at 0x200 offset
|
|
|
|
```
|
|
|
|
# rapatch example
|
|
|
|
:?e hello world
|
|
|
|
0x200 "Hello"
|
|
|
|
```
|
2016-05-25 23:37:41 +02:00
|
|
|
|
|
|
|
Running rapatches
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
$ r2 -P rapatch.txt target-program.txt
|