What is a good program to use to convert assembly or binary files to c, or other high level languages?
Posted on 2002-10-24 17:26:19 by samps005
I've heard one before but I don't know if it really exists because I didn't bother to take a look at it.

The best way to convert asm->C is to do it yourself. Understand what a particular group of instructions are doing and translate them piece by piece. Also, try to see the bigger picture. Look at the whole program, it's program flow.... and create a "skeleton", then translate each parts to C. This is the best way to do it.

E.G.
mov eax, number

cmp eax, 1
jne __2

;Code

jmp __exit

__2:
cmp eax, 2
jne __3

;Code

jmp __exit

__3:
cmp eax, 3
jne __default

;Code

jmp __exit

__default:

;Code

__exit:
This one looks like an if-elseif-else style of branching. You can optimize this by using a switch-case statements rather than the if-elseif-else.


switch(number)
{
case 1:

//Code

break;
case 2:

//Code

break;
case 3:

//Code

break;
default:

//Code

}
Why it's more optimized than if-elseif-else? It depends on the compiler, a good compiler will create a jump table...

You see, it's much better to do it yourself. And it's much more fun. ;)
Posted on 2002-10-25 15:25:44 by stryker
BTW your asking something like a burger beef patty to cow converter. :grin:
Posted on 2002-10-25 16:28:58 by stryker

BTW your asking something like a burger beef patty to cow converter. :grin:


Nice analogy :D
Posted on 2002-10-25 16:37:58 by x86asm
converting to C++ will be the hardest. Each compiler handles it's objects differents, and within that, each optimization and other compile flag or option changes things even more differently.

I have someones thesis on RE (converting machine x86 code back into C) and looks to be good, but it isn't smart enough for a lot of what I see coming through VC++ and Borland C++/Builder or Metrowerks compilers... I've thought I found a much simpler approach (I can look at opcode patterns and recognize exactly what's going on -- and think I can transfer that into an automated process) to being successful but I don't have the time to developing it (don't know how to program nueral nets and fuzzy logic at the moment)... it's also not important to me. These days, if I ever made such a tool, I could end up in jail.

Thanks,
_Shawn
Posted on 2002-10-25 16:40:22 by _Shawn
Shawn: I would assume it's Christina Cifuentes's paper about "Reverse compilation of binary programs" She has some good theories about how to create such a tool. I'm implementing some of her ideas in my own program.
Posted on 2002-10-25 20:56:30 by Asm_Freak
In these days, by chance I found DisC Turbo C++ decompiler:

http://www.debugmode.com/dcompile/disc.htm

The program includes VC++ source code.
Posted on 2002-10-27 05:11:44 by n u M I T_o r