I am learning by doing some cracking in files that i made in C. One of this files is this:
file.c:
#include <stdio.h>
#include <stdlib.h>
int main() {
char s[15] = "disassemba";
int x;
x=555;
printf("%d",x);
if (x == 2000) {
printf("You win");
} else {
printf("You lose");
}
}
So i compile with: gcc file.c -o file
open the file with radare: r2 -w file
The commands i use is the following, in radare2, in order:
aaa
s main
V
in visual mode, i need modify the line of code where sets x=555 to x=2000. So i navigate in visual mode to:
And i hit shift+a, but when i try insert
mov dword [var_4h], 0x7D0
the file is not patched (no changes in asm code).
any hint?
note:Preferably in some easy way where i can write the code in asm and not in machine code.