Closed alvarofe closed 5 years ago
swapping these two lines
yield exports.init();
yield device.resume(spawn.pid);
for
yield device.resume(spawn.pid);
yield exports.init();
load the script correctly. I assume the process is still not created and this.method.apply crash.
Is this really early instrumentation? I would like to apply the scripts before to resume
I am running into the same problem attempting to use one of the cleaned up gating examples:
rpc.exports = {
init: function () {
console.log('entered init');
if (!Java.available) {
console.log('no java sorry');
} else {
console.log('has java!');
Java.perform(function () {
console.log('entered java perform');
const Activity = Java.use("android.app.Activity");
Activity.onResume.implementation = function () {
send("onResume");
this.onResume();
};
});
}
},
}
> python legging.py
Enabled spawn gating
Pending: []
Waiting for data
on_spawned: Spawn(pid=22420, identifier="app_name_sanitized")
Instrumenting: Spawn(pid=22420, identifier="app_name_sanitized")
entered init
has java!
Processed: Spawn(pid=22420, identifier="app_name_sanitized")
Waiting for data
on_message: Spawn(pid=22420, identifier="app_name_sanitized") {'type': 'error', 'description': 'Error: access violation accessing 0x4d008d', 'stack': 'Error: access violation accessing 0x4d008d\n at frida/node_modules/frida-java/lib/env.js:206\n at apply (native)\n at frida/node_modules/frida-java/lib/env.js:201\n at frida/node_modules/frida-java/lib/class-factory.js:113\n at frida/node_modules/frida-java/lib/class-factory.js:1621\n
at call (native)\n at getPackageInfoNoCheck (input:1)\n at apply (native)\n at r (frida/node_modules/frida-java/lib/class-factory.js:842)\n [...]', 'fileName': 'frida/node_modules/frida-java/lib/env.js', 'lineNumber': 206, 'columnNumber': 1} None
Issue was in frida-java, and should be fixed.
I took this as start point https://gist.github.com/oleavr/ae7bcbbb9179852a4731.
Here is the code
gating.js
agent.js
But I am getting this
FWIW I've not been able to make spawn, attach and resume to work. I am doing the following being spawn-agent.js the same agent without rpc.exports.
Here an asciinema https://asciinema.org/a/539my8j4jrmkghbgrdbtb3pdt
Am i doing it wrong ?