diff --git a/.idea/misc.xml b/.idea/misc.xml index cdbd289..e6b1965 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,7 @@ + - + diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ea22f59..3347b7c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,8 +16,8 @@ android { applicationId = "es.chiteroman.playintegrityfix" minSdk = 26 targetSdk = 34 - versionCode = 15980 - versionName = "v15.9.8" + versionCode = 15990 + versionName = "v15.9.9" multiDexEnabled = false packaging { diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index 6e2657d..e94268b 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include "dobby.h" #include "json.hpp" #include "zygisk.hpp" @@ -14,7 +13,7 @@ #define PIF_JSON_DEFAULT "/data/adb/modules/playintegrityfix/pif.json" -static nlohmann::json PROPS; +static std::string DEVICE_INITIAL_SDK_INT, SECURITY_PATCH, ID; typedef void (*T_Callback)(void *, const char *, const char *, uint32_t); @@ -24,20 +23,16 @@ static void modify_callback(void *cookie, const char *name, const char *value, u if (cookie == nullptr || name == nullptr || value == nullptr || o_callback == nullptr) return; - std::string prop(name); + std::string_view prop(name); - for (auto &[key, val]: PROPS.items()) { - if (key.starts_with('*')) { - if (prop.ends_with(key.substr(1))) { - value = val.get().c_str(); - break; - } - } else { - if (prop == key) { - value = val.get().c_str(); - break; - } - } + if (prop.ends_with("api_level") && !DEVICE_INITIAL_SDK_INT.empty()) { + value = DEVICE_INITIAL_SDK_INT.c_str(); + } else if (prop.ends_with(".security_patch") && !SECURITY_PATCH.empty()) { + value = SECURITY_PATCH.c_str(); + } else if (prop.ends_with(".id") && !ID.empty()) { + value = ID.c_str(); + } else if (prop == "sys.usb.state") { + value = "none"; } if (!prop.starts_with("persist") && !prop.starts_with("cache") && !prop.starts_with("debug")) { @@ -143,16 +138,13 @@ public: close(fd); json = nlohmann::json::parse(jsonVector, nullptr, false, true); - - if (json.contains("PROPS")) { - PROPS = json["PROPS"]; - json.erase("PROPS"); - } } void postAppSpecialize(const zygisk::AppSpecializeArgs *args) override { if (dexVector.empty() || json.empty()) return; + parseJson(); + injectDex(); doHook(); @@ -168,6 +160,19 @@ private: std::vector dexVector; nlohmann::json json; + void parseJson() { + if (json.contains("DEVICE_INITIAL_SDK_INT")) { + DEVICE_INITIAL_SDK_INT = json["DEVICE_INITIAL_SDK_INT"].get(); + json.erase("DEVICE_INITIAL_SDK_INT"); // You can't modify field value + } + if (json.contains("SECURITY_PATCH")) { + SECURITY_PATCH = json["SECURITY_PATCH"].get(); + } + if (json.contains("ID")) { + ID = json["ID"].get(); + } + } + void injectDex() { LOGD("get system classloader"); auto clClass = env->FindClass("java/lang/ClassLoader"); diff --git a/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java b/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java index f7efa21..9a2f41d 100644 --- a/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java +++ b/app/src/main/java/es/chiteroman/playintegrityfix/CustomKeyStoreSpi.java @@ -10,7 +10,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; @@ -26,9 +25,10 @@ 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"))) { - EntryPoint.LOG("DroidGuard call detected. Throw exception!"); - throw new UnsupportedOperationException(); + for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) { + if (stackTraceElement.getClassName().toLowerCase(Locale.US).contains("droidguard")) { + throw new UnsupportedOperationException(); + } } return keyStoreSpi.engineGetCertificateChain(alias); diff --git a/changelog.md b/changelog.md index 18aaab3..570f5a8 100644 --- a/changelog.md +++ b/changelog.md @@ -7,8 +7,7 @@ If not, try removing /data/adb/pif.json file. Donations: https://www.paypal.com/paypalme/chiteroman -# v15.9.8 +# v15.9.9 - MEETS_DEVICE_INTEGRITY is green again ✅ -- Refine code -- You can define your own native props in pif.json! \ No newline at end of file +- Refine code logic diff --git a/module/customize.sh b/module/customize.sh index 2519b90..091f935 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -17,7 +17,6 @@ fi # Check custom fingerprint if [ -f "/data/adb/pif.json" ]; then - ui_print "- You are using custom fingerprint!" - ui_print "- If you fail DEVICE verdict, remove /data/adb/pif.json file" - ui_print "- If pif.json file doesn't exist, module will use default one" -fi \ No newline at end of file + mv -f "/data/adb/pif.json" "/data/adb/pif.json.old" + ui_print "- Backup old pif.json" +fi diff --git a/module/module.prop b/module/module.prop index c5c91ea..b660f78 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,7 +1,7 @@ id=playintegrityfix name=Play Integrity Fix -version=v15.9.8 -versionCode=15980 +version=v15.9.9 +versionCode=15990 author=chiteroman description=Universal modular fix for Play Integrity (and SafetyNet) on devices running Android 8-14. updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json diff --git a/module/pif.json b/module/pif.json index 254491f..564df3f 100644 --- a/module/pif.json +++ b/module/pif.json @@ -1,22 +1,15 @@ { - "MANUFACTURER": "motorola", - "MODEL": "XT1575", - "FINGERPRINT": "motorola/clark_retus/clark:6.0/MPHS24.49-18-8/4:user/release-keys", - "BRAND": "motorola", - "PRODUCT": "clark_retus", - "DEVICE": "clark", - "RELEASE": "6.0", - "ID": "MPHS24.49-18-8", - "INCREMENTAL": "4", + "MANUFACTURER": "Google", + "MODEL": "Pixel", + "FINGERPRINT": "google/sailfish/sailfish:8.1.0/OPM1.171019.011/4448085:user/release-keys", + "BRAND": "google", + "PRODUCT": "sailfish", + "DEVICE": "sailfish", + "RELEASE": "8.1.0", + "ID": "OPM1.171019.011", + "INCREMENTAL": "4448085", "TYPE": "user", "TAGS": "release-keys", - "SECURITY_PATCH": "2016-09-01", - "PROPS": { - "*api_level": "25", - "*.security_patch": "2016-09-01", - "*.build.id": "MPHS24.49-18-8", - "*.fingerprint": "motorola/clark_retus/clark:6.0/MPHS24.49-18-8/4:user/release-keys", - "sys.usb.state": "none", - "ro.secureboot.lockstate": "locked" - } + "SECURITY_PATCH": "2017-12-05", + "DEVICE_INITIAL_SDK_INT": "25" } \ No newline at end of file diff --git a/update.json b/update.json index 7d0663d..7c03da5 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v15.9.8", - "versionCode": 15980, - "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v15.9.8/PlayIntegrityFix_v15.9.8.zip", + "version": "v15.9.9", + "versionCode": 15990, + "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v15.9.9/PlayIntegrityFix_v15.9.9.zip", "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md" }