Skip to content

Commit

Permalink
feat: community - FUCK DETECTION
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Dec 4, 2024
1 parent be515fe commit 56939c3
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@
import com.hchen.database.HookBase;
import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.hook.community.DeviceModify;
import com.sevtinge.hyperceiler.module.hook.community.FuckDetection;

@HookBase(targetPackage = "com.xiaomi.vipaccount", isPad = false)
public class Community extends BaseModule {

@Override
public void handleLoadPackage() {
initHook(new DeviceModify(), mPrefsMap.getBoolean("community_device_modify"));
initHook(new FuckDetection(), mPrefsMap.getBoolean("community_fuck_detection"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* 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.community;

import static com.sevtinge.hyperceiler.BuildConfig.APPLICATION_ID;

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.MethodMatcher;
import org.luckypray.dexkit.result.MethodData;

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

public class FuckDetection extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
Method method = (Method) DexKit.getDexKitBridge("GetPackageVersionName", new IDexKit() {
@Override
public AnnotatedElement dexkit(DexKitBridge bridge) throws ReflectiveOperationException {
MethodData methodData = bridge.findMethod(FindMethod.create()
.matcher(MethodMatcher.create()
.usingStrings("5577218", "binding.editContactInformation.text")
)).singleOrNull();
return methodData.getMethodInstance(lpparam.classLoader);
}
});
hookMethod(method, new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
if (param.args[0].equals(APPLICATION_ID)) param.args[0] = null;
}
});
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,8 @@
<!--小米社区-->
<string name="community">小米社区</string>
<string name="community_device_modify">机型伪装</string>
<string name="community_fuck_detection">禁止检测</string>
<string name="community_fuck_detection_desc">禁止在反馈时检测 HyperCeiler 并上传。请确保问题不是由自身引起,而是确实的系统问题,再进行反馈,以免带来不必要的麻烦</string>
<!--文件管理-->
<string name="fileexplorer">文件管理</string>
<string name="file_explorer_can_selectable">文件夹名称允许长按选择操作</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
<!--Community-->
<string name="community">Xiaomi Community</string>
<string name="community_device_modify">Model guise</string>
<string name="community_fuck_detection">Fuck detection</string>
<string name="community_fuck_detection_desc">It is forbidden to detect HyperCeiler and upload it while giving feedback. Please make sure that the problem is not caused by yourself, but a real system problem, and then give feedback to avoid unnecessary trouble.</string>
<!--File Manager-->
<string name="fileexplorer">File Manager</string>
<string name="file_explorer_can_selectable">File Manager can be selectable</string>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/community.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@

<PreferenceCategory>

<SwitchPreference
android:defaultValue="false"
android:key="prefs_key_community_fuck_detection"
android:title="@string/community_fuck_detection"
android:summary="@string/community_fuck_detection_desc"/>

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

0 comments on commit 56939c3

Please sign in to comment.