用ApiResolver去hook已触发函数但没日志

var resolver = new ApiResolver('objc');
resolver.enumerateMatches('*[AAUISignInViewController *]', {
  onMatch: function(match) {
    console.log(match['name'] + ":" + match['address']);
  },

  onComplete: function() {}
});
  • 原因:此处ApiResolver只是search查找,函数是否存在,只运行一次,后续的确,本身就不会再次触发,所以后续代码被触发时,就不会打印日志
  • 解决办法:真正的要实现,hook函数,待函数被运行后触发日志打印,应该改用:Interceptor
  • 具体写法
// https://github.com/noobpk/frida-ios-hook/blob/master/frida-ios-hook/frida-scripts/hook-specific-method-of-class.js
function hook_specific_method_of_class(className, funcName)
{
  // console.log("className=" + className + ", funcName=" + funcName)
  var curClass = ObjC.classes[className];
  if (typeof(curClass) !== 'undefined') {
    var curMethod = curClass[funcName];
    if (typeof(curMethod) !== 'undefined') {
      Interceptor.attach(curMethod.implementation, {
        onEnter: function(args) {
          console.log("argSelf=" + args[0] + ", argSel=" + args[1] + ", realArg1=" + args[2]);
        }
      });
    }else{
      console.log("Can't find method", funcName);
    }
  }else{
    console.log("Can't find class: ", className);
  }
}

//Your class name  and function name here
hook_specific_method_of_class("NSXPCConnection", "- setExportedObject:")

results matching ""

    No results matching ""