public String toString() { Stringstr=this.a; if (str == null) { return""; } if (this.b == null) { return str; } returnthis.a + "&sign=" + this.b; } }
LibBili类里的 g 函数使用了它,对 g 做 Hook,代码如下
1 2 3 4 5 6 7 8 9 10
Java.perform(function() { letLibBili = Java.use("com.bilibili.nativelibrary.LibBili"); letMap = Java.use('java.util.HashMap'); LibBili["g"].implementation = function (map) { console.log('g is called' + ', ' + 'map: ' + Java.cast(map, Map)); let ret = this.g(map); console.log('g ret value is ' + ret.toString());//自定义SignedQuery类,但存在toString方法 return ret; }; })
输出很多,随便选择一条
1 2 3 4
g is called, map: {build=6180500, mobi_app=android, channel=shenma069, appkey=1d8b6e7d45233436, s_locale=zh_CN, c_locale=zh_CN, platform=android, statistics={"appId":1,"platform":3,"version":"6.18.0","abtest" :""}} g ret value is appkey=1d8b6e7d45233436&build=6180500&c_locale=zh_CN&channel=shenma069&mobi_app=android&platform=android&s_locale=zh_CN&statistics=%7B%22appId%22%3A1%2C%22platform%22%3A3%2C%22version%22%3A%226 .18.0%22%2C%22abtest%22%3A%22%22%7D&ts=1665717038&sign=0186ec11e22282128c5d25c82f9813dc
JNIEnv->NewStringUTF("appkey") was called from RX@0x12003019[libbili.so]0x3019 [10:51:43 331] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:538) - handleInterrupt intno=2, NR=-452987312, svcNumber=0x11e, PC=unidbg@0xfffe0274, LR=RX@0x120064dd[libbili.so]0x64dd, syscall=null java.lang.UnsupportedOperationException: java/util/Map->get(Ljava/lang/Object;)Ljava/lang/Object; at com.github.unidbg.linux.android.dvm.AbstractJni.callObjectMethod(AbstractJni.java:933) at com.github.unidbg.linux.android.dvm.AbstractJni.callObjectMethod(AbstractJni.java:867) at com.github.unidbg.linux.android.dvm.DvmMethod.callObjectMethod(DvmMethod.java:69)
JNIEnv->NewStringUTF("1732417097") was called from RX@0x12003471[libbili.so]0x3471 [10:58:17 098] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:538) - handleInterrupt intno=2, NR=-452987368, svcNumber=0x11e, PC=unidbg@0xfffe0274, LR=RX@0x1200659d[libbili.so]0x659d, syscall=null java.lang.UnsupportedOperationException: java/util/Map->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; at com.github.unidbg.linux.android.dvm.AbstractJni.callObjectMethod(AbstractJni.java:933) at com.bilibili.nativelibrary.LibBili.callObjectMethod(LibBili.java:89)
JNIEnv->CallObjectMethod(java.util.TreeMap@291caca8, put("ts", "1732417308") => null) was called from RX@0x1200659d[libbili.so]0x659d [11:01:48 382] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:538) - handleInterrupt intno=2, NR=-452987096, svcNumber=0x16e, PC=unidbg@0xfffe0774, LR=RX@0x12003077[libbili.so]0x3077, syscall=null java.lang.UnsupportedOperationException: com/bilibili/nativelibrary/SignedQuery->r(Ljava/util/Map;)Ljava/lang/String; at com.github.unidbg.linux.android.dvm.AbstractJni.callStaticObjectMethod(AbstractJni.java:433) at com.github.unidbg.linux.android.dvm.AbstractJni.callStaticObjectMethod(AbstractJni.java:422) at com.github.unidbg.linux.android.dvm.DvmMethod.callStaticObjectMethod(DvmMethod.java:54)
call s result: appkey=1d8b6e7d45233436&build=6180500&channel=shenma069&mobi_app=android&s_locale=zh_CN&ts=1732419383&sign=828f57ba1aca689e080040a582e44fd5