From 06aa2d83e95b48f72612ba969ed488ee182aff00 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 29 Nov 2023 11:01:58 -0400 Subject: [PATCH 1/5] Allow PROPS branch builds to update themselves, fix versioning --- changelog.md | 12 +++++++----- module/module.prop | 4 ++-- update.json | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index 26e921f..8bf2c56 100644 --- a/changelog.md +++ b/changelog.md @@ -2,10 +2,12 @@ We have a Telegram channel! If you want to share your knowledge join: https://t.me/playintegrityfix -# v13.8 +# CUSTOM SPOOF v2.1 -Google banned old fingerprints :( +DO NOT USE THIS BUILD IF YOU AREN'T A DEVELOPER, ALWAYS USE LATEST STABLE. +THIS BUILD IS JUST FOR TESTING PURPOSES. -This build has hardcoded the fix into Zygisk native libs like v13.0. - -You can't use pif.json or pif.prop files to spoof custom props. \ No newline at end of file +- Removed custom resetprop. +- Fix JSON parsing. +- Less libs size. +- Few code improvements. diff --git a/module/module.prop b/module/module.prop index 70ffaef..0503971 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,7 +1,7 @@ id=playintegrityfix name=Play Integrity Fix version=PROPS-v2.1 -versionCode=2001 +versionCode=2101 author=chiteroman description=Fix CTS profile (SafetyNet) and DEVICE verdict (Play Integrity). -updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/update.json \ No newline at end of file +updateJson=https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/custom/update.json diff --git a/update.json b/update.json index 6e4bb71..f39cd59 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v13.8", - "versionCode": 138, - "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v13.8/PlayIntegrityFix_v13.8.zip", - "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md" -} \ No newline at end of file + "version": "v2.1", + "versionCode": 2101, + "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/PROPS/PlayIntegrityFix_PROPS-v2.1.zip", + "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/custom/changelog.md" +} From 502dae9c4549accd77cfecaa3223e78022bb2f6d Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 29 Nov 2023 11:19:43 -0400 Subject: [PATCH 2/5] Use custom.pif.json for custom spoofing, restore after update, fix lines --- README.md | 4 ++-- app/src/main/cpp/main.cpp | 9 ++++++++- module/customize.sh | 8 +++++++- module/post-fs-data.sh | 2 +- module/service.sh | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 51036f6..bf777bf 100644 --- a/README.md +++ b/README.md @@ -27,9 +27,9 @@ It injects a classes.dex file to modify a few fields in the android.os.Build cla The purpose of the module is to avoid a hardware attestation. -## About 'pif.json' file +## About 'custom.pif.json' file -You can modify this file in the module directory to spoof custom values to the GMS unstable process. +You can create this file in the module directory to spoof custom values to the GMS unstable process. It will be used instead of the included pif.json. You can't use values from recent devices due them triggering hardware backed attestation. diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index f9f596e..f7c81a1 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -11,6 +12,7 @@ #define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex" #define JSON_FILE_PATH "/data/adb/modules/playintegrityfix/pif.json" +#define CUSTOM_JSON_FILE_PATH "/data/adb/modules/playintegrityfix/custom.pif.json" static std::string FIRST_API_LEVEL, SECURITY_PATCH; @@ -247,7 +249,12 @@ static void companion(int fd) { fclose(dex); } - FILE *json = fopen(JSON_FILE_PATH, "r"); + struct stat tmpbuf; + if (stat(CUSTOM_JSON_FILE_PATH, &tmpbuf) == 0) { + FILE *json = fopen(CUSTOM_JSON_FILE_PATH, "r"); + else { + FILE *json = fopen(JSON_FILE_PATH, "r"); + } if (json) { fseek(json, 0, SEEK_END); diff --git a/module/customize.sh b/module/customize.sh index 091ef0f..cc5a94d 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -9,6 +9,12 @@ if [ -d /data/adb/modules/safetynet-fix ]; then ui_print "- 'safetynet-fix' module will be removed on next reboot" fi +# Copy any custom.pif.json to updated module +if [ -f /data/adb/modules/playintegrityfix/custom.pif.json ]; then + ui_print "- Restoring custom.pif.json" + cp -af /data/adb/modules/playintegrityfix/custom.pif.json $MODPATH/custom.pif.json +fi + # Clean up any leftover files from previous deprecated methods rm -f /data/data/com.google.android.gms/cache/pif.prop /data/data/com.google.android.gms/pif.prop -rm -f /data/data/com.google.android.gms/cache/pif.json /data/data/com.google.android.gms/pif.json \ No newline at end of file +rm -f /data/data/com.google.android.gms/cache/pif.json /data/data/com.google.android.gms/pif.json diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 39911d7..6196daf 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -6,4 +6,4 @@ fi # Remove safetynet-fix module if installed if [ -d /data/adb/modules/safetynet-fix ]; then touch /data/adb/modules/safetynet-fix/remove -fi \ No newline at end of file +fi diff --git a/module/service.sh b/module/service.sh index 279ec51..745e296 100644 --- a/module/service.sh +++ b/module/service.sh @@ -68,4 +68,4 @@ fi resetprop_if_diff ro.boot.verifiedbootstate green resetprop_if_diff ro.boot.veritymode enforcing resetprop_if_diff vendor.boot.vbmeta.device_state locked -}& \ No newline at end of file +}& From c07e2707b7319617db6a27392e1ac4591d9af42f Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 29 Nov 2023 12:49:52 -0400 Subject: [PATCH 3/5] Move props that need to be changed earlier into post-fs-data.sh --- module/post-fs-data.sh | 34 ++++++++++++++++++++++++++++++++++ module/service.sh | 22 ++-------------------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 6196daf..42a4ccf 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -7,3 +7,37 @@ fi if [ -d /data/adb/modules/safetynet-fix ]; then touch /data/adb/modules/safetynet-fix/remove fi + +# Conditional early sensitive properties + +resetprop_if_diff() { + local NAME=$1 + local EXPECTED=$2 + local CURRENT=$(resetprop $NAME) + + [ -z "$CURRENT" ] || [ "$CURRENT" == "$EXPECTED" ] || resetprop $NAME $EXPECTED +} +resetprop_if_match() { + local NAME=$1 + local CONTAINS=$2 + local VALUE=$3 + + [[ "$(resetprop $NAME)" == *"$CONTAINS"* ]] && resetprop $NAME $VALUE +} + +# RootBeer, Microsoft +resetprop_if_diff ro.build.tags release-keys + +# Samsung +resetprop_if_diff ro.boot.warranty_bit 0 +resetprop_if_diff ro.vendor.boot.warranty_bit 0 +resetprop_if_diff ro.vendor.warranty_bit 0 +resetprop_if_diff ro.warranty_bit 0 + +# OnePlus +resetprop_if_diff ro.is_ever_orange 0 + +# Other +resetprop_if_diff ro.build.type user +resetprop_if_diff ro.debuggable 0 +resetprop_if_diff ro.secure 1 diff --git a/module/service.sh b/module/service.sh index 745e296..5cf3d4b 100644 --- a/module/service.sh +++ b/module/service.sh @@ -15,33 +15,15 @@ resetprop_if_match() { [[ "$(resetprop $NAME)" == *"$CONTAINS"* ]] && resetprop $NAME $VALUE } -# RootBeer, Microsoft -resetprop_if_diff ro.build.tags release-keys - -# Samsung -resetprop_if_diff ro.boot.warranty_bit 0 -resetprop_if_diff ro.vendor.boot.warranty_bit 0 -resetprop_if_diff ro.vendor.warranty_bit 0 -resetprop_if_diff ro.warranty_bit 0 - -# OnePlus -resetprop_if_diff ro.is_ever_orange 0 - -# Other -resetprop_if_diff ro.build.type user -resetprop_if_diff ro.debuggable 0 -resetprop_if_diff ro.secure 1 - # Magisk recovery mode resetprop_if_match ro.bootmode recovery unknown resetprop_if_match ro.boot.mode recovery unknown resetprop_if_match vendor.boot.mode recovery unknown # SELinux -if [ -n "$(getprop ro.build.selinux)" ]; then - resetprop --delete ro.build.selinux +if [ -n "$(resetprop ro.build.selinux)" ]; then + resetprop --delete ro.build.selinux fi - # use toybox to protect *stat* access time reading if [ "$(toybox cat /sys/fs/selinux/enforce)" == "0" ]; then chmod 640 /sys/fs/selinux/enforce From ffcc2df8b56fb1373cf7774f56c44e4368b80dbd Mon Sep 17 00:00:00 2001 From: osm0sis Date: Wed, 29 Nov 2023 12:55:27 -0400 Subject: [PATCH 4/5] Warn of possible conflict if MagiskHidePropsConfig is installed --- module/customize.sh | 5 ++++- module/post-fs-data.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/module/customize.sh b/module/customize.sh index cc5a94d..0b02fdf 100644 --- a/module/customize.sh +++ b/module/customize.sh @@ -3,11 +3,14 @@ if [ "$API" -lt 26 ]; then abort "!!! You can't use this module on Android < 8.0" fi -# Remove safetynet-fix module if installed +# Remove/warn if conflicting modules are installed if [ -d /data/adb/modules/safetynet-fix ]; then touch /data/adb/modules/safetynet-fix/remove ui_print "- 'safetynet-fix' module will be removed on next reboot" fi +if [ -d /data/adb/modules/MagiskHidePropsConf ]; then + ui_print "- Warning, 'MagiskHidePropsConf' module may cause issues with PIF" +fi # Copy any custom.pif.json to updated module if [ -f /data/adb/modules/playintegrityfix/custom.pif.json ]; then diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 42a4ccf..f19aae2 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -3,7 +3,7 @@ if magisk --denylist status; then magisk --denylist rm com.google.android.gms fi -# Remove safetynet-fix module if installed +# Remove conflicting modules if installed if [ -d /data/adb/modules/safetynet-fix ]; then touch /data/adb/modules/safetynet-fix/remove fi From e7ed2db1cbe2d99948a9d7ef4dffc27c942eaa94 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Thu, 30 Nov 2023 08:17:15 -0400 Subject: [PATCH 5/5] Switch to simplest file check for custom json --- app/src/main/cpp/main.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index f7c81a1..70ee610 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -12,6 +11,7 @@ #define DEX_FILE_PATH "/data/adb/modules/playintegrityfix/classes.dex" #define JSON_FILE_PATH "/data/adb/modules/playintegrityfix/pif.json" + #define CUSTOM_JSON_FILE_PATH "/data/adb/modules/playintegrityfix/custom.pif.json" static std::string FIRST_API_LEVEL, SECURITY_PATCH; @@ -249,12 +249,9 @@ static void companion(int fd) { fclose(dex); } - struct stat tmpbuf; - if (stat(CUSTOM_JSON_FILE_PATH, &tmpbuf) == 0) { - FILE *json = fopen(CUSTOM_JSON_FILE_PATH, "r"); - else { + FILE *json = fopen(CUSTOM_JSON_FILE_PATH, "r"); + if (!json) FILE *json = fopen(JSON_FILE_PATH, "r"); - } if (json) { fseek(json, 0, SEEK_END);