Saturday 15 February 2014

linux - How to convert an ELF executable to C code? The generated C code need not be human-readable -


I have an ELF file that I would like to decompress in the code C , and make simple changes As a result, C code and recreate it in an ELF.

The decompiled C code does not need to be completely human readable. For example, if variables and functions are named, then it's OK.

Which tools can I use to accomplish this on Linux?

PS: If C is not possible or not easy, I am willing to consider decompiling assembly language, although assembly sources would be very difficult for me.

Update: You can assume that I use the following C program to get my a.out ELF I am doing Now, suppose I lost this original C source, now I would like to decompile it in (possibly obscure) C source, in which I am the least I'll change things like strings "world" , "hello" , and "bye" , or if statement , Etc ..

  #include & lt; Stdio.h & gt; #include & lt; String.h & gt; Four buff [256]; Const char * hello = "hello"; Const char * by = "bye"; Const char * Who = "World"; Four * greetings (const char * greeting, const char * str) {strcpy (buf, greeting); Dome (buff, ","); Dome (buff, str); Dome (Buff, "!"); Return buff; } Int main (int argc, char * argv []) {int sayHello = 0; If (say hello) {printf ("% s \ n", hello (hello, who)); } Other {printf ("% s \ n", hello (bye, who)); } Return 0; This will give you (approximate) assembly code translation from:    

< Previous> Ozdump - Decimals & lt; Elf file & gt; I almost say that because output contains some annotations such as binary file position marker and can not provide CDB directly as input, but it is closed.

No comments:

Post a Comment