Skip to content

Commit aae578c

Browse files
add blacklist
1 parent 65347b5 commit aae578c

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ android {
2222

2323
task zip(type: Exec) {
2424
workingDir '..'
25-
commandLine 'sh', 'build.sh', project.name, 'v7'
25+
commandLine 'sh', 'build.sh', project.name, 'v8'
2626
}

jni/main/main.cpp

+21-14
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,16 @@
2626
static char package_name[256];
2727
static int uid;
2828
static int enable_hook;
29-
static std::vector<std::string> packages = {};
29+
static std::vector<std::string> blackList = {"com.google.android",
30+
"de.robv.android.xposed.installer",
31+
"com.xiaomi.xmsf",
32+
"com.tencent.mm",
33+
"top.trumeet.mipush"};
3034

3135
int is_app_need_hook(JNIEnv *env, jstring appDataDir) {
3236
if (!appDataDir)
3337
return 0;
3438

35-
36-
if (access(FAKE_CONFIGURATION_GLOBAL, F_OK) == 0) {
37-
return 1;
38-
}
39-
4039
const char *app_data_dir = env->GetStringUTFChars(appDataDir, NULL);
4140

4241
int user = 0;
@@ -50,13 +49,19 @@ int is_app_need_hook(JNIEnv *env, jstring appDataDir) {
5049

5150
env->ReleaseStringUTFChars(appDataDir, app_data_dir);
5251

53-
if (access(CONFIG_PATH "/packages", R_OK) != 0) {
54-
for (auto &s : packages) {
55-
if (strcmp(s.c_str(), package_name) == 0) {
56-
return 1;
57-
}
52+
std::string pkgName = package_name;
53+
for (auto &s : blackList) {
54+
if (pkgName.find(s) != std::string::npos) {
55+
return 0;
5856
}
59-
} else {
57+
}
58+
59+
60+
if (access(FAKE_CONFIGURATION_GLOBAL, F_OK) == 0) {
61+
return 1;
62+
}
63+
64+
if (access(CONFIG_PATH "/packages", R_OK) == 0) {
6065
char path[PATH_MAX];
6166
snprintf(path, PATH_MAX, CONFIG_PATH "/packages/%d.%s", user, package_name);
6267
return access(path, F_OK) == 0;
@@ -104,8 +109,10 @@ __attribute__((visibility("default"))) int nativeForkAndSpecializePost(JNIEnv *e
104109

105110
jclass build_class = env->FindClass("android/os/Build");
106111
jfieldID brand_id = env->GetStaticFieldID(build_class, "BRAND", "Ljava/lang/String;");
107-
jfieldID manufacturer_id = env->GetStaticFieldID(build_class, "MANUFACTURER", "Ljava/lang/String;");
108-
jfieldID product_id = env->GetStaticFieldID(build_class, "PRODUCT", "Ljava/lang/String;");
112+
jfieldID manufacturer_id = env->GetStaticFieldID(build_class, "MANUFACTURER",
113+
"Ljava/lang/String;");
114+
jfieldID product_id = env->GetStaticFieldID(build_class, "PRODUCT",
115+
"Ljava/lang/String;");
109116

110117
jstring new_str = env->NewStringUTF("Xiaomi");
111118
env->SetStaticObjectField(build_class, brand_id, new_str);

template_override/module.prop

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=mipush_fake
22
name=Riru - MiPushFakeModule
3-
version=v7
4-
versionCode=7
3+
version=v8
4+
versionCode=8
55
author=Timothy
66
description=Fake as XiaoMI device by hook system_property_get. Require Riru - Core installed.
77
minMagisk=17000

template_override/riru_module.prop

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Riru - MiPushFakeModule
2-
version=v7
3-
versionCode=7
2+
version=v8
3+
versionCode=8
44
author=Timothy
55
description=Fake as XiaoMI device by hook system_property_get. Require Riru-Core v9+ installed.

0 commit comments

Comments
 (0)