|
@@ -1,6 +1,12 @@
|
|
|
+import {logColor, LogColor} from "./logger";
|
|
|
+
|
|
|
export let HOOK_DY = {
|
|
|
- hookTextViewClick: function () {
|
|
|
- Java.perform(function () {
|
|
|
+ printStackTrace: function () {
|
|
|
+ Java.use("android.util.Log").getStackTraceString(Java.use("java.lang.Exception").$new()).split("\n").forEach(function (line) {
|
|
|
+ console.log(line);
|
|
|
+ });
|
|
|
+ }, hookTextViewClick: function () {
|
|
|
+ function hookTextView() {
|
|
|
var View = Java.use("android.view.View");
|
|
|
var TextView = Java.use("android.widget.TextView");
|
|
|
|
|
@@ -13,24 +19,24 @@ export let HOOK_DY = {
|
|
|
var textView = Java.cast(this, TextView);
|
|
|
let text = textView.getText();
|
|
|
console.log("id: " + textView.getId(), "\t\t >>> \t\t" + text)
|
|
|
- if (text.toString().includes("***")) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- console.log("1111")
|
|
|
- var jThrowable = Java.use("java.lang.Throwable");
|
|
|
- console.log("2222")
|
|
|
- var jStackTrace = jThrowable.$new().getStackTrace();
|
|
|
- console.log("Stack trace:");
|
|
|
- jStackTrace.forEach(function (stackTraceElement) {
|
|
|
- console.log("\t" + stackTraceElement.toString());
|
|
|
- });
|
|
|
- console.log("33333")
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
} catch (e) {
|
|
|
- console.log("报错:",e);
|
|
|
+ console.log("报错:", e);
|
|
|
}
|
|
|
} else {
|
|
|
|
|
@@ -39,20 +45,163 @@ export let HOOK_DY = {
|
|
|
|
|
|
this.setOnClickListener(listener);
|
|
|
};
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- setTimeout(function (){
|
|
|
- let use = Java.use("X.0mSO");
|
|
|
- if (use!==null){
|
|
|
- console.log("hook java")
|
|
|
- use.LIZJ.overload().implementation=function () {
|
|
|
- let lizj = this.LIZJ();
|
|
|
- console.log("call lizj:",lizj);
|
|
|
- return lizj;
|
|
|
+ function hookSocket() {
|
|
|
+ Java.perform(function () {
|
|
|
+
|
|
|
+ var SocketOutputStream = Java.use("java.net.SocketOutputStream");
|
|
|
+ SocketOutputStream.write.overload('[B').implementation = function (b) {
|
|
|
+ console.log("SocketOutputStream.write:", Java.array('byte', b));
|
|
|
+ return this.write(b);
|
|
|
+ };
|
|
|
+ SocketOutputStream.write.overload('[B', 'int', 'int').implementation = function (b, off, len) {
|
|
|
+ console.log("SocketOutputStream.write with offset and length:", Java.array('byte', b).slice(off, off + len));
|
|
|
+ return this.write(b, off, len);
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ var SocketInputStream = Java.use("java.net.SocketInputStream");
|
|
|
+ SocketInputStream.read.overload('[B').implementation = function (b) {
|
|
|
+ var result = this.read(b);
|
|
|
+ console.log("SocketInputStream.read:", Java.array('byte', b));
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ SocketInputStream.read.overload('[B', 'int', 'int').implementation = function (b, off, len) {
|
|
|
+ var result = this.read(b, off, len);
|
|
|
+ console.log("SocketInputStream.read with offset and length:", Java.array('byte', b).slice(off, off + len));
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ let IMessageReceiveListener = Java.use("com.bytedance.frameworks.baselib.network.http.cronet.websocket.IMessageReceiveListener");
|
|
|
+ IMessageReceiveListener["onConnection"].implementation = function (i, str, jSONObject) {
|
|
|
+ console.log(`IMessageReceiveListener.onConnection is called: i=${i}, str=${str}, jSONObject=${jSONObject}`);
|
|
|
+ this["onConnection"](i, str, jSONObject);
|
|
|
+ };
|
|
|
+ IMessageReceiveListener["onFeedBackLog"].implementation = function (str) {
|
|
|
+ console.log(`IMessageReceiveListener.onFeedBackLog is called: str=${str}`);
|
|
|
+ this["onFeedBackLog"](str);
|
|
|
+ };
|
|
|
+ IMessageReceiveListener["onMessage"].implementation = function (bArr, i) {
|
|
|
+ console.log(`IMessageReceiveListener.onMessage is called: bArr=${bArr}, i=${i}`);
|
|
|
+ this["onMessage"](bArr, i);
|
|
|
+ };
|
|
|
+
|
|
|
+ let IWsClient = Java.use("com.bytedance.frameworks.baselib.network.http.cronet.websocket.IWsClient");
|
|
|
+ IWsClient["sendMessage"].implementation = function (bArr, i) {
|
|
|
+ console.log(`IWsClient.sendMessage is called: bArr=${bArr}, i=${i}`);
|
|
|
+ let result = this["sendMessage"](bArr, i);
|
|
|
+ console.log(`IWsClient.sendMessage result=${result}`);
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ function hookDebugMode() {
|
|
|
+ let DebugUtil = Java.use("com.bytedance.bdp.appbase.debug.DebugUtil");
|
|
|
+ DebugUtil["debug"].implementation = function () {
|
|
|
+ console.log(`DebugUtil.debug is called`);
|
|
|
+ let result = this["debug"]();
|
|
|
+ console.log(`DebugUtil.debug result=${result}`);
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+ DebugUtil["checkDebugSign"].implementation = function (str) {
|
|
|
+ console.log(`DebugUtil.checkDebugSign is called: str=${str}`);
|
|
|
+ let result = this["checkDebugSign"](str);
|
|
|
+ console.log(`DebugUtil.checkDebugSign result=${result}`);
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+
|
|
|
+ let ChannelUtil = Java.use("com.tt.miniapp.util.ChannelUtil");
|
|
|
+ ChannelUtil["isLocalTest"].implementation = function () {
|
|
|
+ console.log(`ChannelUtil.isLocalTest is called`);
|
|
|
+ let result = this["isLocalTest"]();
|
|
|
+ console.log(`ChannelUtil.isLocalTest result=${result}`);
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+
|
|
|
+ DebugUtil.DEBUG = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ Java.perform(function () {
|
|
|
+ logColor("HookDY.js is loaded", LogColor.GREEN_TEXT);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let OnMessageListener = Java.use("com.ss.ugc.live.sdk.message.interfaces.OnMessageListener");
|
|
|
+ OnMessageListener["onMessage"].implementation = function (iMessage) {
|
|
|
+ console.log(`OnMessageListener.onMessage is called: iMessage=${iMessage}`);
|
|
|
+ logColor("OnMessageListener.onMessage is called: iMessage=" + iMessage, LogColor.RED_TEXT);
|
|
|
+ this["onMessage"](iMessage);
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let GsonUtil = Java.use("com.bytedance.android.ec.core.utils.GsonUtil");
|
|
|
+
|
|
|
+ let HandlerC8064033h = Java.use("X.033h");
|
|
|
+ HandlerC8064033h["handleMessage"].implementation = function (msg) {
|
|
|
+
|
|
|
+ let what = msg.what.value;
|
|
|
+
|
|
|
+ let objArr = msg.obj.value;
|
|
|
+ if (what !== 202 && objArr != null) {
|
|
|
+ let ArrayList = Java.use("java.util.ArrayList");
|
|
|
+ let objList = Java.cast(objArr, ArrayList);
|
|
|
+ for (let index = 0; index < objList.size(); index++) {
|
|
|
+ logColor(`---------------------------------------------------------------------------------------------------------------------------------`, LogColor.RED_TEXT);
|
|
|
+ let obj = objList.get(index);
|
|
|
+ let toString = obj.toString();
|
|
|
+ if (toString.includes("Gift")||toString.includes("gift")) {
|
|
|
+ logColor(`what:${what}\t\t obj${index}\t\tclass:${obj.getClass().getName()} =>\n` + GsonUtil.toJson(obj), LogColor.YELLOW_TEXT);
|
|
|
+ } else {
|
|
|
+ logColor(`what:${what}\t\t obj${index}\t\tclass:${obj.getClass().getName()} =>\n` + obj, LogColor.GREEN_TEXT);
|
|
|
+ }
|
|
|
+ logColor(`---------------------------------------------------------------------------------------------------------------------------------`, LogColor.RED_TEXT);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- },5000);
|
|
|
+ this["handleMessage"](msg);
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
}
|