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 +}&