From c6d47fce55f52745ff3b1283b5f01d13c9feff0f Mon Sep 17 00:00:00 2001 From: HChenX Date: Sat, 25 May 2024 11:47:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=96=B0dexkit=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hyperceiler/module/app/Browser.java | 28 ++-- .../module/base/dexkit/DexKitCache.java | 47 ------ .../module/base/dexkit/DexKitCacheFile.java | 137 ---------------- .../module/base/dexkit/DexKitData.java | 150 ------------------ .../module/hook/browser/DebugMode.kt | 150 ++++++++++++------ .../hook/browser/EnableDebugEnvironment.java | 22 +-- .../module/hook/demo/DexKitTest.java | 26 --- 7 files changed, 126 insertions(+), 434 deletions(-) delete mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCache.java delete mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCacheFile.java delete mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitData.java delete mode 100644 app/src/main/java/com/sevtinge/hyperceiler/module/hook/demo/DexKitTest.java diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Browser.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Browser.java index 2a9cfac6c2..22cdfbe1fc 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/Browser.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/Browser.java @@ -1,21 +1,21 @@ /* - * This file is part of HyperCeiler. + * This file is part of HyperCeiler. - * HyperCeiler is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License. + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . - * Copyright (C) 2023-2024 HyperCeiler Contributions -*/ + * Copyright (C) 2023-2024 HyperCeiler Contributions + */ package com.sevtinge.hyperceiler.module.app; import com.sevtinge.hyperceiler.module.base.BaseModule; @@ -30,7 +30,7 @@ public class Browser extends BaseModule { @Override public void handleLoadPackage() { - initHook(new DebugMode(), mPrefsMap.getBoolean("browser_debug_mode")); + initHook(DebugMode.INSTANCE, mPrefsMap.getBoolean("browser_debug_mode")); initHook(new DisableReadFiles(), mPrefsMap.getBoolean("browser_disable_blacklist")); initHook(new EnableDebugEnvironment(), mPrefsMap.getBoolean("browser_enable_debug_environment")); initHook(UnlockSuperClipboard.INSTANCE, mPrefsMap.getStringAsInt("various_super_clipboard_e", 0) != 0); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCache.java b/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCache.java deleted file mode 100644 index ecff818051..0000000000 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCache.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of HyperCeiler. - - * HyperCeiler is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - - * Copyright (C) 2023-2024 HyperCeiler Contributions - */ -package com.sevtinge.hyperceiler.module.base.dexkit; - -import com.sevtinge.hyperceiler.callback.ITAG; -import com.sevtinge.hyperceiler.utils.FileUtils; -import com.sevtinge.hyperceiler.utils.log.XposedLogUtils; - -import de.robv.android.xposed.callbacks.XC_LoadPackage; - -public class DexKitCache { - private final XC_LoadPackage.LoadPackageParam param; - private final String data; - private final String dexPath; - private final String dexFile; - - public DexKitCache(XC_LoadPackage.LoadPackageParam param) { - this.param = param; - data = param.appInfo.dataDir; - dexPath = data + "/dexkit"; - dexFile = dexPath + "/cache"; - XposedLogUtils.logE(ITAG.TAG, "data: " + data + " dex: " + dexPath); - } - - public DexKitCache create() { - FileUtils.mkdirs(dexPath); - FileUtils.touch(dexFile); - FileUtils.setPermission(dexFile); - return this; - } -} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCacheFile.java b/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCacheFile.java deleted file mode 100644 index 9b256b6d26..0000000000 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitCacheFile.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.sevtinge.hyperceiler.module.base.dexkit; - -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logD; -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logE; -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logI; - -import org.json.JSONArray; -import org.json.JSONException; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.attribute.PosixFilePermission; -import java.util.Set; - -import de.robv.android.xposed.callbacks.XC_LoadPackage; - -public class DexKitCacheFile { - - static String TAG = "DexKitCacheFile"; - - public static String getFilePath(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - return "/data/user/0/" + loadPackageParam.packageName + "/cache/HyperCeiler_" + callingClassName + "_" + tag + "_DexKit_Cache.dat"; - } - - public static void checkFile(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - String path = getFilePath(loadPackageParam, callingClassName, tag); - File file = new File(path); - File parentDir = file.getParentFile(); - if (parentDir == null) { - logE(TAG, "parentDir is null: " + path); - } - if (parentDir != null && !parentDir.exists()) { - if (parentDir.mkdirs()) { - logI(TAG, "mkdirs: " + parentDir); - } else { - logE(TAG, "mkdirs: " + parentDir); - } - } - if (!file.exists()) { - try { - if (file.createNewFile()) { - writeFile(loadPackageParam, new JSONArray(), callingClassName, tag); - setPermission(path); - logI(TAG, "createNewFile: " + file); - } else { - logE(TAG, "createNewFile: " + file); - } - } catch (IOException e) { - logE(TAG, "createNewFile: " + e); - } - } else { - setPermission(path); - } - } - - public static void writeFile(XC_LoadPackage.LoadPackageParam loadPackageParam, JSONArray jsonArray, String callingClassName, String tag) { - String path = getFilePath(loadPackageParam, callingClassName, tag); - if (jsonArray == null) { - logE(TAG, "write json is null"); - return; - } - try (BufferedWriter writer = new BufferedWriter(new - FileWriter(path, false))) { - writer.write(jsonArray.toString()); - } catch (IOException e) { - logE(TAG, "writeFile: " + e); - } - } - - public static boolean isEmptyFile(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - if(!isFileExists(loadPackageParam, callingClassName, tag)){ - JSONArray jsonArray = readFile(loadPackageParam, callingClassName, tag); - return jsonArray.length() == 0; - } - return false; - } - - public static boolean isFileExists(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - File file = new File(getFilePath(loadPackageParam, callingClassName, tag)); - return file.exists(); - } - - public static JSONArray readFile(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - String path = getFilePath(loadPackageParam, callingClassName, tag); - try (BufferedReader reader = new BufferedReader(new - FileReader(path))) { - StringBuilder builder = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - builder.append(line); - } - String jsonString = builder.toString(); - if (jsonString.isEmpty()) { - jsonString = "[]"; - } - return new JSONArray(jsonString); - } catch (IOException | JSONException e) { - logE(TAG, "readFile: " + e); - } - return new JSONArray(); - } - - public static boolean resetFile(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) { - // 清空文件内容 - writeFile(loadPackageParam, new JSONArray(), callingClassName, tag); - return isEmptyFile(loadPackageParam, callingClassName, tag); - } - - public static void setPermission(String paths) { - // 指定文件的路径 - Path filePath = Paths.get(paths); - - try { - // 获取当前文件的权限 - Set permissions = Files.getPosixFilePermissions(filePath); - - // 添加世界可读写权限 - permissions.add(PosixFilePermission.OTHERS_READ); - permissions.add(PosixFilePermission.OTHERS_WRITE); - permissions.add(PosixFilePermission.GROUP_READ); - permissions.add(PosixFilePermission.GROUP_WRITE); - - // 设置新的权限 - Files.setPosixFilePermissions(filePath, permissions); - } catch (IOException e) { - logE(TAG, "setPermission: " + e); - } - } - -} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitData.java b/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitData.java deleted file mode 100644 index ee771ad4d1..0000000000 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/base/dexkit/DexKitData.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.sevtinge.hyperceiler.module.base.dexkit; - -import static com.sevtinge.hyperceiler.module.base.dexkit.DexKitCacheFile.readFile; -import static com.sevtinge.hyperceiler.module.base.tool.OtherTool.getPackageVersionCode; -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logD; -import static com.sevtinge.hyperceiler.utils.log.XposedLogUtils.logE; - -import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; -import static de.robv.android.xposed.XposedHelpers.findClassIfExists; - -import com.sevtinge.hyperceiler.module.base.dexkit.DexKitCacheFile; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.luckypray.dexkit.query.FindMethod; -import org.luckypray.dexkit.query.matchers.MethodMatcher; -import org.luckypray.dexkit.result.MethodData; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; - -import de.robv.android.xposed.XC_MethodHook; -import de.robv.android.xposed.callbacks.XC_LoadPackage; - -public class DexKitData { - - public static void hookMethodWithDexKit(String tag, XC_LoadPackage.LoadPackageParam loadPackageParam, MethodMatcher methodMatcher, Object... callback) { - StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - String callingClassName = stackTrace[3].getClassName(); - int lastDotIndex = callingClassName.lastIndexOf('.'); - callingClassName = callingClassName.substring(lastDotIndex + 1); - try { - String className; - String methodName; - List paramList; - if (!DexKitCacheFile.isEmptyFile(loadPackageParam, callingClassName, tag)) { - try { - className = getClassName(loadPackageParam, callingClassName, tag); - methodName = getMethodName(loadPackageParam, callingClassName, tag); - paramList = getParamList(loadPackageParam, callingClassName, tag); - } catch (JSONException e) { - throw new RuntimeException(e); - } - } else { - MethodData methodData = DexKit.getDexKitBridge().findMethod(FindMethod.create() - .matcher(methodMatcher) - ).singleOrThrow(() -> new IllegalStateException("No Such Method Found.")); - className = methodData.getClassName(); - methodName = methodData.getMethodName(); - paramList = methodData.getParamNames(); - putDexKitCache(loadPackageParam, callingClassName, tag, className, methodName, paramList); - } - if (paramList == null) { - findAndHookMethod(findClassIfExists(className, loadPackageParam.classLoader), methodName, callback); - } else { - findAndHookMethod(findClassIfExists(className, loadPackageParam.classLoader), methodName, paramList.toArray(), callback); - } - } catch (Exception e){ -logE(callingClassName, loadPackageParam.packageName, "Having trouble finding "+tag+": "+e); - } - } - - public static void putDexKitCache(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag, String className, String methodName, List paramList) { - JSONObject jsonObject = new JSONObject(); - try { - jsonObject.put("ClassName", className); - jsonObject.put("MethodName", methodName); - jsonObject.put("ParamList", paramList); - } catch (JSONException e) { - throw new RuntimeException(e); - } - JSONArray jsonArray = new JSONArray(); - jsonArray.put(jsonObject); - DexKitCacheFile.writeFile(loadPackageParam, jsonArray, callingClassName, tag); - } - - public static String getClassName(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) throws JSONException { - return readFile(loadPackageParam, callingClassName, tag).getJSONObject(0).getString("ClassName"); - } - - public static String getMethodName(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) throws JSONException { - return readFile(loadPackageParam, callingClassName, tag).getJSONObject(0).getString("MethodName"); - } - - public static List getParamList(XC_LoadPackage.LoadPackageParam loadPackageParam, String callingClassName, String tag) throws JSONException { - JSONObject jsonObject = readFile(loadPackageParam, callingClassName, tag).getJSONObject(0); - if (jsonObject.has("ParamList")) { - List list = Arrays.asList(jsonObject.getString("ParamList").split(",")); - if (!list.isEmpty()) { - return list; - } - } - return null; - } - - public static class MethodHookWithDexKit extends XC_MethodHook { - - protected void before(MethodHookParam param) throws Throwable { - } - - protected void after(MethodHookParam param) throws Throwable { - } - - public MethodHookWithDexKit() { - super(); - } - - public MethodHookWithDexKit(int priority) { - super(priority); - } - - public static MethodHookWithDexKit returnConstant(final Object result) { - return new MethodHookWithDexKit(PRIORITY_DEFAULT) { - @Override - protected void before(MethodHookParam param) { - param.setResult(result); - } - }; - } - - public static final MethodHookWithDexKit DO_NOTHING = new MethodHookWithDexKit(PRIORITY_HIGHEST * 2) { - @Override - protected void before(MethodHookParam param) { - param.setResult(null); - } - }; - - @Override - public void beforeHookedMethod(MethodHookParam param) throws Throwable { - try { - this.before(param); - } catch (Throwable t) { - // logE("BeforeHook", t); - } - } - - @Override - public void afterHookedMethod(MethodHookParam param) throws Throwable { - try { - this.after(param); - } catch (Throwable t) { - // logE("AfterHook", t); - } - } - } - -} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.kt index b45e09e1f0..7ba02621a2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/DebugMode.kt @@ -1,53 +1,101 @@ -package com.sevtinge.hyperceiler.module.hook.browser; - -import static com.sevtinge.hyperceiler.module.base.tool.OtherTool.getPackageVersionCode; - -import com.sevtinge.hyperceiler.module.base.BaseHook; -import com.sevtinge.hyperceiler.module.base.dexkit.DexKitData; - -import org.luckypray.dexkit.query.matchers.MethodMatcher; - -public class DebugMode extends BaseHook { - @Override - public void init() throws NoSuchMethodException { - DexKitData.hookMethodWithDexKit("EnvironmentFlag", lpparam, - MethodMatcher.create() - .usingStrings("environment_flag") - .returnType(String.class), - new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(1); - } - }); - DexKitData.hookMethodWithDexKit("DebugMode0", lpparam, - MethodMatcher.create() - .usingStrings("pref_key_debug_mode_new") - .returnType(boolean.class), - new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); - DexKitData.hookMethodWithDexKit("DebugMode1", lpparam, - MethodMatcher.create() - .usingStrings("pref_key_debug_mode") - .returnType(boolean.class), - new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); - DexKitData.hookMethodWithDexKit("Key", lpparam, - MethodMatcher.create() - .usingStrings("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) - .returnType(boolean.class), new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); +/* + * This file is part of HyperCeiler. + + * HyperCeiler is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + + * Copyright (C) 2023-2024 HyperCeiler Contributions +*/ +package com.sevtinge.hyperceiler.module.hook.browser + +import com.github.kyuubiran.ezxhelper.EzXHelper.safeClassLoader +import com.sevtinge.hyperceiler.module.base.* +import com.sevtinge.hyperceiler.module.base.dexkit.* +import com.sevtinge.hyperceiler.module.base.dexkit.DexKitTool.addUsingStringsEquals +import com.sevtinge.hyperceiler.module.base.tool.OtherTool.* +import de.robv.android.xposed.* + +object DebugMode : BaseHook() { + private var found = false + + override fun init() { + DexKit.getDexKitBridge().findMethod { + matcher { + addUsingStringsEquals("environment_flag") + returnType = "java.lang.String" + } + }.forEach { + val environmentFlag = it.getMethodInstance(lpparam.classLoader) + logI(TAG, this.lpparam.packageName, "environmentFlag method is $environmentFlag") + XposedBridge.hookMethod( + environmentFlag, + XC_MethodReplacement.returnConstant("1") + ) + } + + DexKit.getDexKitBridge().findMethod { + matcher { + addUsingStringsEquals("pref_key_debug_mode_new") + returnType = "boolean" + } + }.forEach { + val debugMode = it.getMethodInstance(lpparam.classLoader) + if (debugMode.toString().contains("getDebugMode")) { + logI(TAG, this.lpparam.packageName, "DebugMode method is $debugMode") + found = true + XposedBridge.hookMethod( + debugMode, + XC_MethodReplacement.returnConstant(true) + ) + } + } + + if (!found) { + DexKit.getDexKitBridge().findMethod { + matcher { + addUsingStringsEquals("pref_key_debug_mode") + returnType = "boolean" + } + }.forEach { + val debugMode1 = it.getMethodInstance(safeClassLoader) + if (debugMode1.toString().contains("getDebugMode")) { + logI(TAG, this.lpparam.packageName, "DebugMode1 method is $debugMode1") + found = true + XposedBridge.hookMethod( + debugMode1, + XC_MethodReplacement.returnConstant(true) + ) + } + } + } + + if (!found) { + DexKit.getDexKitBridge().findMethod { + matcher { + addUsingStringsEquals("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) + returnType = "boolean" + } + }.forEach { + val debugMode2 = it.getMethodInstance(lpparam.classLoader) + if (debugMode2.toString().contains("getDebugMode")) { + logI(TAG, this.lpparam.packageName, "DebugMode2 method is $debugMode2") + found = true + XposedBridge.hookMethod( + debugMode2, + XC_MethodReplacement.returnConstant(true) + ) + } + } + } } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java index 98c4ac7c7d..c3be403c58 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/browser/EnableDebugEnvironment.java @@ -22,7 +22,6 @@ import com.sevtinge.hyperceiler.module.base.BaseHook; import com.sevtinge.hyperceiler.module.base.dexkit.DexKit; -import com.sevtinge.hyperceiler.module.base.dexkit.DexKitData; import org.luckypray.dexkit.query.FindMethod; import org.luckypray.dexkit.query.matchers.MethodMatcher; @@ -33,15 +32,20 @@ public class EnableDebugEnvironment extends BaseHook { @Override public void init() throws NoSuchMethodException { - DexKitData.hookMethodWithDexKit("Key", lpparam, - MethodMatcher.create() + MethodData methodData = DexKit.getDexKitBridge().findMethod(FindMethod.create() + .matcher(MethodMatcher.create() .usingStrings("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) .name("getDebugMode") - .returnType(boolean.class), new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); + .returnType(boolean.class) + ) + ).singleOrThrow(() -> new IllegalStateException("EnableDebugEnvironment: Cannot found MethodData")); + Method method = methodData.getMethodInstance(lpparam.classLoader); + logD(TAG, lpparam.packageName, "getDebugMode() method is " + method); + hookMethod(method, new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(true); + } + }); } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/demo/DexKitTest.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/demo/DexKitTest.java deleted file mode 100644 index b68e9c1498..0000000000 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/demo/DexKitTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.sevtinge.hyperceiler.module.hook.demo; - -import static com.sevtinge.hyperceiler.module.base.tool.OtherTool.getPackageVersionCode; - -import com.sevtinge.hyperceiler.module.base.BaseHook; -import com.sevtinge.hyperceiler.module.base.dexkit.DexKitData; - -import org.json.JSONException; -import org.luckypray.dexkit.query.matchers.MethodMatcher; - -public class DexKitTest extends BaseHook { - @Override - public void init() throws NoSuchMethodException { - DexKitData.hookMethodWithDexKit("Key", lpparam, - MethodMatcher.create() - .usingStrings("pref_key_debug_mode_" + getPackageVersionCode(lpparam)) - .name("getDebugMode") - .returnType(boolean.class), new DexKitData.MethodHookWithDexKit() { - @Override - protected void before(MethodHookParam param) throws Throwable { - param.setResult(true); - } - }); - - } -}