Mythology of “It can’t be done” - Chapter 1: Reverse-engineering.
Reverse-engineering seem to be this big misunderstood mystery to a lot of people, even to some of the wiser ones so let’s make this clear once and for all:
Decompilation of arbitrary machine code in the sense machine code to any high level language is possible. It is not an easy task but still very much possible and it doesn’t matter what language, which compiler or what interpreter that was used in the process of creating the machine code - it still can be reversed engineered to any other language supporting the corresponding function.
Think of it like this: Your machine code gets interpreted by the processor all the time, it won’t care about what is code and what is data it only need to understand directives and rules but don’t need comments on how anyone wrote the code or what the naming convention was used on variables or types - this is the type of code you will able to get if you decompile; an uncommented, generically named, indifferent to data and function since these instructions are gone. The outcome will have little or no similarities with the original source code of the program beeing reversed engineered. Any decompiler will most probably have a problem understanding some assembly lines so it will need to be able to run inline assembly in the high level language, even statically linked types or methods might cause some head rush to any decompiler.
In the end a few lines of reversed engineered C will still need a lot of attention and probably won’t succeed all the way leaving you with a headache - but still, its very much possible.
So you could create a generic decompiler of machine code for any processor type and to any high level language that would support the function of the machine code (Please, time travelers of the future; if you read this, we need this program ASAP, stop hogging it!).
Since Java and .NET are JIT compiled mid-level language, they are much easier to decompile than machine code. Here are some tools for you:
Reflector for .NET
Mocha for Java
Learn more:
Martin Ward - Pigs from Sausages? Reengineering from Assembler to C via FermaT Transformations
http://www.reverse-engineering.net
http://www.openrce.org
/ itcommie