Java.perform(function () {
console.log("start hooking...");
function showstack() {
var log = Java.use("android.util.Log");
var Throwable = Java.use("java.lang.Throwable");
console.log(log.getStackTraceString(Throwable.$new()))
}
var stringBuilder = Java.use("java.lang.StringBuilder");
stringBuilder.toString.implementation = function () {
var result = this.toString.apply(this, arguments);
// if(result == "username=18888888888"){
showstack();
console.log("stringBuilder.toString is called!", result);
// }
return result;
}
})
值得注意的是,我们打印堆栈的时候,不能一上来就直接打印,Frida容易挂掉;
需要过滤再进行打印