diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp index e7b9a73..d4b4286 100644 --- a/app/src/main/cpp/main.cpp +++ b/app/src/main/cpp/main.cpp @@ -204,6 +204,10 @@ static void companion(int fd) { std::filesystem::perms::others_read); } + if (!std::filesystem::exists(PROP_FILE_PATH)) { + std::filesystem::remove(prop); + } + if (std::filesystem::copy_file(PROP_FILE_PATH, prop, std::filesystem::copy_options::overwrite_existing)) { std::filesystem::permissions(prop, std::filesystem::perms::owner_read | diff --git a/changelog.md b/changelog.md index 8705688..795e9c3 100644 --- a/changelog.md +++ b/changelog.md @@ -2,12 +2,12 @@ We have a Telegram channel! If you want to share your knowledge join: https://t.me/playintegrityfix -Also, if Google blacklist the fingerprint (again), you can post your custom pif.prop and I will update the module. +Also, if Google blacklist the fingerprint (again), you can post your custom pif.json and I will update the module. -# v13.5 +# v13.6 -- Remove custom resetprop. -- Fixes in code. +- New code! +- Added custom resetprop. -This module will backup your pif.prop into adb root folder. -If you remove this file, module will use default props for attestation. \ No newline at end of file +Can read a custom pif.json file to spoof device props. +Example file: module/pif.json on GitHub repo. \ No newline at end of file diff --git a/module/META-INF/com/google/android/update-binary b/module/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..28b48e5 --- /dev/null +++ b/module/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 diff --git a/module/META-INF/com/google/android/updater-script b/module/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..11d5c96 --- /dev/null +++ b/module/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/module/bin/arm64-v8a/resetprop b/module/bin/arm64-v8a/resetprop new file mode 100644 index 0000000..513fdef Binary files /dev/null and b/module/bin/arm64-v8a/resetprop differ diff --git a/module/bin/armeabi-v7a/resetprop b/module/bin/armeabi-v7a/resetprop new file mode 100644 index 0000000..dad18cd Binary files /dev/null and b/module/bin/armeabi-v7a/resetprop differ diff --git a/module/bin/x86/resetprop b/module/bin/x86/resetprop new file mode 100644 index 0000000..b479c19 Binary files /dev/null and b/module/bin/x86/resetprop differ diff --git a/module/bin/x86_64/resetprop b/module/bin/x86_64/resetprop new file mode 100644 index 0000000..5b8dec7 Binary files /dev/null and b/module/bin/x86_64/resetprop differ diff --git a/module/customize.sh b/module/customize.sh new file mode 100644 index 0000000..3c09f66 --- /dev/null +++ b/module/customize.sh @@ -0,0 +1,20 @@ +# Error on < Android 8 +if [ "$API" -lt 26 ]; then + abort "!!! You can't use this module on Android < 8.0." +fi + +# safetynet-fix module is incompatible +if [ -d "/data/adb/modules/safetynet-fix" ]; then + ui_print "!!! safetynet-fix module removed!" + touch "/data/adb/modules/safetynet-fix/remove" +fi + +# Backup old pif.prop +if [ -e "/data/adb/modules/playintegrityfix/pif.prop" ]; then + ui_print "- Backup old pif.prop." + mv "/data/adb/modules/playintegrityfix/pif.prop" "/data/adb/pif.prop.old" +fi + +# use our resetprop +mv -f "$MODPATH/bin/$ABI/resetprop" "$MODPATH" +rm -rf "$MODPATH/bin" \ No newline at end of file diff --git a/module/module.prop b/module/module.prop new file mode 100644 index 0000000..bcb81a7 --- /dev/null +++ b/module/module.prop @@ -0,0 +1,7 @@ +id=playintegrityfix +name=Play Integrity Fix +version=v13.6 +versionCode=136 +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 diff --git a/module/pif.json b/module/pif.json new file mode 100644 index 0000000..ae6bbab --- /dev/null +++ b/module/pif.json @@ -0,0 +1,10 @@ +{ + "PRODUCT": "taimen", + "DEVICE": "taimen", + "MANUFACTURER": "Google", + "BRAND": "google", + "MODEL": "Pixel 2 XL", + "FINGERPRINT": "google/taimen/taimen:10/QQ2A.200501.001.B3/6396602:user/release-keys", + "SECURITY_PATCH": "2020-05-05", + "FIRST_API_LEVEL": "25" +} \ No newline at end of file diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh new file mode 100644 index 0000000..1593e37 --- /dev/null +++ b/module/post-fs-data.sh @@ -0,0 +1,9 @@ +# Remove Play Services from the Magisk Denylist when set to enforcing +if magisk --denylist status; then + magisk --denylist rm com.google.android.gms +fi + +# Check if safetynet-fix is installed +if [ -d "/data/adb/modules/safetynet-fix" ]; then + touch "/data/adb/modules/safetynet-fix/remove" +fi \ No newline at end of file diff --git a/module/service.sh b/module/service.sh new file mode 100644 index 0000000..d525753 --- /dev/null +++ b/module/service.sh @@ -0,0 +1,66 @@ +# Sensitive properties + +RESETPROP="${0%/*}/resetprop" + +chmod 755 $RESETPROP + +check_resetprop() { + local NAME=$1 + local EXPECTED=$2 + local VALUE=$(resetprop $NAME) + [ -z $VALUE ] || [ $VALUE = $EXPECTED ] || $RESETPROP -n $NAME $EXPECTED +} + +maybe_set_prop() { + local prop="$1" + local contains="$2" + local value="$3" + + if [[ "$(getprop "$prop")" == *"$contains"* ]]; then + $RESETPROP -n "$prop" "$value" + fi +} + +# Magisk recovery mode +maybe_set_prop ro.bootmode recovery unknown +maybe_set_prop ro.boot.mode recovery unknown +maybe_set_prop vendor.boot.mode recovery unknown + +# Reset props after boot completed to avoid breaking some weird devices/ROMs... +{ + until [[ "$(getprop sys.boot_completed)" == "1" ]]; do + sleep 1 + done + + # SafetyNet/Play Integrity | Avoid breaking Realme fingerprint scanners + check_resetprop ro.boot.flash.locked 1 + + # SafetyNet/Play Integrity | Avoid breaking Oppo fingerprint scanners + check_resetprop ro.boot.vbmeta.device_state locked + + # SafetyNet/Play Integrity | Avoid breaking OnePlus display modes/fingerprint scanners + check_resetprop vendor.boot.verifiedbootstate green + + # SafetyNet/Play Integrity | Avoid breaking OnePlus display modes/fingerprint scanners on OOS 12 + check_resetprop ro.boot.verifiedbootstate green + check_resetprop ro.boot.veritymode enforcing + check_resetprop vendor.boot.vbmeta.device_state locked + + # RootBeer, Microsoft + check_resetprop ro.build.tags release-keys + + # Samsung + check_resetprop ro.boot.warranty_bit 0 + check_resetprop ro.vendor.boot.warranty_bit 0 + check_resetprop ro.vendor.warranty_bit 0 + check_resetprop ro.warranty_bit 0 + + # OnePlus + check_resetprop ro.is_ever_orange 0 + + # Other + check_resetprop ro.build.type user + check_resetprop ro.debuggable 0 + check_resetprop ro.secure 1 + +}& diff --git a/update.json b/update.json index 25955d4..cebef10 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v13.5", - "versionCode": 135, - "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v13.5/PlayIntegrityFix_v13.5.zip", + "version": "v13.6", + "versionCode": 136, + "zipUrl": "https://github.com/chiteroman/PlayIntegrityFix/releases/download/v13.6/PlayIntegrityFix_v13.6.zip", "changelog": "https://raw.githubusercontent.com/chiteroman/PlayIntegrityFix/main/changelog.md" } \ No newline at end of file