Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
合并 细节调整
Browse files Browse the repository at this point in the history
  • Loading branch information
TKaxv-7S committed Jun 23, 2024
1 parent 56f5744 commit 1b2fd04
Show file tree
Hide file tree
Showing 32 changed files with 107 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import tkaxv7s.xposed.sesame.data.modelFieldExt.BooleanModelField;
import tkaxv7s.xposed.sesame.data.modelFieldExt.IntegerModelField;
import tkaxv7s.xposed.sesame.data.modelFieldExt.ListModelField;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.util.ListUtil;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tkaxv7s.xposed.sesame.task.common;
package tkaxv7s.xposed.sesame.data;

import android.os.Build;

Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/tkaxv7s/xposed/sesame/data/ConfigV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.concurrent.ConcurrentHashMap;

import lombok.Data;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.util.FileUtil;
import tkaxv7s.xposed.sesame.util.JsonUtil;
import tkaxv7s.xposed.sesame.util.Log;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.Map;

import lombok.Data;
import tkaxv7s.xposed.sesame.task.common.ModelTask;

@Data
public final class ModelConfig implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tkaxv7s.xposed.sesame.task.common;
package tkaxv7s.xposed.sesame.data;

import tkaxv7s.xposed.sesame.data.ModelConfig;
import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.task.base.TaskOrder;
import tkaxv7s.xposed.sesame.util.Log;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import tkaxv7s.xposed.sesame.rpc.NewRpcBridge;
import tkaxv7s.xposed.sesame.rpc.OldRpcBridge;
import tkaxv7s.xposed.sesame.rpc.RpcBridge;
import tkaxv7s.xposed.sesame.task.common.BaseTask;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.BaseTask;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.task.model.antMember.AntMemberRpcCall;
import tkaxv7s.xposed.sesame.task.model.antSports.AntSports;
import tkaxv7s.xposed.sesame.util.*;
Expand Down Expand Up @@ -563,7 +563,7 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Object object = param.thisObject;
if (Boolean.TRUE.equals(rpcHookMap.remove(object))) {
Log.debug("record response | id: " + object.hashCode() + " | data: " + param.args[0]);
Log.debug("record response | id: " + object.hashCode() + " | data: " + param.args[0]);
}
}

Expand Down
33 changes: 17 additions & 16 deletions app/src/main/java/tkaxv7s/xposed/sesame/rpc/NewRpcBridge.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package tkaxv7s.xposed.sesame.rpc;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;

import de.robv.android.xposed.XposedHelpers;
import tkaxv7s.xposed.sesame.data.BaseModel;
import tkaxv7s.xposed.sesame.data.ConfigV2;
import tkaxv7s.xposed.sesame.entity.RpcEntity;
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
import tkaxv7s.xposed.sesame.util.ClassUtil;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.NotificationUtil;
import tkaxv7s.xposed.sesame.util.RandomUtil;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.Map;

