app逆向-frida hook 某个java类下的所有方法

import frida
import sys


hook_class ="""
Java.perform(function(){
    hookclass('com.xbiao.login.PhoneLoginActivity')
})

function printstack() {
    console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()))
}

function hookclass(className){
    var Myclasa = Java.use(className)
    //得到类下的所有方法
    var methods = Myclasa.class.getDeclaredMethods()
    //遍历所有方法
    methods.forEach(function(method){
        //获得方法名
        var methodName = method.getName()
        //获得该方法得所有重载
        var overloads = Myclasa[methodName].overloads
        //遍历重载
        overloads.forEach(function(overload){
            //hook 重载
            
            var prot = '('
            for (var i=0; i
process = frida.get_usb_device(-1).attach("com.xxxxx")
script= process.create_script(hook_class)
script.load()
sys.stdin.read()

你可能感兴趣的:(app逆向随笔,java,javascript,前端)