Skip to content

Commit

Permalink
Fix #362 - add rapatch documentation from r2/doc
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jul 9, 2024
1 parent 38b41c8 commit 4c58afc
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/commandline/write.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,44 @@ It is possible to implement cipher-algorithms using radare core primitives and `
0x7fcd6a891650 c4da 1a6d e89a d959 9192 9159 1cb1 d959
0x7fcd6a891660 9192 79cb 81da 1652 81da 1456 a252 7c77
```

## Rapatches

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:

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

### Rapatch Example

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"
```

### Applying rapatches

```
$ r2 -P rapatch.txt target-program.txt
```

Or for scripted patching like `patch(1)`:

```
$ r2 -w -q -P rapatch.txt target-program.txt
```

0 comments on commit 4c58afc

Please sign in to comment.