PlayIntegrityFix/module/service.sh

81 lines
2.2 KiB
Bash
Raw Normal View History

2023-11-24 21:58:30 +02:00
# Sensitive properties
2023-11-26 16:00:21 +02:00
RESETPROP="${0%/*}/resetprop"
2023-11-27 09:29:30 +02:00
if [ -e "$RESETPROP" ]; then
2023-11-26 18:02:51 +02:00
chmod 755 $RESETPROP
else
RESETPROP="resetprop"
fi
2023-11-26 16:00:21 +02:00
check_resetprop() {
local NAME=$1
local EXPECTED=$2
local VALUE=$(resetprop $NAME)
[ -z $VALUE ] || [ $VALUE = $EXPECTED ] || $RESETPROP -n $NAME $EXPECTED
}
2023-11-24 21:58:30 +02:00
maybe_set_prop() {
local prop="$1"
local contains="$2"
local value="$3"
if [[ "$(getprop "$prop")" == *"$contains"* ]]; then
2023-11-26 16:00:21 +02:00
$RESETPROP -n "$prop" "$value"
2023-11-24 21:58:30 +02:00
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
2023-11-25 03:13:22 +02:00
# Hiding SELinux | Permissive status
2023-11-26 16:00:21 +02:00
if [ -n "$(getprop ro.build.selinux)" ]; then
2023-11-27 09:29:30 +02:00
$RESETPROP --delete ro.build.selinux
2023-11-26 16:00:21 +02:00
fi
2023-11-25 03:13:22 +02:00
# Hiding SELinux | Use toybox to protect *stat* access time reading
if [[ "$(toybox cat /sys/fs/selinux/enforce)" == "0" ]]; then
chmod 640 /sys/fs/selinux/enforce
chmod 440 /sys/fs/selinux/policy
fi
2023-11-26 16:00:21 +02:00
# Reset props after boot completed to avoid breaking some weird devices/ROMs...
2023-11-24 21:58:30 +02:00
{
until [[ "$(getprop sys.boot_completed)" == "1" ]]; do
sleep 1
done
# SafetyNet/Play Integrity | Avoid breaking Realme fingerprint scanners
2023-11-26 16:00:21 +02:00
check_resetprop ro.boot.flash.locked 1
2023-11-24 21:58:30 +02:00
# SafetyNet/Play Integrity | Avoid breaking Oppo fingerprint scanners
2023-11-26 16:00:21 +02:00
check_resetprop ro.boot.vbmeta.device_state locked
2023-11-24 21:58:30 +02:00
# SafetyNet/Play Integrity | Avoid breaking OnePlus display modes/fingerprint scanners
2023-11-26 16:00:21 +02:00
check_resetprop vendor.boot.verifiedbootstate green
2023-11-24 21:58:30 +02:00
# SafetyNet/Play Integrity | Avoid breaking OnePlus display modes/fingerprint scanners on OOS 12
2023-11-26 16:00:21 +02:00
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
2023-11-27 09:29:30 +02:00
}&