diff --git a/README.md b/README.md index b41c3f6..824f498 100644 --- a/README.md +++ b/README.md @@ -290,12 +290,12 @@ You can enter the fingerprint manually in the `Edit device fingerprint` menu in ## Force BASIC key attestation -Google now enforces the use of hardware backed key attestation on devices that has the necessary hardware (all devices that shipped with Android 8+ and even some older devices). Up until mid January 2021 you could work around this by changing the model props to something other than the actual device. This might still be necessary, and can be done with this feature of the module, but you most likely also need to trick keystore further than that. +Google now enforces the use of hardware backed key attestation on devices that has the necessary hardware (all devices that shipped with Android 8+ and even some older devices).This can be circumvented by tricking the device into not using the hardware attestation, and it might also be needed to change the prop models (`ro.product.model`) to something other than your devices actual model. This feature can help with that. @kdrag0n over on XDA Developers have a Magsk module that will trick keystore into thinking that the hardware isn't available and this will then force basic attestation. You can find that module together with details on how it works here: https://forum.xda-developers.com/t/magisk-module-universal-safetynet-fix-1-1-0.4217823/ -These two things in combination might be required to pass CTS. +The Universal SafetyNet fix not only trickes the keystore into using basic attestation, from v2.1.0 it also changes prop values that might be necessary to trick Google Play Services into letting you pass the CTS profile check, so if you're using that module you most likely will not need to use the Force BASIC key attestation feature of this module. If you aren't successful in passing CTS by changing the model, you could try using the Xposed (although it is recommended to use LSPosed if you want to have the best chance of passing SafetyNet) module XprivacyLua and restrict Google Play Services. Instructions on how to install LSPosed and XprivacyLua and how to use that module can be found with a simple web search, I won't cover that here. @@ -355,7 +355,7 @@ The props in question are: - ro.vendor.warranty_bit - vendor.boot.vbmeta.device_state -There are a few props that will only change if a triggering value is detected, and these are: +There are a few props that will only change if a triggering value is detected, and these are (these will always be set in the post-fs-data boot stage): - ro.bootmode - ro.boot.mode - vendor.boot.mode @@ -614,6 +614,12 @@ Releases from v5.4.0 will only install on Magisk v20.4+. ## Changelog +### v6.0.2 +- Fix problems when trying to disable/enable sensitive props. +- Fix typo when checking for triggering prop values (meant that props wouldn't set properly during boot). +- Fix UI info for if a sensitive prop has been set by the module or not. +- More optimisations of the new code (but it's by no means optimised). + ### v6.0.1 - Quickfix update to make the soft reboot when setting props in the late_start service boot stage an option. It has the potential for causing issues it seems (mainly on Samsung devices apparently). See the documentation for details. - Minor UI fixes and optimisations. diff --git a/common/propsconf_conf b/common/propsconf_conf index e448d8d..86de603 100644 --- a/common/propsconf_conf +++ b/common/propsconf_conf @@ -38,25 +38,25 @@ CONFPARTPROPS=true CONFSIMBOOT=default # MagiskHide sensitive props -CONFDEBUGGABLE="" -CONFSECURE="" -CONFTYPE="" -CONFTAGS="" -CONFBOOTMODE="" -CONFMODE="" -CONFVENDORMODE="" -CONFHWC="" -CONFHWCOUNTRY="" -CONFSTATE="" -CONFVERIFIEDBOOTSTATE="" -CONFVENDORVERIFIEDBOOTSTATE="" -CONFLOCKED="" -CONFVERITYMODE="" -CONFBOOTWARRANTY_BIT="" -CONFBIT="" -CONFVENDORBOOTWARRANTY_BIT="" -CONFVENDORWARRANTY_BIT="" -CONFVENDORDEVICE_STATE="" +CONFDEBUGGABLE=true +CONFSECURE=true +CONFTYPE=true +CONFTAGS=true +CONFBOOTMODE=true +CONFMODE=true +CONFVENDORMODE=true +CONFHWC=true +CONFHWCOUNTRY=true +CONFSTATE=true +CONFVERIFIEDBOOTSTATE=true +CONFVENDORVERIFIEDBOOTSTATE=true +CONFLOCKED=true +CONFVERITYMODE=true +CONFBOOTWARRANTY_BIT=true +CONFBIT=true +CONFVENDORBOOTWARRANTY_BIT=true +CONFVENDORWARRANTY_BIT=true +CONFVENDORDEVICE_STATE=true # Set custom props CONFPROPS="" @@ -155,27 +155,12 @@ CONFBACK=false # post-fs-data or late_start service mode. This is useful if props don't seem to set # propely or the module's boot script seems to be causing issues during boot. -# The MagiskHide prop variables can be set as follows -# (note that these props are by default set to the safe value): -# CONFDEBUGGABLE - 0 or 1 (sensitive value is "1") -# CONFSECURE - 0 or 1 (sensitive value is "0") -# CONFTYPE - user or userdebug (sensitive value is "userdebug") -# CONFTAGS - release-keys or test-keys (sensitive value is "test-keys") -# CONFBOOTMODE - unknown or recovery (sensitive value is "recovery") -# CONFMODE - unknown or recovery (sensitive value is "recovery") -# CONFVENDORMODE - unknown or recovery (sensitive value is "recovery") -# CONFHWC - GLOBAL or CN (sensitive value is CN) -# CONFHWCOUNTRY - GLOBAL or China (sensitive value is China) -# CONFSTATE - locked or unlocked (sensitive value is unlocked) -# CONFVERIFIEDBOOTSTATE - green or orange (sensitive value is orange) -# CONFVENDORVERIFIEDBOOTSTATE - green or orange (sensitive value is orange) -# CONFLOCKED - 1 or 0 (sensitive value is 0) -# CONFVERITYMODE - enforcing or permissive (sensitive value is permissive) -# CONFBOOTWARRANTY_BIT - 0 or 1 (sensitive value is "1") -# CONFBIT - 0 or 1 (sensitive value is "1") -# CONFVENDORBOOTWARRANTY_BIT - 0 or 1 (sensitive value is "1") -# CONFVENDORWARRANTY_BIT - 0 or 1 (sensitive value is "1") -# CONFVENDORDEVICE_STATE - locked or unlocked (sensitive value is unlocked) +# The MagiskHide prop variables, CONFDEBUGGABLE, CONFSECURE, CONFTYPE, CONFBOOTMODE, CONFMODE, +# CONFVENDORMODE, CONFHWC, CONFHWCOUNTRY, CONFSTATE, CONFVERIFIEDBOOTSTATE, CONFVENDORVERIFIEDBOOTSTATE, +# CONFLOCKED, CONFVERITYMODE, CONFBOOTWARRANTY_BIT, CONFBIT, CONFVENDORBOOTWARRANTY_BIT, +# CONFVENDORWARRANTY_BIT and CONFVENDORDEVICE_STATE can be either enabled or disabled (enabled by default). +# If set to true, these props will be changed known safe values if found to contain sensitive values. +# Helps with hiding root. # CONFPROPS should contain any custom props and the value you want the module to set. # Any props you've previously edited in build.prop, and more, can be set like this. diff --git a/common/propsconf_late b/common/propsconf_late index 1d78f84..f34ac23 100644 --- a/common/propsconf_late +++ b/common/propsconf_late @@ -8,9 +8,9 @@ # In that case, feel free to delete it. # Script version -SCRIPTV=39 -SETTRANSF=4 -NOTTRANSF="PROPCOUNT;PROPEDIT;REDEBUGGABLE;RESECURE;RETYPE;RETAGS;REBOOTMODE;REMODE" +SCRIPTV=40 +SETTRANSF=5 +NOTTRANSF="PROPCOUNT;PROPEDIT;REDEBUGGABLE;RESECURE;RETYPE;RETAGS;REBOOTMODE;REMODE;REVENDORMODE;REHWC;REHWCOUNTRY;RESTATE;REVERIFIEDBOOTSTATE;REVENDORVERIFIEDBOOTSTATE;RELOCKED;REVERITYMODE;REBOOTWARRANTY_BIT;REBIT;REVENDORBOOTWARRANTY_BIT;REVENDORWARRANTY_BIT;REVENDORDEVICE_STATE" # Fingerprint FINGERPRINTENB=1 @@ -43,6 +43,26 @@ PARTPROPSSET=1 PROPCOUNT=19 PROPEDIT=1 PROPBOOT=0 +# Control variables +REDEBUGGABLE=1 +RESECURE=1 +RETYPE=1 +RETAGS=1 +REBOOTMODE=1 +REMODE=1 +REVENDORMODE=1 +REHWC=1 +REHWCOUNTRY=1 +RESTATE=1 +REVERIFIEDBOOTSTATE=1 +REVENDORVERIFIEDBOOTSTATE=1 +RELOCKED=1 +REVERITYMODE=1 +REBOOTWARRANTY_BIT=1 +REBIT=1 +REVENDORBOOTWARRANTY_BIT=1 +REVENDORWARRANTY_BIT=1 +REVENDORDEVICE_STATE=1 # Custom props CUSTOMEDIT=0 @@ -156,24 +176,3 @@ CUSTOMPROPSLIST="$CUSTOMPROPS $CUSTOMPROPSPOST $CUSTOMPROPSLATE $CUSTOMPROPSDELA # ---Delete prop values--- DELETEPROPS="" - -# ---MagiskHide sensitive props--- -REDEBUGGABLE=true -RESECURE=true -RETYPE=true -RETAGS=true -REBOOTMODE=true -REMODE=true -REVENDORMODE=true -REHWC=true -REHWCOUNTRY=true -RESTATE=true -REVERIFIEDBOOTSTATE=true -REVENDORVERIFIEDBOOTSTATE=true -RELOCKED=true -REVERITYMODE=true -REBOOTWARRANTY_BIT=true -REBIT=true -REVENDORBOOTWARRANTY_BIT=true -REVENDORWARRANTY_BIT=true -REVENDORDEVICE_STATE=true diff --git a/common/util_functions.sh b/common/util_functions.sh index 1ba7138..b3d961a 100644 --- a/common/util_functions.sh +++ b/common/util_functions.sh @@ -1,4 +1,4 @@ -#!/system/bin/sh + #!/system/bin/sh # MagiskHide Props Config # Copyright (c) 2018-2021 Didgeridoohan @ XDA Developers @@ -73,6 +73,25 @@ if [ "$INSTFN" ]; then PROPCOUNT PROPEDIT PROPBOOT + REDEBUGGABLE + RESECURE + RETYPE + RETAGS + REBOOTMODE + REMODE + REVENDORMODE + REHWC + REHWCOUNTRY + RESTATE + REVERIFIEDBOOTSTATE + REVENDORVERIFIEDBOOTSTATE + RELOCKED + REVERITYMODE + REBOOTWARRANTY_BIT + REBIT + REVENDORBOOTWARRANTY_BIT + REVENDORWARRANTY_BIT + REVENDORDEVICE_STATE CUSTOMEDIT DELEDIT PRINTSTAGE @@ -231,23 +250,6 @@ ro.vendor.warranty_bit vendor.boot.vbmeta.device_state " -# Safe values -SAFELIST=" -ro.debuggable=0 -ro.secure=1 -ro.build.type=user -ro.build.tags=release-keys -ro.boot.vbmeta.device_state=locked -ro.boot.verifiedbootstate=green -ro.boot.flash.locked=1 -ro.boot.veritymode=enforcing -ro.boot.warranty_bit=0 -ro.warranty_bit=0 -ro.vendor.boot.warranty_bit=0 -ro.vendor.warranty_bit=0 -vendor.boot.vbmeta.device_state=locked -" - # Trigger props TRIGGERPROPS=" ro.bootmode @@ -257,15 +259,6 @@ ro.boot.hwc ro.boot.hwcountry " -# Safe values -TRIGGERSAFELIST=" -ro.bootmode=unknown -ro.boot.mode=unknown -vendor.boot.mode=unknown -ro.boot.hwc=GLOBAL -ro.boot.hwcountry=GLOBAL -" - # Triggering values TRIGGERLIST=" ro.bootmode=recovery @@ -280,11 +273,6 @@ LATEPROPS=" vendor.boot.verifiedbootstate " -# Safe value -LATESAFELIST=" -vendor.boot.verifiedbootstate=green -" - # Partitions used for different props PARTITIONS=" system @@ -776,7 +764,7 @@ config_file() { change_print "$PROPTYPE" "$TMPPROP" "file" fi else - change_prop "$PROPTYPE" "$TMPPROP" "file" + change_prop "$PROPTYPE" "file" fi fi else @@ -1093,7 +1081,7 @@ system_prop() { fi echo -e "# This file will be read by resetprop\n# MagiskHide Props Config\n# Copyright (c) 2018-2021 Didgeridoohan @ XDA Developers\n# Licence: MIT" > $MODPATH/system.prop if [ "$PROPEDIT" == 1 ] && [ "$PROPBOOT" == 0 ]; then - sensitive_props "$PROPSLIST" "$SAFELIST" "$MODPATH/system.prop" + sensitive_props "$PROPSLIST" "$MODPATH/system.prop" fi if [ "$OPTIONBOOT" == 0 ] && [ "$PRINTSTAGE" == 0 ]; then print_edit "$MODPATH/system.prop" @@ -1155,7 +1143,7 @@ settings_placement() { if [ "$FILEV" == 0 ]; then log_print "- Placing settings file" # Updated file with a required clearing of settings - elif [ "$UPDATETRANSF" -gt "$FILETRANSF" ] && [ ! "$NOTTRANSF" ]; then + elif [ "$UPDATETRANSF" -gt "$FILETRANSF" ] && [ -z "$NOTTRANSF" ]; then log_handler "Current transfer version - ${FILETRANSF}" log_handler "Update transfer version - ${UPDATETRANSF}" log_handler "No settings set to not transfer" @@ -2017,18 +2005,22 @@ change_sim_partprops() { } # ======================== MagiskHide Props functions ======================== -# Populate menu, $1=List of props to go through (with safe values), $2=type of list, $3=check if menu items should be printed or only counted +# Populate menu, $1=List of props to go through, $2=type of list, $3=check if menu items should be printed or only counted magiskhide_props_menu() { CHKCOUNT=true if [ "$3" == "count" ] && [ "$PROPEDIT" == 0 ]; then CHKCOUNT=false fi if [ "$CHKCOUNT" == "true" ]; then - ACTIVE="${G} (active)${N}" + ACTIVETXT="${G} (active)${N}" + ENABLEDTXT="${G} (enabled, not active)${N}" for ITEM in $1; do - PROP=$(get_prop_type $(get_eq_left "$ITEM")) + PROP=$(get_prop_type $ITEM) + REVALUE=$(eval "echo \$$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')") + CURRVALUE=$(eval "echo \$$(echo "CURR${PROP}" | tr '[:lower:]' '[:upper:]')") ORIGVALUE=$(eval "echo \$$(echo "ORIG${PROP}" | tr '[:lower:]' '[:upper:]')") - if [ "$ORIGVALUE" ] && [ "$(get_eq_right "$ITEM")" != "$ORIGVALUE" ]; then + MODULEVALUE=$(eval "echo \$$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]')") + if [ "$ORIGVALUE" ] && [ "$MODULEVALUE" != "$ORIGVALUE" ]; then CTRLTRIGG=false; if [ "$2" == "trigger" ]; then magiskhide_trigger "$ITEM" @@ -2037,21 +2029,28 @@ magiskhide_props_menu() { if [ "$ITEMCOUNT" == 0 ]; then ITEMCOUNT=1 fi - TMPTXT="" - if [ "$2" == "late" ]; then - TMPTXT=" ${C}(Late prop)${N}" - elif [ "$2" == "trigger" ]; then - TMPTXT=" ${C}(Trigger prop)${N}" - fi - if [ "$(eval "echo \$$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')")" == "true" ]; then - if [ "$TMPTXT" ]; then - TMPTXT=$TMPTXT$ACTIVE - else - TMPTXT=$ACTIVE - fi - fi if [ "$3" != "count" ]; then - echo -e "${G}$ITEMCOUNT${N} - $(get_eq_left "$ITEM")$TMPTXT" + TMPTXT="" + if [ "$2" == "late" ]; then + TMPTXT=" ${C}(Late prop)${N}" + elif [ "$2" == "trigger" ]; then + TMPTXT=" ${C}(Trigger prop)${N}" + fi + if [ "$REVALUE" == 1 ] && [ "$CURRVALUE" != "$ORIGVALUE" ] && [ "$CURRVALUE" == "$MODULEVALUE" ]; then + if [ "$TMPTXT" ]; then + TMPTXT=$TMPTXT$ACTIVETXT + else + TMPTXT=$ACTIVETXT + fi + elif [ "$REVALUE" == 1 ]; then + if [ "$TMPTXT" ]; then + TMPTXT=$TMPTXT$ENABLEDTXT + else + TMPTXT=$ENABLEDTXT + fi + ENABLEDCOUNT=$(($ENABLEDCOUNT+1)) + fi + echo -e "${G}$ITEMCOUNT${N} - ${ITEM}${TMPTXT}" fi ITEMCOUNT=$(($ITEMCOUNT+1)) fi @@ -2060,46 +2059,39 @@ magiskhide_props_menu() { fi } -# Set sensitive props, $1=List to get props from, $2=List of safe values, $3=Set to "late" if set in late stage, or file name if saving values to a prop file +# Set sensitive props, $1=List to get props from, $2=Set to "late" if set in late stage, or file name if saving values to a prop file sensitive_props() { - if [ "$3" == "late" ]; then + if [ "$2" == "late" ]; then log_handler "Changing sensitive props, late" else log_handler "Changing sensitive props" fi for ITEM in $1; do PROP=$(get_prop_type $ITEM) - REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') - ORIGPROP=$(echo "ORIG${PROP}" | tr '[:lower:]' '[:upper:]') - MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') - REVALUE=$(eval "echo \$$REPROP") - ORIGVALUE=$(eval "echo \$$ORIGPROP") - MODULEVALUE=$(eval "echo \$$MODULEPROP") - if [ "$REVALUE" == "true" ] && [ "$ORIGVALUE" ]; then + REVALUE=$(eval "echo \$$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')") + ORIGVALUE=$(eval "echo \$$(echo "ORIG${PROP}" | tr '[:lower:]' '[:upper:]')") + MODULEVALUE=$(eval "echo \$$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]')") + if [ "$REVALUE" == 1 ] && [ "$ORIGVALUE" ]; then CTRLTRIGG=false; magiskhide_trigger "$ITEM" - if [ "$CTRLTRIGG" == "true" ]; then - for CTRL in $2; do - if [ "$(get_eq_left "$CTRL")" == "$ITEM" ]; then - if [ "$(get_eq_right "$CTRL")" == "$ORIGVALUE" ]; then - log_handler "Skipping $ITEM, already set to the safe value." - else - log_handler "Changing/writing $ITEM." - if [ "$3" ] && [ "$3" != "late" ]; then - echo "${ITEM}=$MODULEVALUE" >> $3 - else - resetprop -nv $ITEM "$MODULEVALUE" >> $LOGFILE 2>&1 - if [ "$BOOTSTAGE" == "late" ] && [ "$PROPSOFTBOOT" = 1 ]; then - PROPLATE=true - fi - fi + if [ "$CTRLTRIGG" == "false" ]; then + if [ "$MODULEVALUE" == "$ORIGVALUE" ]; then + log_handler "Skipping $ITEM, already set to the safe value ($MODULEVALUE)." + else + log_handler "Changing/writing $ITEM." + if [ "$2" ] && [ "$2" != "late" ]; then + echo "${ITEM}=$MODULEVALUE" >> $2 + else + resetprop -nv $ITEM "$MODULEVALUE" >> $LOGFILE 2>&1 + if [ "$BOOTSTAGE" == "late" ] && [ "$PROPSOFTBOOT" = 1 ]; then + PROPLATE=true fi fi - done + fi else - log_handler "Skipping $ITEM, it is not set to a triggering value." + log_handler "Skipping $ITEM, it is not set to a triggering value (set to $ORIGVALUE)." fi - elif [ "$REVALUE" == "true" ] && [ -z "$ORIGVALUE" ]; then + elif [ "$REVALUE" == 1 ] && [ -z "$ORIGVALUE" ]; then log_handler "Skipping $ITEM, does not exist on device." else log_handler "Skipping $ITEM, not set to change." @@ -2110,8 +2102,9 @@ sensitive_props() { # Check if trigger prop, $1=prop to check magiskhide_trigger() { for TRIGG in $TRIGGERLIST; do - if [ "$(get_eq_left "$TRIGG")" == "$(get_eq_left "$1")" ]; then - if [ "$(get_eq_right "$TRIGG")" != "$ORIGVALUE" ]; then + if [ "$(get_eq_left "$TRIGG")" == "$1" ]; then + TRIGGVALUE=$(get_eq_right "$TRIGG") + if [ "$TRIGGVALUE" != "$ORIGVALUE" ]; then CTRLTRIGG=true; fi break @@ -2123,9 +2116,10 @@ magiskhide_trigger() { safe_props() { SAFE="" if [ "$2" ]; then - for P in $SAFELIST$TRIGGERSAFELIST$LATESAFELIST; do - if [ "$(get_eq_left "$P")" == "$1" ]; then - if [ "$2" == "$(get_eq_right "$P")" ]; then + for P in $PROPSLIST$TRIGGERPROPS$LATEPROPS; do + MODULEVALUE=$(eval "echo \$$(echo "MODULE$(get_prop_type $ITEM)" | tr '[:lower:]' '[:upper:]')") + if [ "$P" == "$1" ]; then + if [ "$2" == "$MODULEVALUE" ]; then SAFE=1 else SAFE=0 @@ -2138,12 +2132,13 @@ safe_props() { # Find what prop value to change to, $1=header, $2=Currently set prop value change_to() { - for CHPROP in $SAFELIST$TRIGGERSAFELIST$LATESAFELIST; do - if [ "$(get_eq_left "$CHPROP")" == "$1" ]; then - if [ "$2" != "$(get_eq_right "$CHPROP")" ]; then - CHANGE=$(get_eq_right "$CHPROP") + for CHPROP in $PROPSLIST$TRIGGERPROPS$LATEPROPS; do + MODULEVALUE=$(eval "echo \$$(echo "MODULE$(get_prop_type $CHPROP)" | tr '[:lower:]' '[:upper:]')") + if [ "$CHPROP" == "$1" ]; then + if [ "$2" != "$MODULEVALUE" ]; then + CHANGE=$MODULEVALUE else - CHANGE=$(eval "echo \$$(echo "ORIG$(get_prop_type $(get_eq_left "$CHPROP"))" | tr '[:lower:]' '[:upper:]')") + CHANGE=$(eval "echo \$$(echo "ORIG$(get_prop_type $CHPROP)" | tr '[:lower:]' '[:upper:]')") fi break fi @@ -2155,24 +2150,17 @@ reset_prop() { before_change # Sets variables - PROP=$(get_prop_type $1) - MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') - REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') - SUBA=$(get_file_value $LATEFILE "${MODULEPROP}=") + REPROP=$(echo "RE$(get_prop_type $1)" | tr '[:lower:]' '[:upper:]') log_handler "Resetting $1 to default system value." - # Saves new module value - replace_fn $MODULEPROP "\"$SUBA\"" "\"\"" $LATEFILE # Changes prop - replace_fn $REPROP "true" "false" $LATEFILE + replace_fn $REPROP 1 0 $LATEFILE - # Updates prop change variable in propsconf_late - if [ "$SUBA" ]; then - if [ "$PROPCOUNT" -gt 0 ]; then - PROPCOUNTP=$(($PROPCOUNT-1)) - replace_fn PROPCOUNT $PROPCOUNT $PROPCOUNTP $LATEFILE - fi + # Updates prop change variables in propsconf_late + if [ "$PROPCOUNT" -gt 0 ]; then + PROPCOUNTP=$(($PROPCOUNT-1)) + replace_fn PROPCOUNT $PROPCOUNT $PROPCOUNTP $LATEFILE fi if [ "$PROPCOUNTP" == 0 ]; then replace_fn PROPEDIT 1 0 $LATEFILE @@ -2183,32 +2171,25 @@ reset_prop() { fi } -# Use prop value, $1=prop name, $2=new prop value, $3=run option +# Use prop value, $1=prop name, $3=run option change_prop() { before_change # Sets variables - PROP=$(get_prop_type $1) - MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') - REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') - SUBA=$(get_file_value $LATEFILE "${MODULEPROP}=") + REPROP=$(echo "RE$(get_prop_type $1)" | tr '[:lower:]' '[:upper:]') - log_handler "Changing $1 to $2." + log_handler "Changing $1 to safe value." - # Saves new module value - replace_fn $MODULEPROP "\"$SUBA\"" "\"$2\"" $LATEFILE # Changes prop - replace_fn $REPROP "false" "true" $LATEFILE + replace_fn $REPROP 0 1 $LATEFILE # Updates prop change variables in propsconf_late - if [ -z "$SUBA" ]; then - PROPCOUNTP=$(($PROPCOUNT+1)) - replace_fn PROPCOUNT $PROPCOUNT $PROPCOUNTP $LATEFILE - fi + PROPCOUNTP=$(($PROPCOUNT+1)) + replace_fn PROPCOUNT $PROPCOUNT $PROPCOUNTP $LATEFILE replace_fn PROPEDIT 0 1 $LATEFILE - if [ "$3" != "none" ]; then - after_change "$1" "$3" + if [ "$2" != "none" ]; then + after_change "$1" "$2" fi } @@ -2219,15 +2200,10 @@ reset_prop_all() { log_handler "Resetting all props to default values." for PROPTYPE in $PROPSLIST$TRIGGERPROPS$LATEPROPS; do - PROP=$(get_prop_type $PROPTYPE) - MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') - REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') - SUBA=$(get_file_value $LATEFILE "${MODULEPROP}=") + REPROP=$(echo "RE$(get_prop_type $PROPTYPE)" | tr '[:lower:]' '[:upper:]') - # Saves new module value - replace_fn $MODULEPROP "\"$SUBA\"" "\"\"" $LATEFILE # Changes prop - replace_fn $REPROP "true" "false" $LATEFILE + replace_fn $REPROP 1 0 $LATEFILE done # Updates prop change variables in propsconf_late @@ -2513,25 +2489,25 @@ export_settings() { replace_fn CONFPARTPROPS true $([ $PARTPROPSSET == 0 ] && echo "false" || echo "true") $EXPORTFILE replace_fn CONFSIMBOOT default $([ $SIMSTAGE == 0 ] && echo "default" || $([ $PRINTSTAGE == 1 ] && echo "post" || echo "late")) $EXPORTFILE # MagiskHide sensitive props - replace_fn CONFDEBUGGABLE "\"\"" "\"$MODULEDEBUGGABLE\"" $EXPORTFILE - replace_fn CONFSECURE "\"\"" "\"$MODULESECURE\"" $EXPORTFILE - replace_fn CONFTYPE "\"\"" "\"$MODULETYPE\"" $EXPORTFILE - replace_fn CONFTAGS "\"\"" "\"$MODULETAGS\"" $EXPORTFILE - replace_fn CONFBOOTMODE "\"\"" "\"$MODULEBOOTMODE\"" $EXPORTFILE - replace_fn CONFMODE "\"\"" "\"$MODULEMODE\"" $EXPORTFILE - replace_fn CONFVENDORMODE "\"\"" "\"$MODULEVENDORMODE\"" $EXPORTFILE - replace_fn CONFHWC "\"\"" "\"$MODULEHWC\"" $EXPORTFILE - replace_fn CONFHWCOUNTRY "\"\"" "\"$MODULEHWCOUNTRY\"" $EXPORTFILE - replace_fn CONFDEVICE_STATE "\"\"" "\"$MODULEDEVICE_STATE\"" $EXPORTFILE - replace_fn CONFVERIFIEDBOOTSTATE "\"\"" "\"$MODULEVERIFIEDBOOTSTATE\"" $EXPORTFILE - replace_fn CONFVENDORVERIFIEDBOOTSTATE "\"\"" "\"$MODULEVENDORVERIFIEDBOOTSTATE\"" $EXPORTFILE - replace_fn CONFLOCKED "\"\"" "\"$MODULELOCKED\"" $EXPORTFILE - replace_fn CONFVERITYMODE "\"\"" "\"$MODULEVERITYMODE\"" $EXPORTFILE - replace_fn CONFBOOTWARRANTY_BIT "\"\"" "\"$MODULEBOOTWARRANTY_BIT\"" $EXPORTFILE - replace_fn CONFWARRANTY_BIT "\"\"" "\"$MODULEWARRANTY_BIT\"" $EXPORTFILE - replace_fn CONFVENDORBOOTWARRANTY_BIT "\"\"" "\"$MODULEVENDORBOOTWARRANTY_BIT\"" $EXPORTFILE - replace_fn CONFVENDORWARRANTY_BIT "\"\"" "\"$MODULEVENDORWARRANTY_BIT\"" $EXPORTFILE - replace_fn CONFVENDORDEVICE_STATE "\"\"" "\"$MODULEVENDORDEVICE_STATE\"" $EXPORTFILE + replace_fn CONFDEBUGGABLE true $([ $REDEBUGGABLE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFSECURE true $([ $RESECURE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFTYPE true $([ $RETYPE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFTAGS true $([ $RETAGS == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFBOOTMODE true $([ $REBOOTMODE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFMODE true $([ $REMODE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVENDORMODE true $([ $REVENDORMODE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFHWC true $([ $REHWC == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFHWCOUNTRY true $([ $REHWCOUNTRY == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFSTATE true $([ $RESTATE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVERIFIEDBOOTSTATE true $([ $REVERIFIEDBOOTSTATE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVENDORVERIFIEDBOOTSTATE true $([ $REVENDORVERIFIEDBOOTSTATE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFLOCKED true $([ $RELOCKED == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVERITYMODE true $([ $REVERITYMODE == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFBOOTWARRANTY_BIT true $([ $REBOOTWARRANTY_BIT == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFBIT true $([ $REBIT == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVENDORBOOTWARRANTY_BIT true $([ $REVENDORBOOTWARRANTY_BIT == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVENDORWARRANTY_BIT true $([ $REVENDORWARRANTY_BIT == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFVENDORDEVICE_STATE true $([ $REVENDORDEVICE_STATE == 0 ] && echo "false" || echo "true") $EXPORTFILE # Custom props replace_fn CONFPROPS "\"\"" "\"$CUSTOMPROPS\"" $EXPORTFILE replace_fn CONFPROPSPOST "\"\"" "\"$CUSTOMPROPSPOST\"" $EXPORTFILE diff --git a/customize.sh b/customize.sh index d5af558..ea159d2 100644 --- a/customize.sh +++ b/customize.sh @@ -15,6 +15,11 @@ ui_print " Installing $MODVERSION " ui_print "************************" ui_print "" +# Remove module directory if it exists on a fresh install +if [ ! -d "$MODULESPATH/MagiskHidePropsConf"] && [ -d "$MHPCPATH" ]; then + rm -rf $MHPCPATH +fi + # Create module directory mkdir -pv $MHPCPATH diff --git a/module.prop b/module.prop index 42eb011..88ab0d1 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=MagiskHidePropsConf name=MagiskHide Props Config -version=v6.0.1-v132 -versionCode=71 +version=v6.0.2-v132 +versionCode=72 author=Didgeridoohan description=Change your device's fingerprint, to pass SafetyNet's CTS Profile check. Set/reset MagiskHide sensitive prop values. Change any prop values easily, and set your own custom props. diff --git a/post-fs-data.sh b/post-fs-data.sh index 9420b08..01cce72 100644 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -23,15 +23,6 @@ LATEFILEPH=LATE_PLACEHOLDER # Sensitive props - # Safe values - TRIGGERSAFELIST=" - ro.bootmode=unknown - ro.boot.mode=unknown - vendor.boot.mode=unknown - ro.boot.hwc=GLOBAL - ro.boot.hwcountry=GLOBAL - " - # Triggering values TRIGGERLIST=" ro.bootmode=recovery ro.boot.mode=recovery @@ -165,24 +156,20 @@ resetprop -v --delete ro.build.selinux >> $LOGFILE 2>&1 fi - if [ "$PROPEDIT" == 1 ] && [ "$PROPBOOT" == 0 ]; then + if [ "$PROPEDIT" == 1 ]; then # Set trigger props for ITEM in $TRIGGERLIST; do TMPPROP=$(get_eq_left "$ITEM") TMPVAL=$(echo $(grep "\[${TMPPROP}\]" "$MHPCPATH/defaultprops") | sed -e "s|.*\]\:\ \[||g;s|\]$||g") - REPROP=$(echo "RE$(get_prop_type "$TMPPROP")" | tr '[:lower:]' '[:upper:]') - REVAL=$(get_file_value $LATEFILE "${REPROP}=") - if [ "$REVAL" == "true" ]; then + PROP=$(get_prop_type "$TMPPROP") + REVALUE=$(eval "echo \$$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')") + MODULEVALUE=$(eval "echo \$$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]')") + if [ "$REVALUE" == 1 ]; then if [ "$TMPVAL" == "$(get_eq_right "$ITEM")" ]; then log_handler "Changing/writing $TMPPROP." - for SAFEVAL in $TRIGGERSAFELIST; do - if [ "$TMPPROP" == "$(get_eq_left "$SAFEVAL")" ]; then - resetprop -nv $(get_eq_left $SAFEVAL) $(get_eq_right $SAFEVAL) >> $LOGFILE 2>&1 - break - fi - done + resetprop -nv $TMPPROP $MODULEVALUE >> $LOGFILE 2>&1 elif [ "$TMPVAL" ]; then - log_handler "Skipping $TMPPROP, not set to triggering value." + log_handler "Skipping $TMPPROP, not set to triggering value (set to $TMPVAL)." else log_handler "Skipping $TMPPROP, does not exist on device." fi @@ -231,7 +218,7 @@ fi # Edit MagiskHide sensitive props if set for post-fs-data if [ "$PROPEDIT" == 1 ] && [ "$PROPBOOT" == 1]; then - sensitive_props "$PROPSLIST" "$SAFELIST" + sensitive_props "$PROPSLIST" fi # Edit custom props set for post-fs-data custom_edit "CUSTOMPROPSPOST" diff --git a/service.sh b/service.sh index 0c89666..b252842 100644 --- a/service.sh +++ b/service.sh @@ -109,11 +109,11 @@ fi if [ "$PROPEDIT" == 1 ]; then # Edit all sensitive props, if set for late_start service if [ "$PROPBOOT" == 2]; then - sensitive_props "$PROPSLIST" "$SAFELIST" + sensitive_props "$PROPSLIST" fi # Edit late senstive props - sensitive_props "$LATEPROPS" "$LATESAFELIST" "late" + sensitive_props "$LATEPROPS" "late" fi # Edit custom props set for late_start service @@ -127,7 +127,7 @@ if [ "$(getenforce)" == "Permissive" ] || [ "$(getenforce)" == "0" ]; then chmod 440 /sys/fs/selinux/policy >> $LOGFILE 2>&1 fi -# Do a soft restart if a prop has been set in service.sh +# Do a soft restart if the option is active and a prop has been set in service.sh if [ "$PROPLATE" == "true" ]; then log_handler "Soft rebooting." stop diff --git a/system/binpath/props b/system/binpath/props index 510031b..d900d8b 100644 Binary files a/system/binpath/props and b/system/binpath/props differ