Extract Objective-c binary

十年热恋 提交于 2019-12-30 03:35:49

问题


Is it possible to extract a binary, to get the code that is behind the binary? With Class-dump you can see the implementation addresses, but is it possible to also see the code thats IN the implementation addresses? Is there ANY way to do it?


回答1:


All your code compiles to single instructions, placed in the text section of your executable. The compiler is responsible for translating your higher level language to the processor specific instructions, which are simpler. Reverting this process would be nearly impossible, unless the code is quite simple. Some problems are ambiguity of statements, and the overall readability: local variables, for instance, will be nothing but an offset address.

If you want to read the disassembled code (the instructions of which the higher level code was compiled to) use this command in an executable:

otool -tV file




回答2:


You can decompile (more accurately, disassemble) a binary and get it's assembly, but there is no way to get back the original Objective-C.

My curiosity begs me to ask why you want to do this!?




回答3:


otx http://otx.osxninja.com/ is a good tool for symbolicating the otool based disassembly It will handle both x86_64 and i386 disassembly.

and

Mach-O-Scope https://github.com/smorr/Mach-O-Scope is a a tool built on top of otx to dump it all into a sqlite3 database for browsing and annotating.

It won't give you the original source -- but it will get you pretty close providing you with the messages that are being sent around in methods.



来源:https://stackoverflow.com/questions/7894666/extract-objective-c-binary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!