From 14b485c41feb42e46b8affa1012959fdb0650784 Mon Sep 17 00:00:00 2001 From: r0ysue Date: Thu, 24 Jun 2021 15:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B2=BE=E7=AE=80=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- r0tracer.js | 55 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/r0tracer.js b/r0tracer.js index 3f67dc2..34277fa 100644 --- a/r0tracer.js +++ b/r0tracer.js @@ -1,3 +1,4 @@ +var isLite = false; var ByPassTracerPid = function () { var fgetsPtr = Module.findExportByName("libc.so", "fgets"); var fgets = new NativeFunction(fgetsPtr, 'pointer', ['pointer', 'int', 'pointer']); @@ -101,47 +102,55 @@ function traceMethod(targetClassMethod) { //画个横线 for (var p = 0; p < 100; p++) { output = output.concat("=="); - } + } //域值 - output = inspectObject(this, output); + if (!isLite) { output = inspectObject(this, output); } //进入函数 output = output.concat("\n*** entered " + targetClassMethod); output = output.concat("\r\n") - if (arguments.length) console.Black(); + // if (arguments.length) console.Black(); //参数 - for (var j = 0; j < arguments.length; j++) { - output = output.concat("arg[" + j + "]: " + arguments[j] + " => " + JSON.stringify(arguments[j])); - output = output.concat("\r\n") - } - //调用栈 - output = output.concat(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new())); var retval = this[targetMethod].apply(this, arguments); - //返回值 - output = output.concat("\nretval: " + retval + " => " + JSON.stringify(retval)); + if (!isLite) { + for (var j = 0; j < arguments.length; j++) { + output = output.concat("arg[" + j + "]: " + arguments[j] + " => " + JSON.stringify(arguments[j])); + output = output.concat("\r\n") + } + //调用栈 + output = output.concat(Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Throwable").$new())); + //返回值 + output = output.concat("\nretval: " + retval + " => " + JSON.stringify(retval)); + } // inspectObject(this) //离开函数 output = output.concat("\n*** exiting " + targetClassMethod); //最终输出 // console.Black(output); - var r = parseInt((Math.random() * (3 - 1 + 1) + 1).toFixed(0)); + var r = parseInt((Math.random() * 7).toFixed(0)); var i = r; var printOutput = null; - switch(i) { + switch (i) { case 1: - printOutput = console.Purple; - break; + printOutput = console.Red; + break; case 2: - printOutput = console.Blue; - break; + printOutput = console.Yellow; + break; case 3: printOutput = console.Green; - break; - case 4: - printOutput = console.Red; + break; + case 4: + printOutput = console.Cyan; + break; + case 5: + printOutput = console.Blue; + break; + case 6: + printOutput = console.Gray; break; default: - printOutput = console.LightGreen; - } + printOutput = console.Purple; + } printOutput(output); return retval; } @@ -242,6 +251,8 @@ function main() { // hook("javax.crypto.Cipher", "$"); //C. 报某个类找不到时,将某个类名填写到第三个参数,比如找不到com.roysue.check类。(前两个参数依旧是黑白名单) // hook("com.roysue.check"," ","com.roysue.check"); + //D. 增加精简模式,就是以彩虹色只显示进出函数。默认是关闭的,注释此行打开精简模式。 + //isLite = true; }) } /*