Skip to content

Commit

Permalink
feat: security center - others - Disable network verify when open USB…
Browse files Browse the repository at this point in the history
… installation

fuck u miui
  • Loading branch information
Sevtinge committed Aug 28, 2024
1 parent 84d2ca1 commit 9e47018
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video.UnlockVideoSomeFunc;
import com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video.VBVideoMode;
import com.sevtinge.hyperceiler.module.hook.securitycenter.sidebar.video.VideoDolbyOpen;
import com.sevtinge.hyperceiler.module.hook.securitycenter.BypassAdbInstallVerify;

@HookExpand(pkg = "com.miui.securitycenter", isPad = false, tarAndroid = 33)
public class SecurityCenterT extends BaseModule {
Expand Down Expand Up @@ -124,6 +125,7 @@ public void handleLoadPackage() {
initHook(NoLowBatteryWarning.INSTANCE, mPrefsMap.getBoolean("security_center_remove_low_battery_reminder"));
initHook(new UnlockFbo(), mPrefsMap.getBoolean("security_center_unlock_fbo"));
initHook(BypassSimLockMiAccountAuth.INSTANCE, mPrefsMap.getBoolean("security_center_bypass_simlock_miaccount_auth"));
initHook(new BypassAdbInstallVerify(), mPrefsMap.getBoolean("security_center_adb_install_verify"));

// 小窗和气泡通知
initHook(new RemoveConversationBubbleSettingsRestriction(), mPrefsMap.getBoolean("security_center_remove_conversation_bubble_settings_restriction"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/

package com.sevtinge.hyperceiler.module.hook.securitycenter;

import com.sevtinge.hyperceiler.module.base.BaseHook;
import com.sevtinge.hyperceiler.module.base.dexkit.DexKit;
import com.sevtinge.hyperceiler.module.base.dexkit.IDexKit;

import org.luckypray.dexkit.DexKitBridge;
import org.luckypray.dexkit.query.FindMethod;
import org.luckypray.dexkit.query.matchers.ClassMatcher;
import org.luckypray.dexkit.query.matchers.MethodMatcher;
import org.luckypray.dexkit.result.MethodData;

import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;

import de.robv.android.xposed.XposedHelpers;

public class BypassAdbInstallVerify extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
Method method1 = (Method) DexKit.getDexKitBridge("AdbInstallNetworkVerify", new IDexKit() {
@Override
public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException {
MethodData methodData = bridge.findMethod(FindMethod.create()
.matcher(MethodMatcher.create()
.declaredClass(ClassMatcher.create()
.usingStrings("https://srv.sec.miui.com/data/adb"))
.usingStrings("connectivity")
)).singleOrNull();
return methodData.getMethodInstance(lpparam.classLoader);
}
});
Method method2 = (Method) DexKit.getDexKitBridge("AdbInstallCaller", new IDexKit() {
@Override
public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException {
MethodData methodData = bridge.findMethod(FindMethod.create()
.matcher(MethodMatcher.create()
.usingStrings("AdbInstallActivity", "start request for adb install!")
)).singleOrNull();
return methodData.getMethodInstance(lpparam.classLoader);
}
});
hookMethod(method1, new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
Object instance = param.thisObject;
Object adbInstallVerifyActivityInstance = XposedHelpers.newInstance(XposedHelpers.findClass("com.miui.permcenter.install.AdbInstallVerifyActivity$b", lpparam.classLoader), instance);
XposedHelpers.setObjectField(instance, "d", adbInstallVerifyActivityInstance);
Object threadPoolExecutor = XposedHelpers.getStaticObjectField(XposedHelpers.findClass("android.os.AsyncTask", lpparam.classLoader), "THREAD_POOL_EXECUTOR");
XposedHelpers.callMethod(adbInstallVerifyActivityInstance, "executeOnExecutor", threadPoolExecutor, new Void[]{});
param.setResult(null);

}
});
hookMethod(method2, new MethodHook(){
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(null);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public static boolean isLoggerAlive() {
}
}
if (lsposedFound) {
AndroidLogUtils.logI("jhvzsdchgsdkvjbs", "lsposedf");
String output = safeExecCommandWithRoot("ls /data/adb/lspd/log/");
String[] lines = output.split("\n");
List<String> logFiles = new ArrayList<>();
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@
<string name="security_center_beauty_pc">解锁人像居中</string>
<string name="security_center_disable_root_check">禁用 Root 检测</string>
<string name="security_center_install_intercept">禁用 USB 安装拦截</string>
<string name="security_center_adb_install_verify">绕过开启 USB 安装时的网络校验</string>
<string name="security_center_remove_macro_black_list">移除自动连招黑名单</string>
<string name="security_center_disable_send_malicious_app_notification">禁止发送 “发现恶意应用” 通知</string>
<string name="security_center_newbox_custom_enable">启用自定义</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,7 @@
<string name="security_center_beauty_pc">Unlock Keep faces centered</string>
<string name="security_center_disable_root_check">Disable root detection</string>
<string name="security_center_install_intercept">Disable USB installation interception</string>
<string name="security_center_adb_install_verify">Disable network verify when open USB installation</string>
<string name="security_center_remove_macro_black_list">Remove auto combo blacklist</string>
<string name="security_center_disable_send_malicious_app_notification">Disable \"Malicious app found\" notifications</string>
<string name="security_center_newbox_custom_enable">Enable custom</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/security_center_other.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
android:key="prefs_key_security_center_install_intercept"
android:title="@string/security_center_install_intercept" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_security_center_adb_install_verify"
android:title="@string/security_center_adb_install_verify" />

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_security_center_unlock_fbo"
Expand Down

0 comments on commit 9e47018

Please sign in to comment.