准备工作,jadx反编译wx708另存为as源码
首先,通过monitor方法回溯从 performClick往下追踪,寻找到关键函数com.tencent.mm.sdk.platformtools.bo.ii,在jadx反混淆后为函数m13717ii
public static int m13717ii(int i, int i2) { AppMethodBeat.m3378i(52299); Assert.assertTrue(i > i2); int nextInt = new Random(System.currentTimeMillis()).nextInt((i - i2) + 1) + i2; AppMethodBeat.m3379o(52299); return nextInt; }
hook此函数,修改返回值,容易判断:
玩骰子时i=5,i2=0,返回0-5对应1-6点
玩石头剪刀布时i=2,i2=0,返回0-2对应石头剪刀布
var bo = Java.use('com.tencent.mm.sdk.platformtools.bo');
bo.ii.overload('int','int').implementation=function(a1,a2)
{ console.log("hook ii start");
console.log("a1:"+a1);
console.log("a2:"+a2);
var rtn= this.ii(5,0);
console.log("rtn:"+rtn);
var threadef = Java.use('java.lang.Thread');
var threadinstance = threadef.$new();
var stack = threadinstance.currentThread().getStackTrace();
function Where(stack){
for(var i = 0; i < stack.length; ++i){
console.log(stack[i].toString());
}
}
console.log("Full call stack:" + Where(stack));
return rtn
}
打印堆栈结果如下
com.tencent.mm.sdk.platformtools.bo.ii(Native Method) m13717ii
com.tencent.mm.plugin.emoji.e.f.n(SourceFile:93) mo46299n
com.tencent.mm.bz.a.n(SourceFile:316) mo46299n
com.tencent.mm.emoji.panel.a.d.a(SourceFile:55) mo46720a
com.tencent.mm.emoji.panel.a.q$1.onClick(SourceFile:27)
android.view.View.performClick(View.java:6294)
android.view.View$PerformClick.run(View.java:24770)
android.os.Handler.handleCallback(Handler.java:790)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loop(Looper.java:164)
android.app.ActivityThread.main(ActivityThread.java:6494)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
首先,通过抛异常然后调用Exception的run方法的方式 反射调用main方法
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2020-2-7 11:58
被挤蹭菌衣编辑
,原因: