|
@@ -1,18 +1,46 @@
|
|
|
export let HookGameCenter = {
|
|
|
- startHook: function () {
|
|
|
- Java.perform(()=>{
|
|
|
- console.log("hook start")
|
|
|
-
|
|
|
-
|
|
|
- let CharSequence = Java.use("java.lang.CharSequence");
|
|
|
-
|
|
|
+ printReqParam: function (HttpLoggingInterceptor) {
|
|
|
+ HttpLoggingInterceptor.a.overload('okhttp3.Interceptor$Chain').implementation = function (chain) {
|
|
|
+ var result = this.a(chain);
|
|
|
+
|
|
|
+ var threadLogs = HttpLoggingInterceptor.THREAD_LOGS.value;
|
|
|
|
|
|
- let charSequence = Java.cast(Java.use("java.lang.String").$new("嘿嘿嘿"),CharSequence);
|
|
|
- Java.use("android.widget.TextView").setText.overload("java.lang.CharSequence").implementation = function (x) {
|
|
|
- console.log("hook setText",x)
|
|
|
- return this.setText(charSequence)
|
|
|
+
|
|
|
+ var threadLogsValue = threadLogs.get();
|
|
|
+
|
|
|
+
|
|
|
+ if (threadLogsValue !== null) {
|
|
|
+ console.log('请求参数: ' + threadLogsValue.toString());
|
|
|
+ } else {
|
|
|
+ console.log('请求参数 is null or not set for the current thread');
|
|
|
}
|
|
|
- console.log("hook end")
|
|
|
- })
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ }, startHook: function () {
|
|
|
+
|
|
|
+ var HttpLoggingInterceptor = Java.use('com.framework.net.okhttp3.HttpLoggingInterceptor');
|
|
|
+
|
|
|
+ HookGameCenter.printReqParam(HttpLoggingInterceptor);
|
|
|
+ HookGameCenter.printResponse(HttpLoggingInterceptor);
|
|
|
+
|
|
|
+ },
|
|
|
+ printResponse: function (HttpLoggingInterceptor) {
|
|
|
+ HttpLoggingInterceptor.intercept.overload('okhttp3.Interceptor$Chain').implementation = function (chain) {
|
|
|
+ var result = this.intercept(chain);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ var responseBody = result.peekBody(1024 * 1024);
|
|
|
+ var responseBodyString = responseBody.string();
|
|
|
+ console.log("Response Body: " + responseBodyString);
|
|
|
+ } catch (e) {
|
|
|
+ console.log("Error reading response body: " + e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|