获取类中的成员变量/方法

Java.perform(function(){
    var hook = Java.use("com.xxx.xxx");
    console.log("aa: ", hook)
    //获取成员变量
    //getFields():获得某个类的所有的公共(public)的字段,包括父类中的字段。 
    //getDeclaredFields():获得某个类的所有声明的字段,即包括public、private和proteced,但是不包括父类的申明字段。
    //同样类似的还有getConstructors()和getDeclaredConstructors()、getMethods()和getDeclaredMethods(),这两者分别表示获取某个类的方法、构造函数
    var members = hook.class.getDeclaredFields();
    members.forEach(function(member) {
        // 
        console.log("member: ", member);
    });  
})

java层打印调用堆栈

console.log(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()));

java.use(com.xxx.xxx)

Java.perform(function(){
    targetClass = "com.xxx.xxx"
    try {
        // 先用 java.use 如果找不到 在枚举classload
        Java.use(targetClass);
    } catch (error) {
        Java.enumerateClassLoaders({
            onMatch: function (loader) {
                try {
                    if (loader.findClass(targetClass)) {
                        console.log("loader find: " + loader);
                        Java.classFactory.loader = loader;
                    }
                } catch (error) {
                    //console.log("classloader failed" + error);
                }
            }, onComplete: function () {

            }
        });
    }
    var hook = Java.use(targetClass);
})

frida 通过wifiadb实现群控

import frida
import os
import time

app = "com.xxx.xxx";

deviceIds = [];
devices = frida.enumerate_devices();
for device in devices :
    # print(device)
    ## 枚举所有通过wifiadb 连的机器
    if device.id.find(":") > 0:
        #print(device.id)
        deviceIds.append(device.id.replace("5555", "9999"))

for id in deviceIds :
    print(id)
    device = frida.get_device_manager().add_remote_device(id)
    print(device)
    pid = device.spawn([app])
    print(pid)
    device.resume(pid)
    time.sleep(1)
    session = device.attach(pid)
    with open("load_hook.js") as f:
        script = session.create_script(f.read())
        script.load()
input()

 

相关文章:

  • 2021-04-18
  • 2021-10-25
  • 2021-08-02
  • 2021-12-29
  • 2022-12-23
  • 2022-03-06
  • 2021-12-04
  • 2021-11-30
猜你喜欢
  • 2022-02-28
  • 2021-12-28
  • 2021-06-12
  • 2021-06-26
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案