diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/GuardProvider.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/GuardProvider.java index b02873aad..4a7dfbc20 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/GuardProvider.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/GuardProvider.java @@ -20,12 +20,14 @@ import com.hchen.database.HookBase; import com.sevtinge.hyperceiler.module.base.BaseModule; +import com.sevtinge.hyperceiler.module.hook.guardprovider.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.guardprovider.DisableUploadAppListNew; @HookBase(targetPackage = "com.miui.guardprovider", isPad = false) public class GuardProvider extends BaseModule { @Override public void handleLoadPackage() { + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("guard_provider_disable_root_check")); initHook(new DisableUploadAppListNew(), mPrefsMap.getBoolean("disable_upload_applist")); } } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterT.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterT.java index 8cc9cf333..59320308f 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterT.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterT.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -111,6 +112,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterU.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterU.java index 708178d2f..6130b0329 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterU.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterU.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -113,6 +114,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterV.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterV.java index d9f8539ba..87beff67c 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterV.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Pad/SecurityCenterV.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -113,6 +114,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterT.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterT.java index 2e8a2649c..030d133a2 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterT.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterT.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -111,6 +112,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterU.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterU.java index 06f681deb..158899f20 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterU.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterU.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -113,6 +114,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterV.java b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterV.java index 8dc166053..5467f3936 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterV.java +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/app/SecurityCenter/Phone/SecurityCenterV.java @@ -23,6 +23,7 @@ import com.sevtinge.hyperceiler.module.hook.securitycenter.AppLockPinScramble; import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify; import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableReport; +import com.sevtinge.hyperceiler.module.hook.securitycenter.DisableRootedCheck; import com.sevtinge.hyperceiler.module.hook.securitycenter.GetBubbleAppString; import com.sevtinge.hyperceiler.module.hook.securitycenter.HideXOptModeTip; import com.sevtinge.hyperceiler.module.hook.securitycenter.InstallIntercept; @@ -113,6 +114,7 @@ public void handleLoadPackage() { initHook(BeautyPc.INSTANCE, mPrefsMap.getBoolean("security_center_beauty_pc")); // 其他 + initHook(new DisableRootedCheck(), mPrefsMap.getBoolean("security_center_disable_root_check_environment")); initHook(SimplifyMainFragment.INSTANCE, mPrefsMap.getBoolean("security_center_simplify_home")); initHook(new InstallIntercept(), mPrefsMap.getBoolean("security_center_install_intercept")); initHook(LockOneHundredPoints.INSTANCE, mPrefsMap.getBoolean("security_center_score")); diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableRootedCheck.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableRootedCheck.java new file mode 100644 index 000000000..37f2a4879 --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableRootedCheck.java @@ -0,0 +1,62 @@ +/* + * 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.guardprovider; + +import com.sevtinge.hyperceiler.module.base.BaseHook; +import com.sevtinge.hyperceiler.module.base.dexkit.DexKit; +import com.sevtinge.hyperceiler.module.base.dexkit.IDexKitList; + +import org.luckypray.dexkit.DexKitBridge; +import org.luckypray.dexkit.query.FindMethod; +import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; +import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.MethodDataList; + +import java.lang.reflect.Method; +import java.util.List; + +public class DisableRootedCheck extends BaseHook { + @Override + public void init() throws NoSuchMethodException { + List methods = DexKit.findMemberList("CheckRoot", new IDexKitList() { + @Override + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + MethodDataList methodData = bridge.findMethod(FindMethod.create() + .matcher(MethodMatcher.create() + .usingStrings("/system/bin/") + .returnType(boolean.class) + ) + ); + return methodData; + } + }); + for (Method method : methods) { + // Method method = methodData.getMethodInstance(lpparam.classLoader); + logD(TAG, lpparam.packageName, "Current hooking method is " + method); + hookMethod(method, new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(false); + } + }); + } + } +} diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableRootedCheck.java b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableRootedCheck.java new file mode 100644 index 000000000..2ecc93c80 --- /dev/null +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableRootedCheck.java @@ -0,0 +1,88 @@ +/* + * 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.securitycenter; + +import android.content.Intent; + +import com.sevtinge.hyperceiler.module.base.BaseHook; +import com.sevtinge.hyperceiler.module.base.dexkit.DexKit; +import com.sevtinge.hyperceiler.module.base.dexkit.IDexKitList; + +import org.luckypray.dexkit.DexKitBridge; +import org.luckypray.dexkit.query.FindMethod; +import org.luckypray.dexkit.query.matchers.MethodMatcher; +import org.luckypray.dexkit.result.BaseDataList; +import org.luckypray.dexkit.result.MethodData; +import org.luckypray.dexkit.result.MethodDataList; + +import java.lang.reflect.Method; +import java.util.List; + +public class DisableRootedCheck extends BaseHook { + @Override + public void init() throws NoSuchMethodException { + findAndHookMethod("com.xiaomi.security.xsof.MiSafetyDetectService", "onCreate", new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(null); + } + }); + findAndHookMethod("com.xiaomi.security.xsof.MiSafetyDetectService", "onDestroy", new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(null); + } + }); + /*findAndHookMethod("com.xiaomi.security.xsof.MiSafetyDetectService", "onBind", Intent.class, new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(null); + } + }); + findAndHookMethod("com.xiaomi.security.xsof.MiSafetyDetectService", "onUnbind", Intent.class, new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(null); + } + });*/ + List methods = DexKit.findMemberList("CheckRoot", new IDexKitList() { + @Override + public BaseDataList dexkit(DexKitBridge bridge) throws ReflectiveOperationException { + MethodDataList methodData = bridge.findMethod(FindMethod.create() + .matcher(MethodMatcher.create() + .usingStrings("/system/bin/") + .returnType(boolean.class) + ) + ); + return methodData; + } + }); + for (Method method : methods) { + // Method method = methodData.getMethodInstance(lpparam.classLoader); + logD(TAG, lpparam.packageName, "Current hooking method is " + method); + hookMethod(method, new MethodHook() { + @Override + protected void before(MethodHookParam param) throws Throwable { + param.setResult(false); + } + }); + } + } +} diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index ee399605b..097ca15fe 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1249,6 +1249,7 @@ MIUI 安全组件 系统安全组件 阻止自动上传已安装应用列表 + 禁用环境检查 系统桌面 手势与导航 @@ -1625,6 +1626,7 @@ 前置摄像助手 小窗和气泡通知 全局侧边栏 + 禁用环境检查 关闭杜比弹窗 显示电池温度 显示具体电池健康度 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 39cb6cb02..16ec343cb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1215,6 +1215,7 @@ MIUI security components System security components Prevent automatic upload of installed app list + Disable environment check System launcher Gesture and navigation @@ -1584,6 +1585,7 @@ Front camera assistant Bubble and freeform Sidebar + Disable environment check Close the Dolby pop-up window Show battery temperature Show detailed battery health diff --git a/app/src/main/res/xml/guard_provider.xml b/app/src/main/res/xml/guard_provider.xml index 705e59a1e..8e6d8f043 100644 --- a/app/src/main/res/xml/guard_provider.xml +++ b/app/src/main/res/xml/guard_provider.xml @@ -21,6 +21,10 @@ app:myLocation="@string/guard_provider" app:myLocationHyper="@string/guard_provider_hyperos" app:quick_restart="com.miui.guardprovider"> + + +