Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not trace java function with 10.0.12 #283

Closed
DogeWatch opened this issue Jun 12, 2017 · 1 comment
Closed

can not trace java function with 10.0.12 #283

DogeWatch opened this issue Jun 12, 2017 · 1 comment

Comments

@DogeWatch
Copy link

@DogeWatch DogeWatch commented Jun 12, 2017

my code is:
URI = Java.use("java.net.URI");
URI.URI.implementation = function(){
console.log("URI modified");
}

and it says
{u'columnNumber': 1, u'description': u"TypeError: cannot write property 'implementation' of undefined", u'fileName': u'script1.js', u'lineNumber': 17, u'type': u'error', u'stack': u"TypeError: cannot write property 'implementation' of undefined\n at [anon] (duk_hobject_props.c:3352)\n at [anon] (script1.js:17)\n at frida/node_modules/frida-java/lib/vm.js:39\n at y (frida/node_modules/frida-java/index.js:322)\n at frida/node_modules/frida-java/index.js:296\n at frida/node_modules/frida-java/lib/vm.js:39\n at java.js:2209\n at script1.js:18"}

@dzonerzy

This comment has been minimized.

Copy link

@dzonerzy dzonerzy commented Jun 16, 2017

Your code is wrong , since URI is you wrapper class to java.net.URI, if you want to hook constructor , you should do something similar:

var URI = Java.use('java.net.URI');
URI.$init.overload('java.lang.String').implementation = function (url)
{
send("URI object created with value: " + url);
// call the original method not the hooked one
return URI.$init.overload('java.lang.String').call(this, url);
}

We used .overload('java.lang.String') since URI constructor have different signature as stated here https://docs.oracle.com/javase/7/docs/api/java/net/URI.html

@oleavr oleavr closed this Jun 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.