RE: assembly conversion
It is relatively easy for someone who understands assembly to look at the disassembler output and figure out what a code portion of special interest does, such as an encryption algorithm or controlling a proprietary piece of hardware. They can then rewrite it in C or whatever. The hardest part usually is finding the code you are looking for.
I stress "code of special interest." Doing this for an entire application isn't practical. 90% or more of any application is code that performs tedious simple tasks, like display windows and menus. That is much faster to code from scratch than it is to reverse engineer.
I have seen and experimented with various "decompilers". The problem is compiling to native code, especially with a good optimizing compiler, is a one way process. When reduced to optimized machine code, there is no difference between, say, switch and case vs. many nested if statements, or between different kinds of loops. They are interchangeable and exist to make code more readable. The decompiler can't tell what it originally was.
It is even difficult to distinguish what once was object oriented code using classes, from procedural code passing around pointers to structs (which is basically how classes work behind the scenes). For statically linked code, it can be tough to tell where the program's code ends and standard library/framework code begins. The decompiler may just decompile it all equally. Of course, there are no comments or any of the original variable and function names.
The result is basically garbage and you would be better off just looking at the disassembler output. Humans (at least those who should be doing this kind of thing) are a lot more intelligent than any decompiler.
On the contrary, .NET code can be decompiled to pretty much what it started out as, thanks to its use of the intermediate byte-code and its self-documenting features. I'd expect the same to be true for Java and anything else using intermediate code.
People might be able to help you better if you tell us what exactly is behind your questions and what you want to accomplish.
|