From a96220b3bb56f60bef8b208d965db255ca6f7b2a Mon Sep 17 00:00:00 2001 From: chiteroman Date: Sun, 25 Aug 2024 03:45:12 +0200 Subject: [PATCH] Remove useless code --- app/src/main/cpp/main.cpp | 45 ++++++------------- .../playintegrityfix/EntryPoint.java | 2 + module/pif.json | 2 - 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index feaaf87..fe42c58 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -61,24 +61,26 @@ static void modify_callback(void *cookie, const char *name, const char *value, u std::string_view prop(name); + bool print = false; + if (prop == "init.svc.adbd") { value = "stopped"; - if (!DEBUG) LOGD("[%s]: %s", name, value); + print = true; } else if (prop == "sys.usb.state") { value = "mtp"; - if (!DEBUG) LOGD("[%s]: %s", name, value); + print = true; } else if (prop.ends_with("api_level") && !DEVICE_INITIAL_SDK_INT.empty()) { value = DEVICE_INITIAL_SDK_INT.c_str(); - if (!DEBUG) LOGD("[%s]: %s", name, value); + print = true; } else if (prop.ends_with(".security_patch") && !SECURITY_PATCH.empty()) { value = SECURITY_PATCH.c_str(); - if (!DEBUG) LOGD("[%s]: %s", name, value); + print = true; } else if (prop.ends_with(".build.id") && !BUILD_ID.empty()) { value = BUILD_ID.c_str(); - if (!DEBUG) LOGD("[%s]: %s", name, value); + print = true; } - if (DEBUG) LOGD("[%s]: %s", name, value); + if (print || DEBUG) LOGD("[%s]: %s", name, value); return o_callback(cookie, name, value, serial); } @@ -184,8 +186,7 @@ public: parseJSON(); if (trickyStore) { - LOGD("TrickyStore module installed and enabled, disabling spoofBuild (Java), spoofProps and spoofProvider"); - spoofBuild = false; + LOGD("TrickyStore module installed and enabled, disabling spoofProps and spoofProvider"); spoofProps = false; spoofProvider = false; } @@ -194,14 +195,14 @@ public: void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override { if (dexVector.empty()) return; - if (spoofBuildZygisk) UpdateBuildFields(); + UpdateBuildFields(); if (spoofProps) doHook(); else api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY); - if (spoofBuild || spoofProvider || spoofSignature) injectDex(); + if (spoofProvider || spoofSignature) injectDex(); else - LOGD("Don't inject dex: spoofBuild (Java), spoofProvider and spoofSignature are false"); + LOGD("Dex file won't be injected due spoofProvider and spoofSignature are false"); cJSON_Delete(json); dexVector.clear(); @@ -217,8 +218,6 @@ private: JNIEnv *env = nullptr; std::vector dexVector; cJSON *json = nullptr; - bool spoofBuild = true; - bool spoofBuildZygisk = true; bool spoofProps = true; bool spoofProvider = true; bool spoofSignature = false; @@ -230,9 +229,6 @@ private: const cJSON *security_patch = cJSON_GetObjectItemCaseSensitive(json, "SECURITY_PATCH"); const cJSON *build_id = cJSON_GetObjectItemCaseSensitive(json, "ID"); const cJSON *isDebug = cJSON_GetObjectItemCaseSensitive(json, "DEBUG"); - const cJSON *spoof_build = cJSON_GetObjectItemCaseSensitive(json, "spoofBuild"); - const cJSON *spoof_build_zygisk = cJSON_GetObjectItemCaseSensitive(json, - "spoofBuildZygisk"); const cJSON *spoof_props = cJSON_GetObjectItemCaseSensitive(json, "spoofProps"); const cJSON *spoof_provider = cJSON_GetObjectItemCaseSensitive(json, "spoofProvider"); const cJSON *spoof_signature = cJSON_GetObjectItemCaseSensitive(json, "spoofSignature"); @@ -259,16 +255,6 @@ private: cJSON_DeleteItemFromObjectCaseSensitive(json, "DEBUG"); } - if (spoof_build && cJSON_IsBool(spoof_build)) { - spoofBuild = cJSON_IsTrue(spoof_build); - cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofBuild"); - } - - if (spoof_build_zygisk && cJSON_IsBool(spoof_build_zygisk)) { - spoofBuildZygisk = cJSON_IsTrue(spoof_build_zygisk); - cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofBuildZygisk"); - } - if (spoof_props && cJSON_IsBool(spoof_props)) { spoofProps = cJSON_IsTrue(spoof_props); cJSON_DeleteItemFromObjectCaseSensitive(json, "spoofProps"); @@ -310,12 +296,7 @@ private: LOGD("call init"); auto entryInit = env->GetStaticMethodID(entryPointClass, "init", "(Ljava/lang/String;ZZ)V"); - jstring jsonStr; - if (spoofBuild) { - jsonStr = env->NewStringUTF(cJSON_Print(json)); - } else { - jsonStr = env->NewStringUTF(""); - } + auto jsonStr = env->NewStringUTF(cJSON_Print(json)); env->CallStaticVoidMethod(entryPointClass, entryInit, jsonStr, spoofProvider, spoofSignature); } diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java index 47e4103..b48a1c0 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java @@ -65,6 +65,8 @@ public final class EntryPoint { CustomKeyStoreSpi.keyStoreSpi = (KeyStoreSpi) keyStoreSpi.get(keyStore); + keyStoreSpi.setAccessible(false); + } catch (Throwable t) { Log.e(TAG, "Couldn't get keyStoreSpi field!", t); } diff --git a/module/pif.json b/module/pif.json index bad20ba..efb0ca9 100644 --- a/module/pif.json +++ b/module/pif.json @@ -8,8 +8,6 @@ "PRODUCT": "akita_beta", "SECURITY_PATCH": "2024-08-05", "DEVICE_INITIAL_SDK_INT": 21, - "spoofBuild": true, - "spoofBuildZygisk": true, "spoofProps": true, "spoofProvider": true, "spoofSignature": false