其他分享
首页 > 其他分享> > frida 遍历所有当前已经加载的类

frida 遍历所有当前已经加载的类

作者:互联网

frida 遍历所有当前已经加载的类

# -*- coding: UTF-8 -*-
import frida, sys

jsCode = """

Java.perform(function(){

    var imports = Module.enumerateImportsSync("libsoul-netsdk.so");
    for(var i = 0; i < imports.length; i++) {
        if(imports[i].name == 'strncat'){
            send(imports[i].name + ": " + imports[i].170525
            );
            break;
        }
    }

    var exports = Module.enumerateExportsSync("libsoul-netsdk.so");
    for(var i = 0; i < exports.length; i++) {
        if(exports[i].name.indexOf('add') != -1){
            send(exports[i].name + ": " + exports[i].address);
            break;
        }
    }
    for(var i = 0; i < imports.length; i++) {
            send(imports[i].name + ": " + imports[i].address);
        }
        var exports = Module.enumerateExportsSync("libsoul-netsdk.so");
        for(var i = 0; i < exports.length; i++) {
                send(exports[i].name + ": " + exports[i].address);
    }

});

"""

enumerateLoadedClasses_jsCode ="""

Java.perform(function(){
    Java.enumerateLoadedClasses({
        onMatch: function(className) {
            send(className);},
        onComplete:function(){
            send("done");
        }
    });
});
"""
def message(message, data):
    if message["type"] == 'send':
        print(u"[*] {0}".format(message['payload']))
    else:
        print(message)

process = frida.get_remote_device().attach("cn.soulapp.android")
script= process.create_script(enumerateLoadedClasses_jsCode)
script.on("message", message)
script.load()
sys.stdin.read()

标签:exports,遍历,name,imports,send,var,frida,message,加载
来源: https://blog.51cto.com/haidragon/2398126