From 5d42e12b7af524dda41fd3940b104bfe0f316c34 Mon Sep 17 00:00:00 2001 From: chiteroman <98092901+chiteroman@users.noreply.github.com> Date: Sun, 21 Jul 2024 01:05:59 +0200 Subject: [PATCH] Release v16.6 --- app/build.gradle.kts | 24 +++++++++---------- app/src/main/cpp/main.cpp | 12 ++++++---- .../playintegrityfix/CustomKeyStoreSpi.java | 10 +++++--- .../playintegrityfix/EntryPoint.java | 2 -- changelog.md | 8 +++---- module/module.prop | 2 +- update.json | 6 ++--- 7 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 28530af..6e6ea05 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,7 +16,7 @@ android { applicationId = "es.chiteroman.playintegrityfix" minSdk = 26 targetSdk = 35 - versionCode = 16500 + versionCode = 16600 versionName = "v16.6" multiDexEnabled = false @@ -31,17 +31,17 @@ android { externalNativeBuild { cmake { - arguments += "-DANDROID_STL=none" - arguments += "-DCMAKE_BUILD_TYPE=MinSizeRel" - - cFlags += "-w" - cppFlags += "-w" - - cppFlags += "-std=c++2c" - cppFlags += "-fno-exceptions" - cppFlags += "-fno-rtti" - cppFlags += "-fvisibility=hidden" - cppFlags += "-fvisibility-inlines-hidden" + arguments += arrayOf( + "-DANDROID_STL=none", + "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON", + "-DANDROID_CPP_FEATURES=no-rtti no-exceptions", + "-DCMAKE_BUILD_TYPE=MinSizeRel", + "-DCMAKE_CXX_STANDARD=23", + "-DCMAKE_C_STANDARD=23", + "-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON", + "-DCMAKE_CXX_VISIBILITY_PRESET=hidden", + "-DCMAKE_C_VISIBILITY_PRESET=hidden", + ) } } } diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index 8c8e7f0..ccaf409 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -60,11 +60,12 @@ static void (*o_system_property_read_callback)(const prop_info *, T_Callback, vo static void my_system_property_read_callback(const prop_info *pi, T_Callback callback, void *cookie) { - if (callback && cookie) callbacks[cookie] = callback; + if (pi && callback && cookie) callbacks[cookie] = callback; return o_system_property_read_callback(pi, modify_callback, cookie); } static void doHook() { + LOGD("JSON contains DEVICE_INITIAL_SDK_INT key. Hooking native prop symbol"); void *handle = DobbySymbolResolver(nullptr, "__system_property_read_callback"); if (!handle) { LOGE("error resolving __system_property_read_callback symbol!"); @@ -154,9 +155,10 @@ public: void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override { if (dexVector.empty()) return; - parseJSON(); + if (!json.empty()) parseJSON(); - doHook(); + if (enableHook) doHook(); + else api->setOption(zygisk::DLCLOSE_MODULE_LIBRARY); injectDex(); } @@ -170,11 +172,11 @@ private: JNIEnv *env = nullptr; std::vector dexVector; nlohmann::json json; + bool enableHook = false; void parseJSON() { - if (json.empty()) return; - if (json.contains("DEVICE_INITIAL_SDK_INT")) { + enableHook = true; if (json["DEVICE_INITIAL_SDK_INT"].is_string()) { DEVICE_INITIAL_SDK_INT = json["DEVICE_INITIAL_SDK_INT"].get(); } else if (json["DEVICE_INITIAL_SDK_INT"].is_number_integer()) { diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java b/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java index 13a3428..b618f20 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java @@ -1,5 +1,7 @@ package es.chiteroman.playintegrityfix; +import android.util.Log; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -10,7 +12,6 @@ import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.Certificate; import java.security.cert.CertificateException; -import java.util.Arrays; import java.util.Date; import java.util.Enumeration; import java.util.Locale; @@ -25,8 +26,11 @@ public final class CustomKeyStoreSpi extends KeyStoreSpi { @Override public Certificate[] engineGetCertificateChain(String alias) { - if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(e -> e.getClassName().toLowerCase(Locale.US).contains("droidguard"))) { - throw new UnsupportedOperationException(); + for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) { + if (stackTraceElement.getClassName().toLowerCase(Locale.US).contains("droidguard")) { + Log.w(EntryPoint.TAG, "DroidGuard invoke engineGetCertificateChain! Throwing exception..."); + throw new UnsupportedOperationException(); + } } return keyStoreSpi.engineGetCertificateChain(alias); } diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java index af952b0..c37eae9 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/EntryPoint.java @@ -49,8 +49,6 @@ public final class EntryPoint { jsonObject.keys().forEachRemaining(s -> { try { - if ("DEVICE_INITIAL_SDK_INT".equals(s)) return; - String value = jsonObject.getString(s); if (TextUtils.isEmpty(value)) return; diff --git a/changelog.md b/changelog.md index a83f149..156aeab 100644 --- a/changelog.md +++ b/changelog.md @@ -7,9 +7,7 @@ If not, try removing /data/adb/pif.json file. Donations: https://www.paypal.com/paypalme/chiteroman -# v16.5 +# v16.6 -- Update hook framework: [Dobby](https://github.com/chiteroman/Dobby.git) -- Fix Device not passing in few devices -- Improve code -- Reduce Zygisk libs size \ No newline at end of file +- Change fingerprint to fix RCS +- Misc improvements \ No newline at end of file diff --git a/module/module.prop b/module/module.prop index e9862c3..257e133 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,7 +1,7 @@ id=playintegrityfix name=Play Integrity Fix version=v16.6 -versionCode=16500 +versionCode=16600 author=chiteroman description=Universal modular fix for Play Integrity (and SafetyNet) on devices running Android 8-15 updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json diff --git a/update.json b/update.json index b9611d6..5343620 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v16.5", - "versionCode": 16500, - "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v16.5/PlayIntegrityFix_v16.5.zip", + "version": "v16.6", + "versionCode": 16600, + "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v16.6/PlayIntegrityFix_v16.6.zip", "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md" }