/**
* 新版rpc接口 支持最低支付宝版本v10.3.96.8100
* 记录rpc抓包 支持最低支付宝版本v10.3.96.8100
Expand Down Expand Up @@ -112,13 +111,14 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
if (ApplicationHook.isOffline()) {
return null;
}
int id = rpcEntity.hashCode();
String method = rpcEntity.getRequestMethod();
String data = rpcEntity.getRequestData();
int count = 0;
do {
count++;
try {
Log.i(TAG, "new rpc request: " + method + ", " + data);
Log.i(TAG, "new rpc request | id: " + id + " | method: " + method + " | data: " + data);
newRpcCallMethod.invoke(
newRpcInstance, method, false, false, "json", parseObjectMethod.invoke(null, "{\"__apiCallStartTime\":" + System.currentTimeMillis() + ",\"apiCallLink\":\"XRiverNotFound\",\"execEngine\":\"XRiver\",\"operationType\":\"" + method + "\",\"requestData\":" + data + "}"), "", null, true, false, 0, false, "", null, null, null, Proxy.newProxyInstance(loader, bridgeCallbackClazzArray, new InvocationHandler() {
@Override
Expand All @@ -131,10 +131,10 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
String result = (String) XposedHelpers.callMethod(obj, "toJSONString");
rpcEntity.setResponseObject(obj, result);
Log.i(TAG, "new rpc response: " + result);
Log.i(TAG, "new rpc response | id: " + id + " | data: " + result);
} catch (Exception e) {
rpcEntity.setError();
Log.i(TAG, "new rpc response [" + method + "] err:");
Log.i(TAG, "new rpc response | id: " + id + " | method: " + method + " err:");
Log.printStackTrace(TAG, e);
}
}
Expand Down Expand Up @@ -163,7 +163,7 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
return rpcEntity;
} catch (Exception e) {
Log.i(TAG, "new rpc response [" + method + "] get err:");
Log.i(TAG, "new rpc response | id: " + id + " | method: " + method + " get err:");
Log.printStackTrace(TAG, e);
}
if (retryInterval < 0) {
Expand All @@ -180,7 +180,7 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
}
} catch (Throwable t) {
Log.i(TAG, "new rpc request [" + method + "] err:");
Log.i(TAG, "new rpc request | id: " + id + " | method: " + method + " err:");
Log.printStackTrace(TAG, t);
if (retryInterval < 0) {
try {
Expand All @@ -204,14 +204,15 @@ public RpcEntity newAsyncRequest(RpcEntity rpcEntity, int tryCount, int retryInt
if (ApplicationHook.isOffline()) {
return null;
}
int id = rpcEntity.hashCode();
String method = rpcEntity.getRequestMethod();
String data = rpcEntity.getRequestData();
int count = 0;
do {
count++;
try {
synchronized (rpcEntity) {
Log.i(TAG, "new rpc request: " + method + ", " + data);
Log.i(TAG, "new rpc request | id: " + id + " | method: " + method + " | data: " + data);
newRpcCallMethod.invoke(
newRpcInstance, method, false, false, "json", parseObjectMethod.invoke(null, "{\"__apiCallStartTime\":" + System.currentTimeMillis() + ",\"apiCallLink\":\"XRiverNotFound\",\"execEngine\":\"XRiver\",\"operationType\":\"" + method + "\",\"requestData\":" + data + "}"), "", null, true, false, 0, false, "", null, null, null, Proxy.newProxyInstance(loader, bridgeCallbackClazzArray, new InvocationHandler() {
@Override
Expand All @@ -225,15 +226,15 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
String result = (String) XposedHelpers.callMethod(obj, "toJSONString");
rpcEntity.setResponseObject(obj, result);
Log.i(TAG, "new rpc response: " + result);
Log.i(TAG, "new rpc response | id: " + id + " | data: " + result);
Thread thread = rpcEntity.getRequestThread();
if (thread != null) {
rpcEntity.notifyAll();
}
}
} catch (Exception e) {
rpcEntity.setError();
Log.i(TAG, "new rpc response [" + method + "] err:");
Log.i(TAG, "new rpc response | id: " + id + " | method: " + method + " err:");
Log.printStackTrace(TAG, e);
synchronized (rpcEntity) {
Thread thread = rpcEntity.getRequestThread();
Expand Down Expand Up @@ -270,7 +271,7 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
return rpcEntity;
} catch (Exception e) {
Log.i(TAG, "new rpc response [" + method + "] get err:");
Log.i(TAG, "new rpc response | id: " + id + " | method: " + method + " get err:");
Log.printStackTrace(TAG, e);
}
if (retryInterval < 0) {
Expand All @@ -287,7 +288,7 @@ public Object invoke(Object proxy, Method method, Object[] args) {
}
}
} catch (Throwable t) {
Log.i(TAG, "new rpc request [" + method + "] err:");
Log.i(TAG, "new rpc request | id: " + id + " | method: " + method + " err:");
Log.printStackTrace(TAG, t);
if (retryInterval < 0) {
try {
Expand Down
25 changes: 10 additions & 15 deletions app/src/main/java/tkaxv7s/xposed/sesame/rpc/OldRpcBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;

import tkaxv7s.xposed.sesame.data.BaseModel;
import tkaxv7s.xposed.sesame.data.ConfigV2;
import tkaxv7s.xposed.sesame.data.RuntimeInfo;
import tkaxv7s.xposed.sesame.entity.RpcEntity;
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
import tkaxv7s.xposed.sesame.util.NotificationUtil;
import tkaxv7s.xposed.sesame.util.ClassUtil;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.RandomUtil;
import tkaxv7s.xposed.sesame.util.StringUtil;
import tkaxv7s.xposed.sesame.util.*;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.DateFormat;

public class OldRpcBridge implements RpcBridge {

Expand Down Expand Up @@ -83,6 +77,7 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
if (ApplicationHook.isOffline()) {
return null;
}
int id = rpcEntity.hashCode();
String method = rpcEntity.getRequestMethod();
String data = rpcEntity.getRequestData();
int count = 0;
Expand All @@ -97,9 +92,9 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
resp = rpcCallMethod.invoke(
null, method, data, "", true, null, null, false, curH5PageImpl, 0, "", false, -1, "");
}
Log.i(TAG, "old rpc argument: " + method + ", " + data);
Log.i(TAG, "old rpc request | id: " + id + " | method: " + method + " | data: " + data);
} catch (Throwable t) {
Log.i(TAG, "old rpc request [" + method + "] err:");
Log.i(TAG, "old rpc request | id: " + id + " | method: " + method + " err:");
Log.printStackTrace(TAG, t);
if (t instanceof InvocationTargetException) {
String msg = t.getCause().getMessage();
Expand Down Expand Up @@ -163,7 +158,7 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
}
try {
String resultStr = (String) getResponseMethod.invoke(resp);
Log.i(TAG, "old rpc response: " + resultStr);
Log.i(TAG, "old rpc response | id: " + id + " | data: " + resultStr);
JSONObject resultObject = new JSONObject(resultStr);
if (resultObject.optString("memo", "").contains("系统繁忙")) {
ApplicationHook.setOffline(true);
Expand All @@ -174,7 +169,7 @@ public RpcEntity requestObject(RpcEntity rpcEntity, int tryCount, int retryInter
rpcEntity.setResponseObject(resultObject, resultStr);
return rpcEntity;
} catch (Throwable t) {
Log.i(TAG, "old rpc response [" + method + "] get err:");
Log.i(TAG, "old rpc response | id: " + id + " | method: " + method + " get err:");
}
return null;
} while (count < tryCount);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tkaxv7s.xposed.sesame.task.common;
package tkaxv7s.xposed.sesame.task.base;

import tkaxv7s.xposed.sesame.util.TimeUtil;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package tkaxv7s.xposed.sesame.task.common;
package tkaxv7s.xposed.sesame.task.base;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.model.ancientTree.AncientTree;
import tkaxv7s.xposed.sesame.task.model.antCooperate.AntCooperate;
import tkaxv7s.xposed.sesame.task.model.antFarm.AntFarm;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tkaxv7s.xposed.sesame.task.model;
package tkaxv7s.xposed.sesame.task.common.rpcCall;

import org.json.JSONArray;
import org.json.JSONObject;
Expand All @@ -8,7 +8,7 @@
/**
* 公共任务处理
*/
public class BaseRpcCall {
public class BaseTaskRpcCall {

/**
* 查询任务
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import tkaxv7s.xposed.sesame.data.modelFieldExt.SelectModelField;
import tkaxv7s.xposed.sesame.entity.AreaCode;
import tkaxv7s.xposed.sesame.entity.KVNode;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.Statistics;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.data.RuntimeInfo;
import tkaxv7s.xposed.sesame.data.modelFieldExt.BooleanModelField;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.RandomUtil;
import tkaxv7s.xposed.sesame.util.StringUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import tkaxv7s.xposed.sesame.data.modelFieldExt.SelectModelField;
import tkaxv7s.xposed.sesame.entity.CooperateUser;
import tkaxv7s.xposed.sesame.entity.KVNode;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.util.CooperationIdMap;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.RandomUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import tkaxv7s.xposed.sesame.data.modelFieldExt.SelectModelField;
import tkaxv7s.xposed.sesame.entity.AlipayUser;
import tkaxv7s.xposed.sesame.entity.KVNode;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.util.*;

import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import tkaxv7s.xposed.sesame.hook.ApplicationHook;
import tkaxv7s.xposed.sesame.hook.FriendManager;
import tkaxv7s.xposed.sesame.hook.Toast;
import tkaxv7s.xposed.sesame.task.common.BaseTask;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.BaseTask;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.task.model.antFarm.AntFarm.TaskStatus;
import tkaxv7s.xposed.sesame.util.FileUtil;
import tkaxv7s.xposed.sesame.util.Log;
Expand All @@ -27,8 +27,6 @@
import tkaxv7s.xposed.sesame.util.ThreadUtil;
import tkaxv7s.xposed.sesame.util.TimeUtil;
import tkaxv7s.xposed.sesame.util.UserIdMap;
import tkaxv7s.xposed.sesame.util.LanguageUtil;
import tkaxv7s.xposed.sesame.util.*;

import java.text.DateFormat;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.data.modelFieldExt.BooleanModelField;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.util.Log;
import tkaxv7s.xposed.sesame.util.Statistics;
import tkaxv7s.xposed.sesame.util.TimeUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.data.modelFieldExt.BooleanModelField;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.task.model.antFarm.AntFarm.TaskStatus;
import tkaxv7s.xposed.sesame.task.model.antForest.AntForestRpcCall;
import tkaxv7s.xposed.sesame.task.model.antForest.AntForestV2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import tkaxv7s.xposed.sesame.data.ModelFields;
import tkaxv7s.xposed.sesame.data.modelFieldExt.BooleanModelField;
import tkaxv7s.xposed.sesame.data.modelFieldExt.IntegerModelField;
import tkaxv7s.xposed.sesame.task.common.ModelTask;
import tkaxv7s.xposed.sesame.task.common.TaskCommon;
import tkaxv7s.xposed.sesame.data.ModelTask;
import tkaxv7s.xposed.sesame.task.base.TaskCommon;
import tkaxv7s.xposed.sesame.task.model.antFarm.AntFarm;
import tkaxv7s.xposed.sesame.util.FileUtil;
import tkaxv7s.xposed.sesame.util.Log;
Expand Down
Loading

0 comments on commit 1b2fd04

Please sign in to comment.