Skip to content

Commit 60140af

Browse files
ghhccghkSevtinge
andauthored
fix:修复在 HyperOS 3 上绕过mtb身份验证失败问题 (#1379)
* fix:修复在 HyperOS 3 上绕过mtb身份验证失败问题 Signed-off-by: ghhccghk <2137610394@qq.com> * opt: version check --------- Signed-off-by: ghhccghk <2137610394@qq.com> Co-authored-by: 绀漓丨Sevtinge <89193494+Sevtinge@users.noreply.github.com>
1 parent 2d1c329 commit 60140af

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

library/hook/src/main/java/com/sevtinge/hyperceiler/hook/module/hook/mtb/BypassAuthentication.kt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,29 @@
1919
package com.sevtinge.hyperceiler.hook.module.hook.mtb
2020

2121
import com.sevtinge.hyperceiler.hook.module.base.BaseHook
22+
import com.sevtinge.hyperceiler.hook.utils.devicesdk.isMoreHyperOSVersion
2223
import io.github.kyuubiran.ezxhelper.core.finder.MethodFinder.`-Static`.methodFinder
2324
import io.github.kyuubiran.ezxhelper.core.util.ClassUtil.loadClass
2425
import io.github.kyuubiran.ezxhelper.xposed.dsl.HookFactory.`-Static`.createAfterHook
2526

2627
object BypassAuthentication : BaseHook() {
2728
override fun init() {
28-
// 在 HyperOS2 上
29-
runCatching {
30-
loadClass("com.xiaomi.mtb.MtbApp").methodFinder()
31-
.filterByName("getMiServerPermissionClass")
32-
.single().createAfterHook {
33-
it.result = 0L
34-
}
29+
if (isMoreHyperOSVersion(3f)) {
30+
runCatching {
31+
loadClass("com.xiaomi.mtb.MtbAppBase").methodFinder()
32+
.filterByName("getMiServerPermissionClass")
33+
.single().createAfterHook {
34+
it.result = 0L
35+
}
36+
}
37+
} else {
38+
runCatching {
39+
loadClass("com.xiaomi.mtb.MtbApp").methodFinder()
40+
.filterByName("getMiServerPermissionClass")
41+
.single().createAfterHook {
42+
it.result = 0L
43+
}
44+
}
3545
}
3646
}
3747
}

0 commit comments

Comments
 (0)