update toString hook

This commit is contained in:
iddoeldor 2018-10-17 17:23:00 +03:00 committed by GitHub
parent 6fd5ea6984
commit 952c0f8ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -674,16 +674,17 @@ Java.perform(function() {
var func = 'toString'; var func = 'toString';
Java.use(clazz)[func].implementation = function() { Java.use(clazz)[func].implementation = function() {
var ret = this[func](); var ret = this[func]();
send('[' + i + '] ' + ret); if (ret.indexOf('') != -1) {
// raising an exception to get stacktrace // print stacktrace if return value contains specific string
Java.perform(function() { Java.perform(function() {
Java.use('java.lang.Exception').$new().getStackTrace().toString().split(',').forEach(function(l) { var jAndroidLog = Java.use("android.util.Log"), jException = Java.use("java.lang.Exception");
console.log('\t[*] ' + l); console.log( jAndroidLog.getStackTraceString( jException.$new() ) );
});
}); });
} }
send('[' + i + '] ' + ret);
return ret; return ret;
}; }
});
}); });
``` ```