assemblyreverse-engineeringradare2

How to modify machine code in radare2 under the cursor by incrementing and decrementing single bytes?


In Radare2, it should be possible, in visual mode, with the cursor active (press c), to increment and decrement a single byte of raw machine code. While doing this, it should update in real time the new assembled machine code, e.g. incrementing 0x50 to 0x51, 0x52, etc. should result in various PUSH opcodes.

I thought this was done by pushing + and - to increment and decrement, respectively, but I find that it doesn't work. I also find it hard to find this particular information in the manual.

Am I remembering it wrong, from previous versions, or has it changed since then?

Note, I'm not asking about how to do to this using "wa" or similar commands to assemble new assembly statements, I just want to increment and decrement single bytes as a convenient way to instantly change the machine code on the fly.


Solution

  • ENVIRONMENT

    SOLUTION

    user@host:~$ r2 -w /file/to/analyze.x
    
    [0x100001060]> aaaa
    
    [0x100001060]> Vpc
    
    +
    -
    

    EXAMPLE

    enter image description here enter image description here enter image description here enter image description here