# -*- 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()