代码:
function hookjavalangString() { Java.perform(function () { var JavaString = Java.use('java.lang.String'); JavaString.$init.overload('java.lang.String').implementation = function (content) { console.log('JavaString.$init.overload(\'java.lang.String\')->' + content); var result = this.$init(content); return result; }; JavaString.$init.overload('[C').implementation = function (content) { console.log("JavaString.$init.overload('[C')->" + content); var result = this.$init(content); return result; }; var StringFactory = Java.use('java.lang.StringFactory'); StringFactory.newStringFromString.implementation = function (arg0) { console.log("java.lang.StringFactory.newStringFromString->" + arg0); var result = this.newStringFromString(arg0); return result; }; var exampleString1 = JavaString.$new('Hello World, this is an example string in Java.'); console.log('[+] exampleString1: ' + exampleString1); }) }