我正在尝试将postNotificationName函数与Frida挂钩。我称其为两个职能:
sO,当我使用frida跟踪函数时,我看到在后面的例子中有对postNotificationName的调用。我想知道postNotification是否打电话给postNotification,为什么会这样?
另外,
var newObject = ObjC.classes.NSNotification;
var myObj = newObject.alloc().initWithName_object_userInfo_('notificationName','nil','userInfo');
var hook = ObjC.classes.NSNotificationCenter["- postNotification:"];
Interceptor.attach(hook.implementation, {
onEnter: function(args) {
console.log("\n[*] Detected call to: " + NsNotificationCenter + " -> " + postNotification);
console.log("\t[-] Argument Value: " + args[2]);
args[2] = ptr(myObj)
console.log("\t[-] New Argument Value: " + args[2])
}当注入使用Frida挂钩postNotification函数时工作。然而,
var nsName = ObjC.classes.NSString;
var notificationName= nsName.stringWithString_("Blah");
var hook = ObjC.classes.NSNotificationCenter["- postNotificationName:"];
Interceptor.attach(hook.implementation, {
onEnter: function(args) {
console.log("\n[*] Detected call to: " + NSNotificationCenter + " -> " + postNotificationName);
console.log("\t[-] Argument Value: " + args[2]);
args[2] = ptr(notifname)
console.log("\t[-] New Argument Value for postNotificaitonName: " + args[2])
}
});不适用于postNotificationName:Object:userInfo。我猜问题在"var钩子= ObjC.classes.NSNotificationCenter"- postNotificationName:";“一行中。有人知道它有什么问题吗?如何使它工作?
谢谢
发布于 2020-08-28 18:16:13
根据苹果文档,类NSNotificationCenter没有选择器"- postNotificationName:"。
有两个具有该名称的选择器,但它们有其他参数:
"- postNotificationName:object:userInfo:""- postNotificationName:object:"如果您想连接这些选择器中的任何一个,您必须使用完整的选择器字符串,如上面所述,用于挂钩:
var hook = ObjC.classes.NSNotificationCenter["- postNotificationName:object:userInfo:"];或
var hook = ObjC.classes.NSNotificationCenter["- postNotificationName:object:"];https://stackoverflow.com/questions/63638460
复制相似问题