From 546e3e9f9d9207594ad605ee7f5ff1ec350a3c79 Mon Sep 17 00:00:00 2001 From: chiteroman <98092901+chiteroman@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:46:11 +0100 Subject: [PATCH] v14.5 --- app/build.gradle.kts | 2 +- app/src/main/cpp/module.cpp | 27 +++++++------------ .../playintegrityfix/CustomProvider.java | 11 +++++++- .../playintegrityfix/EntryPoint.java | 13 +-------- module/customize.sh | 2 +- module/module.prop | 4 +-- module/pif.json | 17 +++++------- 7 files changed, 32 insertions(+), 44 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7849f3d..90a490d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -24,7 +24,7 @@ android { externalNativeBuild { cmake { arguments += "-DANDROID_STL=none" - arguments += "-DCMAKE_BUILD_TYPE=Release" + arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel" cppFlags += "-std=c++20" cppFlags += "-fno-exceptions" diff --git a/app/src/main/cpp/module.cpp b/app/src/main/cpp/module.cpp index a3ff85f..a6c7a2b 100644 --- a/app/src/main/cpp/module.cpp +++ b/app/src/main/cpp/module.cpp @@ -8,11 +8,6 @@ #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "PIF/Native", __VA_ARGS__) -#define DEF_SECURITY_PATCH "2018-02-05" -#define DEF_FIRST_API_LEVEL "23" -#define DEF_VNDK_VERSION "23" -#define DEF_BUILD_ID "NMF26F" - static std::string SECURITY_PATCH, FIRST_API_LEVEL, VNDK_VERSION, BUILD_ID; typedef void (*T_Callback)(void *, const char *, const char *, uint32_t); @@ -28,30 +23,22 @@ static void modify_callback(void *cookie, const char *name, const char *value, u std::string_view prop(name); if (prop.ends_with("security_patch")) { - if (SECURITY_PATCH.empty()) { - value = DEF_SECURITY_PATCH; - } else { + if (!SECURITY_PATCH.empty()) { value = SECURITY_PATCH.c_str(); } LOGD("[%s]: %s", name, value); } else if (prop.ends_with("api_level")) { - if (FIRST_API_LEVEL.empty()) { - value = DEF_FIRST_API_LEVEL; - } else { + if (!FIRST_API_LEVEL.empty()) { value = FIRST_API_LEVEL.c_str(); } LOGD("[%s]: %s", name, value); } else if (prop.ends_with("vndk.version")) { - if (VNDK_VERSION.empty()) { - value = DEF_VNDK_VERSION; - } else { + if (!VNDK_VERSION.empty()) { value = VNDK_VERSION.c_str(); } LOGD("[%s]: %s", name, value); } else if (prop == "ro.build.id") { - if (BUILD_ID.empty()) { - value = DEF_BUILD_ID; - } else { + if (!BUILD_ID.empty()) { value = BUILD_ID.c_str(); } LOGD("[%s]: %s", name, value); @@ -161,6 +148,7 @@ private: if (json.contains("SECURITY_PATCH")) { if (json["SECURITY_PATCH"].is_null() || json["SECURITY_PATCH"].empty()) { LOGD("SECURITY_PATCH is null or empty"); + json.erase("SECURITY_PATCH"); } else { SECURITY_PATCH = json["SECURITY_PATCH"].get(); } @@ -242,6 +230,11 @@ static void companion(int fd) { FILE *json = fopen("/data/adb/pif.json", "rb"); + if (json == nullptr) { + + json = fopen("/data/adb/modules/playintegrityfix/pif.json", "rb"); + } + if (json) { fseek(json, 0, SEEK_END); jsonSize = ftell(json); diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/CustomProvider.java b/app/src/main/java/es/chiteroman/playintegrityfix/CustomProvider.java index 9224429..fd0f531 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/CustomProvider.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/CustomProvider.java @@ -2,6 +2,8 @@ package es.chiteroman.playintegrityfix; import java.security.Provider; import java.security.ProviderException; +import java.util.Arrays; +import java.util.Locale; public final class CustomProvider extends Provider { @@ -14,7 +16,14 @@ public final class CustomProvider extends Provider { public synchronized Service getService(String type, String algorithm) { EntryPoint.spoofDevice(); - if ("KeyPairGenerator".equals(type)) throw new ProviderException(); + if ("KeyPairGenerator".equals(type)) { + + if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(e -> e.getClassName().toLowerCase(Locale.US).contains("droidguard"))) { + + throw new ProviderException(); + + } + } return super.getService(type, algorithm); } diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java index b17a644..13f1566 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java @@ -31,8 +31,7 @@ public final class EntryPoint { reader.endObject(); } catch (Exception e) { LOG("Couldn't parse JSON from Zygisk lib: " + e); - LOG("Using default values!"); - setDefValues(); + LOG("Remove /data/adb/pif.json"); } spoofDevice(); @@ -47,16 +46,6 @@ public final class EntryPoint { map.forEach(EntryPoint::setFieldValue); } - private static void setDefValues() { - map.clear(); - map.put("PRODUCT", "WW_Z01H"); - map.put("DEVICE", "ASUS_Z01H_1"); - map.put("MANUFACTURER", "asus"); - map.put("BRAND", "asus"); - map.put("MODEL", "ASUS_Z01HD"); - map.put("FINGERPRINT", "asus/WW_Z01H/ASUS_Z01H_1:7.1.1/NMF26F/WW_user_71.60.139.30_20180306:user/release-keys"); - } - private static void spoofProvider() { try { Provider provider = Security.getProvider("AndroidKeyStore"); diff --git a/module/customize.sh b/module/customize.sh index 0fc33bd..3533d71 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -5,7 +5,7 @@ fi # safetynet-fix module is obsolete and it's incompatible with PIF. if [ -d /data/adb/modules/safetynet-fix ]; then - touch /data/adb/modules/safetynet-fix/remove + rm -rf /data/adb/modules/safetynet-fix ui_print "- ! safetynet-fix module will be removed. Do NOT install it again along PIF." fi diff --git a/module/module.prop b/module/module.prop index 7d480a0..d9d9fdb 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,7 +1,7 @@ id=playintegrityfix name=Play Integrity Fix -version=v14.4 -versionCode=14400 +version=v14.5 +versionCode=14500 author=chiteroman description=Fuck Play Integrity API. updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json \ No newline at end of file diff --git a/module/pif.json b/module/pif.json index 5164219..a97a48b 100644 --- a/module/pif.json +++ b/module/pif.json @@ -1,12 +1,9 @@ { - "PRODUCT": "", - "DEVICE": "", - "MANUFACTURER": "", - "BRAND": "", - "MODEL": "", - "FINGERPRINT": "", - "SECURITY_PATCH": "", - "FIRST_API_LEVEL": "", - "BUILD_ID": "", - "VNDK_VERSION": "" + "PRODUCT": "b1-780_ww_gen1", + "DEVICE": "acer_barricadewifi", + "MANUFACTURER": "Acer", + "BRAND": "acer", + "MODEL": "B1-780", + "FINGERPRINT": "acer/b1-780_ww_gen1/acer_barricadewifi:6.0/MRA58K/1481784106:user/release-keys", + "FIRST_API_LEVEL": "21" }