This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: security center & guard provider - Disable environment check
- Loading branch information
Showing
13 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/sevtinge/hyperceiler/module/hook/guardprovider/DisableRootedCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://www.gnu.org/licenses/>. | ||
* | ||
* 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<Method> methods = DexKit.findMemberList("CheckRoot", new IDexKitList() { | ||
@Override | ||
public BaseDataList<MethodData> 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); | ||
} | ||
}); | ||
} | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
...src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/DisableRootedCheck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <https://www.gnu.org/licenses/>. | ||
* | ||
* 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<Method> methods = DexKit.findMemberList("CheckRoot", new IDexKitList() { | ||
@Override | ||
public BaseDataList<MethodData> 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); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters