Hi,
So with Frida 17, runtime bridges, such as the Java runtime bridge, must be added manually to a custom agent script.
This works for me when concatenating the bridge code with whatever other Frida script I want to load, and then calling script.load from python.
The problem is that it's harder to debug bugs in a Frida script, when the error message points to line ~13'000, because the buggy Frida script was appended to the bridge script. Is there a way to load the bridge script separately?
The following script shows the problem:
importfridaimportosimporttimeprocess="SOME APP"device=frida.get_usb_device()
pid=device.get_process(process).pidsession=device.attach(pid)
withopen('/home/user/frida_java_bridge.js', 'r') asbridgefile:
bridge_source=bridgefile.read()
script1_source="""console.log('hello form script1')"""script2_source="""console.log('hello form script2a');Java.perform(function() {console.log('inside Java runtime')});console.log('hello form script2b');"""bridge=session.create_script(bridge_source)
script1=session.create_script(script1_source)
script2=session.create_script(script2_source)
print("one by one:")
bridge.load()
script1.load()
script2.load()
print("concatenated:")
script3=session.create_script(bridge_source+script2_source)
script3.load()output:
one by one:
hello form script1
hello form script2a
concatenated:
hello form script2a
inside Java runtime
hello form script2b
Hi,
So with Frida 17, runtime bridges, such as the Java runtime bridge, must be added manually to a custom agent script.
This works for me when concatenating the bridge code with whatever other Frida script I want to load, and then calling
script.loadfrom python.The problem is that it's harder to debug bugs in a Frida script, when the error message points to line ~13'000, because the buggy Frida script was appended to the bridge script. Is there a way to load the bridge script separately?
The following script shows the problem:
output: