More radare2 (3/?): binary editing / persisting / debugging
Invoke r2 with -w flag -> Write mode.
In visual mode ('V') the visual assembler 'A' is available, and
allows to enter assembly directly in place of the current seek.
=> patch binary.
Visual mode supports a number of shorcuts (listed in the book,
but also as inline help). The `;` shortcut, allows to add
comments to the assembly.
Exercise: how to do so in normal mode?
## Flags
It is useful to place flags around, e.g when an interesting
offset is found.
f myflag = $$ # Where $$ is the 'current seek' variable.
## Persist
I was wondering how to persist metadata.
As it turns out, radare2 can save projects and version them via
git. Try `P?` and read up :)
## Debug
Visual debugging: `Vpp` (or `V` followed by hitting `p` twice)
Top: stack
Middle: registers
Bottom: instructions
db List breakpoints
db main Add breakpoint to main.
dc Continue to breakpoint.
dsr Step till end of frame (that is, till return)
F2 | B toggle breakpoint (Same as `db $$`)
F4 Run to cursor
F7 | s Step
F8 | S Step over
F9 Continue