1

First of all, it may be that I am just not getting how things work. Stultus sum.

I am using a Mac with OSX (10.9), therefore with x86_64 architecture.

I wanted to play around a bit with compilers and decompilers. I grabbed a random application from my computer and decompiled it using Hopper Disassembler.

Well, nice. I now got my assembly code. First thing I noticed was that you can't just "edit" this code from within Hopper. I guess that's because, if I would edit something, the addresses would go wrong altogether - which would damage the application.

From this point, I tried some different things:

  • I exported the code ("File > Produce Assembly Text File").
  • I extracted nearly the same code with gobjdump.
  • I decompiled the executable using otool.

However, the code I received with these techniques is more or less the same. How do I recompile that assembly code so I got my modified executable? Being able to read the assembly code is sure an interesting thing, but a bit useless, no? :/

So, what do I need to do to get compile-able assembler code?! Is this even possible or do I need to patch the existing executable?

1
  • 1
    When assembling code, some information gets lost, which can't be rebuilt automatically when disassembling. So while a disassembly can help you find out what's going on in the code, you can't hope to get anything workable if you disassemble code, modify it, and re-assemble it. Jason's "duplicate of" link explains this thoroughly. The only thing a disassembler enables you to do is find a few single bytes you want to modify, and use a hex editor to do so. Commented Oct 22, 2014 at 14:01

0

Browse other questions tagged or ask your own question.