我想通过与 frida 挂钩来改变 onClick 方法的行为。我使用的代码是
Java.perform(function() {
console.log("[*] START...")
var mClass = Java.use("sg.vantagepoint.uncrackable1.MainActivity")
mClass.a.onClick.implementation=function() {
console.log("[*] Clicked ")
}
})
我收到错误
TypeError: cannot write property 'implementation' of undefined
at [anon] (../../../frida-gum/bindings/gumjs/duktape.c:57636)
at /uncrackable1.js:6
at frida/node_modules/frida-java-bridge/lib/vm.js:11
at E (frida/node_modules/frida-java-bridge/index.js:346)
at frida/node_modules/frida-java-bridge/index.js:298
at frida/node_modules/frida-java-bridge/lib/vm.js:11
at frida/node_modules/frida-java-bridge/index.js:278
at /uncrackable1.js:11
源代码是
private void a(String str) {
AlertDialog create = new AlertDialog.Builder(this).create();
create.setTitle(str);
create.setMessage("This is unacceptable. The app is now going to exit.");
create.setButton(-3, "OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int i) {
System.exit(0);
}
});