antojoseph / frida-android-hooks

Lets you hook Method Calls in Frida ( Android )
389 stars 95 forks source link

use'$new'for android js #3

Closed gitQqqHs closed 7 years ago

gitQqqHs commented 7 years ago

do this: var s = Java.use('java.lang.String'); var ss2 = s.$new('str'); ss2.$dispose();

get the error info: {u'columnNumber': 1, u'description': u'Error: Not allowed outside Java.perform() callback', u'fileName': u'frida/node_modules/frida-java/index.js', u'lineNumber': 79, u'type': u'error', u'stack': u'Error: Not allowed outside Java.perform() callback\n at d (frida/node_modules/frida-java/index.js:79)\n at frida/node_modules/frida-java/index.js:355\n at script2.js:29\n at call (native)\n at c (input:1)'}

Java.perform(function () { var Activity = Java.use("android.app.Activity"); var Exception = Java.use("java.lang.Exception"); //ok Activity.onResume.implementation = function () { var Exception = Java.use("java.lang.Exception"); //error outside java.perform()

    throw Exception.$new("Oh noes!");
};

});

DogeWatch commented 7 years ago

I have the same question