From 6ae8d3d0e1df28b701ae5129843310ec47191c10 Mon Sep 17 00:00:00 2001 From: Didgeridoohan Date: Mon, 20 Sep 2021 19:38:22 +0200 Subject: [PATCH] v6.1.0-v133 --- README.md | 35 ++++- common/prints.sh | 10 +- common/propsconf_late | 2 +- common/util_functions.sh | 267 ++++++++++++++++++++++----------------- module.prop | 5 +- post-fs-data.sh | 29 +---- service.sh | 16 ++- system/binpath/props | Bin 115497 -> 116364 bytes 8 files changed, 207 insertions(+), 157 deletions(-) diff --git a/README.md b/README.md index 824f498..a48411a 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ Keep in mind that this module cannot help you pass CTS if your device uses hardw - [Device simulation](https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf/blob/master/README.md#device-simulation) ##### MagiskHide props - [Set/reset MagiskHide Sensitive props](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md#setreset-magiskhide-sensitive-props) +##### SELinux +- [SELinux Permissive](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md#selinux-permissive) ##### Custom props - [Change/set custom prop values](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md#changeset-custom-prop-values) - [Removing prop values](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md#removing-prop-values) @@ -272,7 +274,7 @@ Just run the `props` command and the list will be updated automatically. Use the If you already have a device fingerprint set by the module, and it has been updated in the current fingerprints list, it will be automatically updated when the prints list gets an update. Just reboot to apply. This function can be turned of in the script settings (see ["Prop script settings"](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config#prop-script-settings) below) -**_Current fingerprints list version - v132_** +**_Current fingerprints list version - v133_** ## Please add support for device X @@ -341,28 +343,39 @@ Up to and including Magisk v23 MagiskHide changes some sensitive props to "safe" This feature is enabled by default and will automatically change any triggering values it finds to "safe" values. The props in question are: +__General__ - ro.debuggable - ro.secure - ro.build.type + +__Rootbeer, Microsoft, etc__ - ro.build.tags + +__SafetyNet, unlocked bootloader, etc__ - ro.boot.vbmeta.device_state - ro.boot.verifiedbootstate - ro.boot.flash.locked - ro.boot.veritymode +- vendor.boot.vbmeta.device_state + +__Samsung__ - ro.boot.warranty_bit - ro.warranty_bit - ro.vendor.boot.warranty_bit - 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 (these will always be set in the post-fs-data boot stage): +There are a few props that will only change if a triggering value is detected, and these are (by default these will be set in the late_start service boot stage but can be set during post-fs-data if this is changed in the settings): +__Recovery mode__ - ro.bootmode - ro.boot.mode - vendor.boot.mode + +__MIUI cross-region flash__ - ro.boot.hwc - ro.boot.hwcountry -And lastly there are props that will only change in the late_start service boot stage. These are: +And lastly there are props that will only change after boot is completed. These are: +__SafetyNet, unlocked bootloader, etc__ - vendor.boot.verifiedbootstate ro.build.selinux used to be changed by MagiskHide, but since some root detectors has a broken implementation of detecting this prop it is simply removed instead of changed (MagiskHide did this since Magisk build 20412). @@ -372,6 +385,8 @@ If, for some reason, you need one or more of these to be kept as their original It is possible to change or reset each prop individually or all of them at once. It is also possible to change several props simultaneously by choosing the corresponding numbers in the menu list and entering them separated by a comma. This will change any props set to a sensitive value to a safe value and vice versa. Example: If I would like to change ro.debuggable, ro.secure and ro.build.tags I would enter __"1,2,4"__. +## SELinux Permissive +If MagiskHide detected that SELinux was in a permissive state it would change permissions for a couple of SELinux related files on the device, to prevent detection of this state. This has been implemented in the late_start service script. ## Change/set custom prop values It's quite easy to change prop values with Magisk. With this module it's even easier. Just enter the prop you want to change and the new value and the module does the rest, nice and systemless. Any changes that you've previously done directly to build.prop, default.prop, etc, you can now do with this module instead. If you have a lot of props that you want to change it'll be a lot easier to use the [configuration file](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md#configuration-file) (see below). @@ -614,6 +629,16 @@ Releases from v5.4.0 will only install on Magisk v20.4+. ## Changelog +### v6.1.0 +- Added settings file version check. +- Added a check for the new Universal SafetyNet Fix and disable sensitive props at install if v2.1.0 or newer is detected. +- Changed default boot stage for SELinux fix and triggering props to late_start service. +- Fixed update check. +- Fixed a few problems with the configuration file import. +- Make sure late props are set after boot completed (might break some features otherwise, forgot about that). +- Minor UI fixes. +- Added fingerprints for Asus Smartphone for Snapdragon Insiders and Xiaomi Mi 11 Lite Indonesia. Updated fingerprint for Xiaomi Mi 10 Lite 5G Global. List updated to v133. + ### 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). @@ -1031,7 +1056,7 @@ Releases from v5.4.0 will only install on Magisk v20.4+. ## Current fingerprints list -### List v132 +### List v133 - Asus ROG Phone 3 ZS661KS (10) - Asus ROG Phone 5 ZS673KS (10) - Asus ZenFone 2 Laser ASUS_Z00LD (6.0.1) diff --git a/common/prints.sh b/common/prints.sh index 86665ce..6b31a20 100644 --- a/common/prints.sh +++ b/common/prints.sh @@ -4,15 +4,16 @@ # Copyright (c) 2018-2021 Didgeridoohan @ XDA Developers # Licence: MIT -PRINTSV=132 +PRINTSV=133 PRINTSTRANSF=520 # Certified fingerprints -# Current fingerprints count=695 -# Unique devices=484 +# Current fingerprints count=698 +# Unique devices=486 PRINTSLIST=" Asus ROG Phone 3 ZS661KS (10):Asus:ZS661KS=asus/WW_I003D/ASUS_I003_1:10/QKQ1.200419.002/17.0823.2012.122-0:user/release-keys__2020-12-01 Asus ROG Phone 5 ZS673KS (10):Asus:ZS673KS=asus/WW_I005D/ASUS_I005_1:11/RKQ1.201022.002/18.0840.2103.26-0:user/release-keys__2021-03-05 +Asus Smartphone for Snapdragon Insiders ASUS_I007D (11):asus:ASUS_I007D=asus/WW_I007D/ASUS_I007_1:11/RKQ1.201112.002/18.1030.2107.138-0:user/release-keys__2021-07-01 Asus ZenFone 2 Laser ASUS_Z00LD (6.0.1):Asus:ASUS_Z00LD=asus/WW_Z00L/ASUS_Z00L_63:6.0.1/MMB29P/WW_user_21.40.1220.2196_20180308:user/release-keys Asus ZenFone 3 Max ASUS_X00DD (7.1.1 & 8.1.0):Asus:ASUS_X00DD=asus/WW_Phone/ASUS_X00DD:7.1.1/NMF26F/14.0200.1712.347-20171214:user/release-keys;asus/WW_Phone/ASUS_X00DD:8.1.0/OPM1.171019.011/15.0200.1812.503-0:user/release-keys__2018-12-05 Asus ZenFone 3 Ultra ASUS_A001 (7.0):Asus:ASUS_A001=asus/WW_Phone/ASUS_A001:7.0/NRD90M/14.1010.1804.75-20180612:user/release-keys__2018-04-01 @@ -426,7 +427,7 @@ Xiaomi Mi 9T Pro Global (10):Xiaomi:Mi 9T Pro=Xiaomi/raphael/raphael:10/QKQ1.190 Xiaomi Mi 10 China (10 & 11):Xiaomi:Mi 10=Xiaomi/umi/umi:10/QKQ1.191117.002/V12.0.8.0.QJBCNXM:user/release-keys__2020-07-01;Xiaomi/umi/umi:11/RKQ1.200710.002/V12.1.3.0.RJBCNXM:user/release-keys__2020-09-01 Xiaomi Mi 10 Europe (10):Xiaomi:Mi 10=Xiaomi/umi_eea/umi:10/QKQ1.191117.002/V11.0.10.0.QJBEUVF:user/release-keys__2020-07-01 Xiaomi Mi 10 Lite 5G Europe (10):Xiaomi:M2002J9G=Xiaomi/monet_eea/monet:10/QKQ1.191222.002/V12.0.1.0.QJIEUXM:user/release-keys__2020-06-01 -Xiaomi Mi 10 Lite 5G Global (10):Xiaomi:M2002J9G=Xiaomi/monet_global/monet:10/QKQ1.191222.002/V12.0.1.0.QJIMIXM:user/release-keys__2020-08-01 +Xiaomi Mi 10 Lite 5G Global (10 & 11):Xiaomi:M2002J9G=Xiaomi/monet_global/monet:10/QKQ1.191222.002/V12.0.1.0.QJIMIXM:user/release-keys__2020-08-01;Xiaomi/monet_global/monet:11/RKQ1.200826.002/V12.5.3.0.RJITWXM:user/release-keys__2021-07-01 Xiaomi Mi 10 Pro China (10 & 11):Xiaomi:Mi 10 Pro=Xiaomi/cmi/cmi:10/QKQ1.191117.002/V12.0.4.0.QJACNXM:user/release-keys__2020-07-01;Xiaomi/cmi/cmi:11/RKQ1.200710.002/V12.1.2.0.RJACNXM:user/release-keys__2020-09-01 Xiaomi Mi 10 Ultra China (10 & 11):Xiaomi:Mi 10 Ultra=Xiaomi/cas/cas:10/QKQ1.200419.002/V12.0.10.0.QJJCNXM:user/release-keys__2020-08-01;Xiaomi/cas/cas:11/RKQ1.200826.002/V12.5.1.0.RJJCNXM:user/release-keys__2021-03-01 Xiaomi Mi 10S China (11):Xiaomi:M2102J2SC=Xiaomi/thyme/thyme:11/RKQ1.200826.002/V12.0.10.0.RGACNXM:user/release-keys__2021-03-01 @@ -434,6 +435,7 @@ Xiaomi Mi 10T Europe (10):Xiaomi:M2007J3SY=Xiaomi/apollo_eea/apollo:10/QKQ1.2004 Xiaomi Mi 10T Lite Europe (10):Xiaomi:M2007J17G=Xiaomi/gauguin_eea/gauguin:10/QKQ1.200628.002/V12.0.8.0.QJSEUXM:user/release-keys__2020-12-01 Xiaomi Mi 10T Pro Europe (10):Xiaomi:M2007J3SG=Xiaomi/apollopro_eea/apollo:10/QKQ1.200419.002/V12.0.13.0.QJDEUXM:user/release-keys__2020-11-01 Xiaomi Mi 11 China (11):Xiaomi:M2011K2C=Xiaomi/venus/venus:11/RKQ1.200928.002/V12.0.22.0.RKBCNXM:user/release-keys__2021-01-01 +Xiaomi Mi 11 Lite Indonesia (11):Xiaomi:M2101K9AG=Xiaomi/courbet_id/courbet:11/RKQ1.200826.002/V12.5.1.0.RKQIDXM:user/release-keys__2021-06-01 Xiaomi Mi A1 Global (7.1.2 & 8.0.0 & 8.1.0 & 9):Xiaomi:Mi A1=xiaomi/tissot/tissot_sprout:7.1.2/N2G47H/7.12.19:user/release-keys;xiaomi/tissot/tissot_sprout:8.0.0/OPR1.170623.026/V.9.5.10.0.ODHMIFA:user/release-keys__2018-04-01;xiaomi/tissot/tissot_sprout:8.1.0/OPM1.171019.026/V9.6.8.0.ODHMIFE:user/release-keys__2018-11-01;xiaomi/tissot/tissot_sprout:9/PKQ1.180917.001/V10.0.24.0.PDHMIXM:user/release-keys__2020-08-01 Xiaomi Mi A2 Global (8.1.0 & 9 & 10):Xiaomi:Mi A2=xiaomi/jasmine/jasmine_sprout:8.1.0/OPM1.171019.011/V9.6.17.0.ODIMIFE:user/release-keys__2018-11-05;xiaomi/jasmine/jasmine_sprout:9/PKQ1.180904.001/V10.0.18.0.PDIMIXM:user/release-keys__2019-12-05;xiaomi/jasmine/jasmine_sprout:10/QKQ1.190910.002/V11.0.28.0.QDIMIXM:user/release-keys__2021-07-01 Xiaomi Mi A2 Lite Global (8.1.0 & 9 & 10):Xiaomi:Mi A2 Lite=xiaomi/daisy/daisy_sprout:8.1.0/OPM1.171019.019/V9.6.11.0.ODLMIFF:user/release-keys__2018-11-01;xiaomi/daisy/daisy_sprout:9/PKQ1.180917.001/V10.0.20.0.PDLMIXM:user/release-keys__2020-03-01;xiaomi/daisy/daisy_sprout:10/QKQ1.191002.002/V11.0.21.0.QDLMIXM:user/release-keys__2021-07-01 diff --git a/common/propsconf_late b/common/propsconf_late index f34ac23..51d53ab 100644 --- a/common/propsconf_late +++ b/common/propsconf_late @@ -7,7 +7,7 @@ # Unless: If you don't have the module installed something has gone horribly wrong and this file is an orphan. # In that case, feel free to delete it. -# Script version +# Script version, do not edit these values! 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" diff --git a/common/util_functions.sh b/common/util_functions.sh index b3d961a..8b4a257 100644 --- a/common/util_functions.sh +++ b/common/util_functions.sh @@ -124,25 +124,6 @@ if [ "$INSTFN" ]; then REBOOTCHK " PROPSETTINGSLIST=" - MODULEDEBUGGABLE - MODULESECURE - MODULETYPE - MODULETAGS - MODULEBOOTMODE - MODULEMODE - MODULEVENDORMODE - MODULEHWC - MODULEHWCOUNTRY - MODULESTATE - MODULEVERIFIEDBOOTSTATE - MODULEVENDORVERIFIEDBOOTSTATE - MODULELOCKED - MODULEVERITYMODE - MODULEBOOTWARRANTY_BIT - MODULEBIT - MODULEVENDORBOOTWARRANTY_BIT - MODULEVENDORWARRANTY_BIT - MODULEVENDORDEVICE_STATE MODULEFINGERPRINT SIMBRAND SIMNAME @@ -584,6 +565,7 @@ orig_check() { ORIGVALUE="$(echo ${ORIGPROP})" if [ "$ORIGVALUE" ]; then ORIGLOAD=1 + break fi done } @@ -701,7 +683,7 @@ reboot_fn() { done } -# Reset module, $1=header, $2=Run options +# Reset module, $1=header, $2=Run options, $3=Reboot or not reset_fn() { before_change @@ -710,7 +692,15 @@ reset_fn() { replace_fn FINGERPRINTENB 1 $FINGERPRINTENB $LATEFILE fi - after_change "$1" "$2" + if [ "$2" == "mismatch" ]; then + log_handler "Saving device default values." + default_save + log_handler "Default values saved to $LATEFILE." + fi + + log_handler "Settings cleared." + + after_change "$1" "$2" "$3" } # Checks for configuration file @@ -727,7 +717,7 @@ config_file() { sleep 1 touch $ITEM/testfbe done - rm -f $ITEM/testfbe + rm -f $ITEM/testfbe >> $LOGFILE 2>&1 if [ -s "$ITEM/propsconf_conf" ]; then CONFFILE="$ITEM/propsconf_conf" break @@ -749,30 +739,24 @@ config_file() { CONFFINGERPRINT=$(getprop ro.vendor.build.fingerprint) echo "ro.vendor.build.fingerprint: ${CONFFINGERPRINT}" >> $LOGFILE 2>&1 fi - # Updates prop values (including fingerprint) - PROPSTMPLIST=$PROPSLIST$TRIGGERPROPS$LATEPROPS" - ro.build.fingerprint - " + # Device fingerprint + if [ "$CONFFINGERPRINT" ]; then + if "$CONFFINGERPRINT" != "preserve" ] && [ "$FINGERPRINTENB" == 1 ]; then + change_print "$PROPTYPE" "$TMPPROP" "file" + fi + else + reset_print "$PROPTYPE" "file" + fi + + # Updates sensitive props + PROPSTMPLIST="$PROPSLIST$TRIGGERPROPS$LATEPROPS" for PROPTYPE in $PROPSTMPLIST; do CONFPROP=$(echo "CONF$(get_prop_type $PROPTYPE)" | tr '[:lower:]' '[:upper:]') TMPPROP=$(eval "echo \$$CONFPROP") - if [ "$TMPPROP" ]; then - log_handler "Checking $PROPTYPE settings." - if [ "$TMPPROP" != "preserve" ]; then - if [ "$PROPTYPE" == "ro.build.fingerprint" ]; then - if [ "$FINGERPRINTENB" == 1 ]; then - change_print "$PROPTYPE" "$TMPPROP" "file" - fi - else - change_prop "$PROPTYPE" "file" - fi - fi + if [ "$TMPPROP" == "true" ]; then + change_prop "$PROPTYPE" "file" else - if [ "$PROPTYPE" == "ro.build.fingerprint" ]; then - reset_print "$PROPTYPE" "file" - else - reset_prop "$PROPTYPE" "file" - fi + reset_prop "$PROPTYPE" "file" fi done @@ -1004,7 +988,7 @@ config_file() { # Deletes the configuration file log_handler "Deleting configuration file." for ITEM in $CONFFILELOC; do - rm -f $ITEM/propsconf_conf + rm -f $ITEM/propsconf_conf >> $LOGFILE 2>&1 done log_handler "Configuration file import complete." if [ "$BOOTSTAGE" == "late" ]; then @@ -1042,9 +1026,9 @@ update_check() { log_print "Checking for module update." MODPROPTMP=$MHPCPATH/module.prop MODPROPWWW="https://raw.githubusercontent.com/Magisk-Modules-Repo/MagiskHidePropsConf/master/module.prop" - MODVERTMP="$(echo $(get_file_value $MODPROPTMP "version=") | sed 's|-.*||' | sed 's|v||' | sed 's|\.||g')" module_v_ctrl wget -T 5 -q -O $MODPROPTMP $MODPROPWWW >> $LOGFILE 2>&1 + MODVERTMP="$(echo $(get_file_value $MODPROPTMP "version=") | sed 's|-.*||' | sed 's|v||' | sed 's|\.||g')" if [ -s "$MODPROPTMP" ]; then if [ "$VERSIONCMP" -lt "$MODVERTMP" ]; then UPDATECHECK="There is a newer version of the module\navailable. Please update." @@ -1058,7 +1042,7 @@ update_check() { log_print "No update available." fi elif [ -f "$MODPROPTMP" ]; then - rm -f $MODPROPTMP + rm -f $MODPROPTMP >> $LOGFILE 2>&1 log_print "! File not downloaded!" log_handler "File is empty." else @@ -1070,6 +1054,7 @@ update_check() { sleep 0.5 ;; esac + rm -f $MODPROPTMP >> $LOGFILE 2>&1 } # system.prop creation @@ -1130,7 +1115,7 @@ settings_placement() { FILETRANSF=$(get_file_value $SERVICEPATH/propsconf_late "SETTRANSF=") LATEFILETMP="$SERVICEPATH/propsconf_late" else - rm -f $LATEFILE + rm -f $LATEFILE >> $LOGFILE 2>&1 FILEV=0 FILETRANSF=$UPDATETRANSF LATEFILETMP="$LATEFILE" @@ -1234,6 +1219,7 @@ settings_placement() { log_handler "Old settings file found in $SERVICEPATH." rm -f $SERVICEPATH/propsconf_late >> $LOGFILE 2>&1 fi + rm -f $UPDATELATEFILE >> $LOGFILE 2>&1 } # Checks for the Universal SafetyNet Fix module and similar modules editing device fingerprint @@ -1248,12 +1234,23 @@ usnf_check() { log_print "! Module - '$NAME'!" log_print "! Fingerprint modification disabled!" ui_print "!" - sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $UPDATELATEFILE + sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $LATEFILE fi fi done } +# Check for the new Universal SafetyNet Fix +SNF_ctrl() { + if [ -d "$MODULESPATH/safetynet-fix" ]; then + TMPVER=$(echo $(get_file_value $MODULESPATH/safetynet-fix/module.prop "version=") | sed 's|v||g' | sed 's|\.||g') + if [ "$TMPVER" -ge "210" ]; then + log_handler "Found incompatible SafetyNet Fix. Disabling MagiskHide props." + reset_prop_all "Disabling MagiskHide props" "install" + fi + fi +} + # Check for bin/xbin bin_check() { $BOOTMODE && BINCHECK=$MIRRORPATH/system/xbin || BINCHECK=/system/xbin @@ -1270,21 +1267,21 @@ bin_check() { files_check() { if [ -f "$POSTLATEFILE" ]; then log_handler "Removing late_start service boot script from post-fs-data.d." - rm -f $POSTLATEFILE + rm -f $POSTLATEFILE >> $LOGFILE 2>&1 fi if [ -f "$POSTFILE" ]; then log_handler "Removing old post-fs-data boot script from post-fs-data.d" - rm -f $POSTFILE + rm -f $POSTFILE >> $LOGFILE 2>&1 fi for ITEM in $CACHERM; do if [ -f "$ITEM" ]; then log_handler "Removing old log files ($ITEM)." - rm -f $ITEM + rm -f $ITEM >> $LOGFILE 2>&1 fi done if [ -f "$PRINTFILES/custom.sh" ]; then log_handler "Removing broken custom.sh file." - rm -f $PRINTFILES/custom.sh + rm -f $PRINTFILES/custom.sh >> $LOGFILE 2>&1 fi } @@ -1300,6 +1297,7 @@ load_settings() { script_install() { load_settings usnf_check + SNF_ctrl bin_check files_check settings_placement @@ -1579,20 +1577,20 @@ download_prints() { log_print "Updated list to v${LISTVERSION}." print_files else - rm -f $PRINTSTMP + rm -f $PRINTSTMP >> $LOGFILE 2>&1 log_print "New fingerprints list requires module update." fi else - rm -f $PRINTSTMP + rm -f $PRINTSTMP >> $LOGFILE 2>&1 log_print "Fingerprints list up-to-date." fi else - rm -f $PRINTSTMP + rm -f $PRINTSTMP >> $LOGFILE 2>&1 log_print "! File not downloaded!" log_handler "Couldn't extract list version." fi elif [ -f "$PRINTSTMP" ]; then - rm -f $PRINTSTMP + rm -f $PRINTSTMP >> $LOGFILE 2>&1 log_print "! File not downloaded!" log_handler "File is empty." else @@ -2021,11 +2019,11 @@ magiskhide_props_menu() { ORIGVALUE=$(eval "echo \$$(echo "ORIG${PROP}" | tr '[:lower:]' '[:upper:]')") MODULEVALUE=$(eval "echo \$$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]')") if [ "$ORIGVALUE" ] && [ "$MODULEVALUE" != "$ORIGVALUE" ]; then - CTRLTRIGG=false; + CTRLTRIGG=true; if [ "$2" == "trigger" ]; then magiskhide_trigger "$ITEM" fi - if [ "$CTRLTRIGG" == "false" ]; then + if [ "$CTRLTRIGG" == "true" ]; then if [ "$ITEMCOUNT" == 0 ]; then ITEMCOUNT=1 fi @@ -2072,9 +2070,9 @@ sensitive_props() { 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; + CTRLTRIGG=true; magiskhide_trigger "$ITEM" - if [ "$CTRLTRIGG" == "false" ]; then + if [ "$CTRLTRIGG" == "true" ]; then if [ "$MODULEVALUE" == "$ORIGVALUE" ]; then log_handler "Skipping $ITEM, already set to the safe value ($MODULEVALUE)." else @@ -2105,7 +2103,7 @@ magiskhide_trigger() { if [ "$(get_eq_left "$TRIGG")" == "$1" ]; then TRIGGVALUE=$(get_eq_right "$TRIGG") if [ "$TRIGGVALUE" != "$ORIGVALUE" ]; then - CTRLTRIGG=true; + CTRLTRIGG=false; fi break fi @@ -2193,7 +2191,7 @@ change_prop() { fi } -# Reset all module prop changes, $1=header +# Reset all module prop changes, $1=header, $2=Run option reset_prop_all() { before_change @@ -2210,7 +2208,9 @@ reset_prop_all() { replace_fn PROPCOUNT $PROPCOUNT 0 $LATEFILE replace_fn PROPEDIT 1 0 $LATEFILE - after_change "$1" + if [ "$2" != "install" ]; then + after_change "$1" + fi } # ======================== Custom Props functions ======================== @@ -2233,7 +2233,7 @@ custom_edit() { if [ "$(get_prop_delay_exec "$ITEM")" == "boot" ]; then TMPBOOTTXT=" after \"Boot completed\"" until [ $(getprop sys.boot_completed) == 1 ]; do - sleep 0.1 + sleep 1 done fi TMPI=1 @@ -2454,87 +2454,122 @@ reset_delprop() { } # ======================== Options functions ======================== +# Find value for export function, $1=Settings variable, $2=Type +export_value() { + if [ "$2" == "stage" ]; then + if [ "$(eval "echo \$$1")" == 0 ]; then + TMP=default + elif [ "$(eval "echo \$$1")" == 1 ]; then + TMP=post + else + TMP=late + fi + elif [ "$2" == "binary" ]; then + if [ "$(eval "echo \$$1")" == 0 ]; then + TMP=false + else + TMP=true + fi + fi + + echo "$TMP" +} + # Export all settings to a module configuration file, $1=header export_settings() { before_change log_handler "Exporting module settings to $EXPORTFILE." + # Load settings . $LATEFILE + # Create export directory + rm -rf $EXPORTPATH >> $LOGFILE 2>&1 mkdir -pv $EXPORTPATH >> $LOGFILE 2>&1 + # Create file and Delete instructions - head -n 59 $MODPATH/common/propsconf_conf > $EXPORTFILE + head -n 87 $MODPATH/common/propsconf_conf > $EXPORTFILE + # Export settings # Fingerprint replace_fn CONFFINGERPRINT "\"\"" "\"$MODULEFINGERPRINT\"" $EXPORTFILE - replace_fn CONFVENDPRINT false $([ $PRINTVEND == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFPRINTBOOT default $([ $PRINTSTAGE == 0 ] && echo "default" || $([ $PRINTSTAGE == 1 ] && echo "post" || echo "late")) $EXPORTFILE - replace_fn CONFPATCHBOOT late $([ $PATCHSTAGE == 0 ] && echo "default" || $([ $PATCHSTAGE == 1 ] && echo "post" || echo "late")) $EXPORTFILE + replace_fn CONFVENDPRINT false $(export_value PRINTVEND binary) $EXPORTFILE + replace_fn CONFPRINTBOOT default $(export_value PRINTSTAGE stage) $EXPORTFILE + replace_fn CONFPATCHBOOT late $(export_value PATCHSTAGE stage) $EXPORTFILE + # Force BASIC attestation - replace_fn CONFBASICATTEST false $([ $BASICATTEST == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFBASICATTEST false $(export_value BASICATTEST binary) $EXPORTFILE replace_fn CONFBASICATTCUST "\"\"" "\"$BASICATTCUST\"" $EXPORTFILE + # Device Simulation - replace_fn CONFDEVSIM false $([ $DEVSIM == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFBRAND false $([ $BRANDSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFNAME false $([ $NAMESET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFDEVICE false $([ $DEVICESET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFRELEASE false $([ $RELEASESET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFID false $([ $IDSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFINCREMENTAL false $([ $INCREMENTALSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFDISPLAY false $([ $DISPLAYSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFSDK false $([ $SDKSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFMANUFACTURER false $([ $MANUFACTURERSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFMODEL false $([ $MODELSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFDESCRIPTION true $([ $DESCRIPTIONSET == 0 ] && echo "false" || echo "true") $EXPORTFILE - 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 + replace_fn CONFDEVSIM false $(export_value DEVSIM binary) $EXPORTFILE + replace_fn CONFBRAND false $(export_value BRANDSET binary) $EXPORTFILE + replace_fn CONFNAME false $(export_value NAMESET binary) $EXPORTFILE + replace_fn CONFDEVICE false $(export_value DEVICESET binary) $EXPORTFILE + replace_fn CONFRELEASE false $(export_value RELEASESET binary) $EXPORTFILE + replace_fn CONFID false $(export_value IDSET binary) $EXPORTFILE + replace_fn CONFINCREMENTAL false $(export_value INCREMENTALSET binary) $EXPORTFILE + replace_fn CONFDISPLAY false $(export_value DISPLAYSET binary) $EXPORTFILE + replace_fn CONFSDK false $(export_value SDKSET binary) $EXPORTFILE + replace_fn CONFMANUFACTURER false $(export_value MANUFACTURERSET binary) $EXPORTFILE + replace_fn CONFMODEL false $(export_value MODELSET binary) $EXPORTFILE + replace_fn CONFDESCRIPTION true $(export_value DESCRIPTIONSET binary) $EXPORTFILE + replace_fn CONFPARTPROPS true $(export_value PARTPROPSSET binary) $EXPORTFILE + replace_fn CONFSIMBOOT default $(export_value SIMSTAGE stage) $EXPORTFILE + # MagiskHide sensitive props - 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 + replace_fn CONFDEBUGGABLE true $(export_value REDEBUGGABLE binary) $EXPORTFILE + replace_fn CONFSECURE true $(export_value RESECURE binary) $EXPORTFILE + replace_fn CONFTYPE true $(export_value RETYPE binary) $EXPORTFILE + replace_fn CONFTAGS true $(export_value RETAGS binary) $EXPORTFILE + replace_fn CONFBOOTMODE true $(export_value REBOOTMODE binary) $EXPORTFILE + replace_fn CONFMODE true $(export_value REMODE binary) $EXPORTFILE + replace_fn CONFVENDORMODE true $(export_value REVENDORMODE binary) $EXPORTFILE + replace_fn CONFHWC true $(export_value REHWC binary) $EXPORTFILE + replace_fn CONFHWCOUNTRY true $(export_value REHWCOUNTRY binary) $EXPORTFILE + replace_fn CONFSTATE true $(export_value RESTATE binary) $EXPORTFILE + replace_fn CONFVERIFIEDBOOTSTATE true $(export_value REVERIFIEDBOOTSTATE binary) $EXPORTFILE + replace_fn CONFVENDORVERIFIEDBOOTSTATE true $(export_value REVENDORVERIFIEDBOOTSTATE binary) $EXPORTFILE + replace_fn CONFLOCKED true $(export_value RELOCKED binary) $EXPORTFILE + replace_fn CONFVERITYMODE true $(export_value REVERITYMODE binary) $EXPORTFILE + replace_fn CONFBOOTWARRANTY_BIT true $(export_value REBOOTWARRANTY_BIT binary) $EXPORTFILE + replace_fn CONFBIT true $(export_value REBIT binary) $EXPORTFILE + replace_fn CONFVENDORBOOTWARRANTY_BIT true $(export_value REVENDORBOOTWARRANTY_BIT binary) $EXPORTFILE + replace_fn CONFVENDORWARRANTY_BIT true $(export_value REVENDORWARRANTY_BIT binary) $EXPORTFILE + replace_fn CONFVENDORDEVICE_STATE true $(export_value REVENDORDEVICE_STATE binary) $EXPORTFILE + # Custom props replace_fn CONFPROPS "\"\"" "\"$CUSTOMPROPS\"" $EXPORTFILE replace_fn CONFPROPSPOST "\"\"" "\"$CUSTOMPROPSPOST\"" $EXPORTFILE replace_fn CONFPROPSLATE "\"\"" "\"$CUSTOMPROPSLATE\"" $EXPORTFILE replace_fn CONFPROPSDELAY "\"\"" "\"$CUSTOMPROPSDELAY\"" $EXPORTFILE + # Delete props replace_fn CONFDELPROPS "\"\"" "\"$DELETEPROPS\"" $EXPORTFILE + # Soft reboot - replace_fn CONFOPTIONSOFTBOOT false $([ $OPTIONSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFPRINTSOFTBOOT false $([ $PRINTSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFPATCHSOFTBOOT false $([ $PATCHSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFSIMSOFTBOOT false $([ $SIMSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFCUSTOMSOFTBOOT false $([ $CUSTOMSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFPROPSOFTBOOT false $([ $PROPSOFTBOOT == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFOPTIONSOFTBOOT false $(export_value OPTIONSOFTBOOT binary) $EXPORTFILE + replace_fn CONFPRINTSOFTBOOT false $(export_value PRINTSOFTBOOT binary) $EXPORTFILE + replace_fn CONFPATCHSOFTBOOT false $(export_value PATCHSOFTBOOT binary) $EXPORTFILE + replace_fn CONFSIMSOFTBOOT false $(export_value SIMSOFTBOOT binary) $EXPORTFILE + replace_fn CONFCUSTOMSOFTBOOT false $(export_value CUSTOMSOFTBOOT binary) $EXPORTFILE + replace_fn CONFPROPSOFTBOOT false $(export_value PROPSOFTBOOT binary) $EXPORTFILE + # Module settings - replace_fn CONFBOOT default $([ $OPTIONBOOT == 0 ] && echo "default" || $([ $PRINTSTAGE == 1 ] && echo "post" || echo "late")) $EXPORTFILE - replace_fn CONFCOLOUR true $([ $OPTIONCOLOUR == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFWEBP true $([ $OPTIONWEBP == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFWEBU true $([ $OPTIONWEBU == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFUPDATE true $([ $OPTIONUPDATE == 0 ] && echo "false" || echo "true") $EXPORTFILE - replace_fn CONFBACK false $([ $OPTIONBACK == 0 ] && echo "false" || echo "true") $EXPORTFILE + replace_fn CONFBOOT default $(export_value OPTIONBOOT stage) $EXPORTFILE + replace_fn CONFCOLOUR true $(export_value OPTIONCOLOUR binary) $EXPORTFILE + replace_fn CONFWEBP true $(export_value OPTIONWEBP binary) $EXPORTFILE + replace_fn CONFWEBU true $(export_value OPTIONWEBU binary) $EXPORTFILE + replace_fn CONFUPDATE true $(export_value OPTIONUPDATE binary) $EXPORTFILE + replace_fn CONFBACK false $(export_value OPTIONBACK binary) $EXPORTFILE + log_handler "Export done." + # Print info menu_header "${C}$1${N}" echo "" echo "A module configuration file with" - echo "your current settings haS been" + echo "your current settings has been" echo "saved to your internal storage," echo -e "in the ${C}/mhpc${N} directory." echo "" @@ -2573,7 +2608,7 @@ collect_logs() { # Copy package to internal storage cp -f $MHPCPATH/propslogs.tar.gz /storage/emulated/0 >> $LOGFILE 2>&1 - rm -f $MHPCPATH/propslogs.tar.gz + rm -f $MHPCPATH/propslogs.tar.gz >> $LOGFILE 2>&1 # Remove temporary directory rm -rf $TMPLOGLOC >> $LOGFILE 2>&1 @@ -2586,7 +2621,7 @@ collect_logs() { echo "" echo "Logs and information collected." echo "" - echo "The packaged file (${C}propslogs.tar.gz${N})" + echo -e "The packaged file (${C}propslogs.tar.gz${N})" echo "has been saved to the root of your device's" echo "internal storage." echo "If it did not, please see the documentation" diff --git a/module.prop b/module.prop index 88ab0d1..08c3903 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,7 @@ id=MagiskHidePropsConf name=MagiskHide Props Config -version=v6.0.2-v132 -versionCode=72 +version=v6.1.0-v133 +versionCode=73 +settingsVersion=40 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 01cce72..dfeaf06 100644 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -150,33 +150,6 @@ log_handler "Loading module settings" . $LATEFILE - # Remove ro.build.selinux if present - if [ "$(grep "ro.build.selinux" $MHPCPATH/defaultprops)" ]; then - log_handler "Removing ro.build.selinux." - resetprop -v --delete ro.build.selinux >> $LOGFILE 2>&1 - fi - - 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") - 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." - resetprop -nv $TMPPROP $MODULEVALUE >> $LOGFILE 2>&1 - elif [ "$TMPVAL" ]; then - log_handler "Skipping $TMPPROP, not set to triggering value (set to $TMPVAL)." - else - log_handler "Skipping $TMPPROP, does not exist on device." - fi - fi - done - fi - # Edits prop values if set for post-fs-data if [ "$OPTIONBOOT" == 1 ] || [ "$OPTIONBOOT" != 1 -a "$PRINTSTAGE" == 1 ] || [ "$OPTIONBOOT" != 1 -a "$PATCHSTAGE" == 1 ] || [ "$OPTIONBOOT" != 1 -a "$SIMSTAGE" == 1 ] || [ "$CUSTOMPROPSPOST" ] || [ "$DELETEPROPS" ] || [ "$PROPBOOT" == 1 ]; then # Load functions @@ -218,7 +191,7 @@ fi # Edit MagiskHide sensitive props if set for post-fs-data if [ "$PROPEDIT" == 1 ] && [ "$PROPBOOT" == 1]; then - sensitive_props "$PROPSLIST" + sensitive_props "$PROPSLIST$TRIGGERLIST" fi # Edit custom props set for post-fs-data custom_edit "CUSTOMPROPSPOST" diff --git a/service.sh b/service.sh index b252842..d3598b0 100644 --- a/service.sh +++ b/service.sh @@ -108,12 +108,20 @@ fi # Edit MagiskHide sensitive props if [ "$PROPEDIT" == 1 ]; then # Edit all sensitive props, if set for late_start service - if [ "$PROPBOOT" == 2]; then + if [ "$PROPBOOT" == 2 ]; then sensitive_props "$PROPSLIST" fi + if [ "$PROPBOOT" == 0 ] || [ "$PROPBOOT" == 2 ]; then + sensitive_props "$TRIGGERPROPS" + fi # Edit late senstive props + { + until [ $(getprop sys.boot_completed) == 1 ]; do + sleep 1 + done sensitive_props "$LATEPROPS" "late" + }& fi # Edit custom props set for late_start service @@ -121,6 +129,12 @@ custom_edit "CUSTOMPROPSLATE" custom_edit "CUSTOMPROPSDELAY" # SELinux +# Remove ro.build.selinux if present +if [ "$(grep "ro.build.selinux" $MHPCPATH/defaultprops)" ]; then + log_handler "Removing ro.build.selinux." + resetprop -v --delete ro.build.selinux >> $LOGFILE 2>&1 +fi +# Check for permissive SELinux if [ "$(getenforce)" == "Permissive" ] || [ "$(getenforce)" == "0" ]; then log_handler "Dealing with permissive SELinux." chmod 640 /sys/fs/selinux/enforce >> $LOGFILE 2>&1 diff --git a/system/binpath/props b/system/binpath/props index d900d8b6e3357e3cba4ea89e678bde39e9c2be56..b7cfae5066d4f43d693a7db2ed4bb07a82957b8c 100644 GIT binary patch delta 840 zcmZ{i&ubGw6vtVsrn{CT)M!OSUY0C7hUh_9Cc7`mn$1qwo!y#B zi5GLSUdEb>9(wRlQ4!M8zrdq-@D{D$!K-=`JUN>mixfT0+nvw*zVCNtwp)=$8lZ3duQ8Q!Cl!#hdwp z+RkiA6PH(pVt${4n(5XE(<^XpKxXsHIq+Q=Hcq8gP9n#f|LsiOUs_ic8TASUH7xQK zgrTRNb1-f2Tm*xn3pQoY8yoUW@cnEsu$B(@f`Z>slxB84bU|zb>JF{DuxeTs6cKa_ ziGxP^-+nT7W5BZtVX%r$&!6~*zDYgTYV?G{nJyd1T9g=Q2=|O$hZ@$X)0l>$$G}E3 zLY&dSf(Q&=9Y~pouth9UF@%7FMM~M4#6Wu%?>mK8U3sL^YALWlf%KS<9 zJ^vMp^ZCyS-um=iSv5vZqfnf$`F#oR(~0(H!?rdLp}Dsubmj+AUa R*pZ%%$R%^{^sW?({sH#5BkKSF delta 145 zcmV;C0B-+`jR&cQ2e4!bv;7O>3X{4d5wr9bhLy8@tS&H<3Ec~mwcJ#btK15cg>Dv; zE!GK>Gu_RT$DJ0F=H3sJB;Ku)$DJ0F=H921$DI|kq2GTHldn!WlV9-MlexnUlS}b0 zlj6HXmtuYaT9d!W60vuyzux9+C_Iu8OO3YXot0iCyhxB(3gogPNJ