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/AppKit
To generate headers of Objective-C classes in a library:
class-dump -H -o /AppKit_Headers /System/Library/Frameworks/AppKit.framework/AppKit 
To 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/AppKit
I've recently also started using  otx. 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值