Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to convert an ELF executable to C code? The generated C code need not be human-readable
    primarykey
    data
    text
    <p>I have an ELF file that I would like to decompile into <code>C</code> code, and make simple changes to the resulting <code>C</code> code and rebuild it into an ELF.</p> <p>The decompiled <code>C</code> code need not be fully human readable. Eg, if variables and function names come out obfuscated, it is okay.</p> <p>Which tools can I use to accomplish this on Linux?</p> <p>PS: If decompiling to <code>C</code> is not possible or is not easy, I'm willing to consider decompiling to assembly language, though tweaking the assembly source will be very difficult for me.</p> <p><strong>UPDATE:</strong> You may assume that I'm using the following <code>C</code> program to get my <code>a.out</code> ELF. Now, assume further that I've lost this original <code>C</code> source. So, I would now like to decompile it to (a possibly obfuscated) <code>C</code> source in which I'm at least able to change small things like the strings <code>"world"</code>, <code>"Hello"</code>, and <code>"Bye"</code>, or be able to reverse the sense of the <code>if</code> statement, etc.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; char buf[256]; const char *Hello = "Hello"; const char *Bye = "Bye"; const char *Who = "world"; char * greet(const char *greeting, const char *str) { strcpy(buf, greeting); strcat(buf, ", "); strcat(buf, str); strcat(buf, "!"); return buf; } int main(int argc, char *argv[]) { int sayHello = 0; if(sayHello) { printf("%s\n", greet(Hello, Who)); } else { printf("%s\n", greet(Bye, Who)); } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload