Xcross87 Posted August 5, 2009 Share Posted August 5, 2009 (edited) Hi MUsers, I'm currently doing practices under Linux w/ blah crackmes: Link: http://crackmes.de/users/lord/easy_linux_crackme/ This is the dump result: blah: file format elf32-i386 Disassembly of section .text: 08048094 <.text>: 8048094: 31 c0 xor %eax,%eax 8048096: b8 2f 00 00 00 mov $0x2f,%eax 804809b: cd 80 int $0x80 804809d: 3d ad de 00 00 cmp $0xdead,%eax 80480a2: 75 16 jne 0x80480ba <-- I want to NOP this line 80480a4: b8 04 00 00 00 mov $0x4,%eax 80480a9: bb 01 00 00 00 mov $0x1,%ebx 80480ae: b9 c4 90 04 08 mov $0x80490c4,%ecx 80480b3: ba 06 00 00 00 mov $0x6,%edx 80480b8: cd 80 int $0x80 80480ba: 31 c0 xor %eax,%eax 80480bc: 40 inc %eax 80480bd: 31 db xor %ebx,%ebx 80480bf: cd 80 int $0x80 As I comment above, I want to patch that line by 2 - NOP bytes. I wrote this code: #include <stdio.h> int main( int argc, char *argv[] ) { int offset[2] = { 0x75, 0x16 }; /* origin */ char patch[2] = { 0x90, 0x90 }; /* nop */ FILE *file; int i; file = fopen( "blah", "rb+" ); if( file != NULL ) { for( i = 0; i < 2; ++i ) { fseek( file, offset[i], SEEK_SET ); /* search */ fprintf( file, "%c", patch[i] ); /* patch */ } printf("Patched Done.\n"); } else { printf("[Error]: file not found. \n"); } fclose( file ); return 0; } However, I don't know why it doesn't work??? May some1 help me this? Edited August 5, 2009 by Xcross87 Link to comment Share on other sites More sharing options...
Xcross87 Posted August 5, 2009 Author Share Posted August 5, 2009 Problem found! ^^! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now