> adb.exe devices List of devices attached 127.0.0.1:62026 device
> adb.exe connect 127.0.0.1:62026 adb server version (32) doesn't match this client (36); killing... * daemon started successfully * connected to 127.0.0.1:62026
js_code =''' console.log("Script loaded successfully "); Java.perform(function x() { //Silently fails without the sleep from the python code console.log("Inside java perform function"); //get a wrapper for our class var my_class = Java.use("com.example.a11x256.frida_test.my_activity"); //replace the original implmenetation of the function `fun` with our custom function my_class.fun.implementation = function (x, y) { //print the original arguments console.log("original call: fun(" + x + ", " + y + ")"); //call the original implementation of `fun` with args (2,5) var ret_value = this.fun(2, 5); return ret_value; } }); '''
device = frida.get_remote_device() pid = device.spawn(["com.example.a11x256.frida_test"]) device.resume(pid) time.sleep(1) # Without it Java.perform silently fails session = device.attach(pid) script = session.create_script(js_code) #with open("s1.js") as f: # script = session.create_script(f.read()) script.load()
# prevent the python script from terminating sys.stdin.read()