Mac|Mac下窥探私有API
苹果已走向平民化,所以着手mac下的开发,发现一篇文章,与大家分享:http://cocoainchromium.blogspot.com/2011/05/disassembling-private-apis-on-mac-os-x.html
【Mac|Mac下窥探私有API】
Disassembling Private APIs on Mac OS X
There are several ways to reverse engineer private APIs on Mac OS X. For example, if you needed to know how a certain AppKit function was implemented, you could try some of the following.
To find APIs in a library:
nm -g /System/Library/Frameworks/AppKit.framework/AppKitTo generate headers of Objective-C classes in a library:
class-dump -H -o /AppKit_Headers /System/Library/Frameworks/AppKit.framework/AppKitTo view the disassembly of a function:
gdb /Applications/Calculator.app/Contents/MacOS/Calculator
break -[NSApplication run]
run
disas
To generate disassembly for an entire library:
otool -tV /System/Library/Frameworks/AppKit.framework/AppKitI've recently also started usingotx. This works very similarly to otool but in addition it will annotate the assembly. The best part is that it will resolve Objective-C calls making it much easier to tell what a function is doing. Here's a sample output of otool (top) vs otx (bottom):
Until I discovered otx I had to trace Objective-C using the si/ni commands in gdb to figure out what a function was doing.
推荐阅读
- 开学第一天(下)
- 【故障公告】周五下午的一次突发故障
- Mac安装Chromedriver
- 生活随笔|好天气下的意外之喜
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- 汇讲-勇于突破
- Android中的AES加密-下
- 说的真好
- 放下心中的偶像包袱吧
- MAC安装Mongo