开发者

Is there any disassembler which generates compilable assembly source code?

I would like to know, is there any Windows platform disassembler (software) can generate the assembly source code which is also compilable by an assembler?

Since disasse开发者_StackOverflow中文版mbler can generate the assembly code based on an EXE file, is it possible the assembly code be used directly as a source code, then the source code be compiled by an assembler like NASM?


IDA can generate the source code. But in most cases you can't edit it. Assume the following code:

 loc_401020:
    ret

 ; ...

 dd 0FFFFFFFFh, 0, 1, 401020h, 0
 ;                    ^^^^^^^ can you find it in big real program?

to insert any new bytes to you must either be shure that any sub_XXXX or loc_XXXX will remain at the same offset, either you must replace all its references to labels.

If you don't move any code, you don't need to recompile it - just patch and maybe extend the code section.


I think IDA is quite good at this.

Anyway, the main problem would be that the generated assembly code would be quite unreadable and very hard to mantain (no variable names, function names and signatures), so altough technically it would be ASM code, it's still better to use IDA as clever editor to deduce this information.


I'd patch the executable directly in a debugger and then save the modified executable.

Decompiling and then recompiling is a fragile process since any change of position of the reassembled code can break the program. And I think there are multiple binary representations of certain asm instructions complicating the matter ever further.


You are losing some information when disassembling an executable so you are unlikely to get a fully working executable when assembling the disassembly. If you are clever, you can extract single functions from an executable, but not the whole program.

The objconv disassembler can produce assembly code in masm, nasm, yasm and gas syntax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