android TypeError:无法读取Frida中未定义的属性“getPackageInfo”

osh3o9ms  于 2023-01-07  发布在  Android
关注(0)|答案(1)|浏览(141)

嗨,我试图调用一个方法(getPackageInfo)使用Frida,但我得到这个错误:TypeError: cannot read property 'getPackageInfo' of undefined。代码如下:

Java.perform(()=>{
    const jPM=Java.use('android.app.ApplicationPackageManager');
    jPM.getPackageInfo.overload('java.lang.String','int').implementation=(pname,f)=>{
        console.log("Called => getPackageInfo (Flag="+f+", Pkg="+pname+")");
        return this.getPackageInfo.overload('java.lang.String','int').call(this,pname,f);
    }
});

错误来自这一行:return this.getPackageInfo.overload('java.lang.String','int').call(this,pname,f);

jmp7cifd

jmp7cifd1#

常见的方法是保存对挂钩方法的引用,并在您想要调用原始实现时重用它:

Java.perform(()=>{
    const jPM=Java.use('android.app.ApplicationPackageManager');
    const getPImethod = jPM.getPackageInfo.overload('java.lang.String','int');
    getPImethod.implementation=(pname,f)=>{
        console.log("Called => getPackageInfo (Flag="+f+", Pkg="+pname+")");
        return getPImethod.call(this,pname,f);
    }
});

相关问题