From 74a880a2ee575d30cc682092ce27bddbafb28804 Mon Sep 17 00:00:00 2001 From: Didgeridoohan Date: Thu, 26 Apr 2018 22:40:46 +0200 Subject: [PATCH] v2.1.3 --- README.md | 22 ++++++++++-------- common/post-fs-data.sh | 48 +++++++++++++++++---------------------- common/propsconf_late | 42 +++++++++++++++------------------- common/util_functions.sh | 45 ++++++++++++++++++++---------------- config.sh | 4 ++-- module.prop | 4 ++-- system/binpath/props | Bin 33888 -> 34963 bytes 7 files changed, 82 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 42b6ecf..9b2edfd 100644 --- a/README.md +++ b/README.md @@ -86,14 +86,6 @@ There are a couple of persistent options that you can set for the `props` script You can use a configuration file to set your desired options, rather than running the `props` command. Download the [settings file](https://raw.githubusercontent.com/Magisk-Modules-Repo/MagiskHide-Props-Config/master/common/propsconf_conf) or extract it from the module zip (in the common folder), fill in the desired options (follow the instructions in the file), place it in /cache (or /data/cache if you're using an A/B device) and reboot. This can also be done directly at the first install (through Manager or recovery), before even rebooting your device. Instant settings. -## Device issues because of the module -In case of issues, if you've set a prop value that doesn't work on your device causing it not to boot, etc, don't worry. There are options. You can follow the advice in the [troubleshooting guide](https://www.didgeridoohan.com/magisk/Magisk#hn_Module_causing_issues_Magisk_functionality_bootloop_loss_of_root_etc) to remove or disable the module, or you can use the module's built-in options to reset all module settings to the defaults. - -Place a file named `reset_mhpc` in /cache (or /data/cache on A/B devices) and reboot. - -It is possible to use this in combination with the configuration file described above to keep device fingerprint or any other settings intact past the reset. Just make sure to remove any custom props that might have been causing issues from the configuration file. - - ## Keeping your device "certified" If you're using a custom ROM, the chances of it being [perceived as uncertified by Google](https://www.xda-developers.com/google-blocks-gapps-uncertified-devices-custom-rom-whitelist/) are pretty high. If your ROM has a build date later than March 16 2018, this might mean that you can't even log into your Google account or use Gapps without [whitelisting your device with Google](https://www.google.com/android/uncertified/) first. @@ -101,7 +93,7 @@ Magisk, and this module, can help with that. Before setting up your device, install Magisk, this module and use the configuration file described above to pass the ctsProfile check. This should make your device be perceived as certified by Google and you can log into your Google account and use your device without having to whitelist it. Check [here](https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/common/prints.sh) for usable fingerprints (only use the part to the right of the equal sign). -If you're having issues getting your device certified, take a look in the troubleshooting guide linked below. +If you're having issues getting your device certified, take a look in the Magisk troubleshooting guide linked below. ## Miscellaneous MagiskHide issues @@ -113,6 +105,13 @@ But first: have you tried turning it off and on again? Toggling MagiskHide off a ## Issues, support, etc If you have questions, suggestions or are experiencing some kind of issue, visit the [module support thread](https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-simple-t3765199) @ XDA. +### Device issues because of the module +In case of issues, if you've set a prop value that doesn't work on your device causing it not to boot, etc, don't worry. There are options. You can follow the advice in the [Magisk troubleshooting guide](https://www.didgeridoohan.com/magisk/Magisk#hn_Module_causing_issues_Magisk_functionality_bootloop_loss_of_root_etc) to remove or disable the module, or you can use the module's built-in options to reset all module settings to the defaults. + +Place a file named `reset_mhpc` in /cache (or /data/cache on A/B devices) and reboot. + +It is possible to use this in combination with the configuration file described above to keep device fingerprint or any other settings intact past the reset. Just make sure to remove any custom props that might have been causing issues from the configuration file. + ### Logs, etc In case of issues, please provide the logs, saved in /cache, "magisk.log", "propsconf.log" and "propsconf_last.log", together with a detailed description of your problem. Providing the output from terminal might also be useful. If you have the latest beta release of Magisk installed, the "magisk_debug.log" is also useful. If there's no new beta released, there's always a beta version of the latest stable Magisk release, so that you can collect the debug log. @@ -127,6 +126,11 @@ In case of issues, please provide the logs, saved in /cache, "magisk.log", "prop ## Changelog +### v2.1.3 +- Reverted the function to only editing existing fingerprint props. +- Optimised setting the different props. +- Minor updates and improvements. + ### v2.1.2 - Detects and edits only existing device fingerprint props. - Slightly optimised the boot scripts. diff --git a/common/post-fs-data.sh b/common/post-fs-data.sh index 27e41de..b92632a 100644 --- a/common/post-fs-data.sh +++ b/common/post-fs-data.sh @@ -85,37 +85,31 @@ if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then # Copies the stock build.prop to the module. Only if set in propsconf_late. if [ "$(get_file_value $LATEFILE "BUILDPROPENB=")" == 1 ] && [ "$(get_file_value $LATEFILE "BUILDEDIT=")" == 1 ]; then - log_handler "Build.prop editing enabled." - cp /system/build.prop $MODPATH/system/build.prop + cp -f /system/build.prop $MODPATH/system/build.prop log_handler "Stock build.prop copied from /system." # Edits the module copy of build.prop module_values - log_handler "Editing build.prop." - if [ "$MODULETYPE" ]; then - SEDTYPE="$MODULETYPE" - else - SEDTYPE="user" - fi - if [ "$(get_file_value $LATEFILE "SETTYPE=")" == "true" ]; then - replace_fn "ro.build.type" $FILETYPE $SEDTYPE $MODPATH/system/build.prop && log_handler "ro.build.type=$SEDTYPE" - fi - if [ "$MODULETAGS" ]; then - SEDTAGS="$MODULETAGS" - else - SEDTAGS="release-keys" - fi - if [ "$(get_file_value $LATEFILE "SETTAGS=")" == "true" ]; then - replace_fn "ro.build.tags" $FILETAGS $SEDTAGS $MODPATH/system/build.prop && log_handler "ro.build.tags=$SEDTAGS" - fi - if [ "$MODULESELINUX" ]; then - SEDSELINUX="$MODULESELINUX" - else - SEDSELINUX="0" - fi - if [ "$(get_file_value $LATEFILE "SETSELINUX=")" == "true" ]; then - replace_fn "ro.build.selinux" $FILESELINUX $SEDSELINUX $MODPATH/system/build.prop && log_handler "ro.build.selinux=$SEDSELINUX" - fi + log_handler "Editing build.prop." + for ITEM in $PROPSLIST; do + PROP=$(get_prop_type $ITEM) + MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') + FILEPROP=$(echo "FILE${PROP}" | tr '[:lower:]' '[:upper:]') + SETPROP=$(echo "SET${PROP}" | tr '[:lower:]' '[:upper:]') + if [ "$(eval "echo \$$MODULEPROP")" ]; then + SEDVAR="$(eval "echo \$$MODULEPROP")" + else + for P in $SAFELIST; do + if [ "$(get_eq_left $P)" == "$ITEM" ]; then + SEDVAR=$(get_eq_right $P) + fi + done + fi + if [ "$(get_file_value $LATEFILE "${SETPROP}=")" == "true" ]; then + replace_fn $ITEM $(eval "echo \$$FILEPROP") $SEDVAR $MODPATH/system/build.prop && log_handler "${ITEM}=${SEDVAR}" + fi + done + # Fingerprint if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")" for ITEM in $PRINTSTMP; do diff --git a/common/propsconf_late b/common/propsconf_late index b68eb93..81c8fcf 100644 --- a/common/propsconf_late +++ b/common/propsconf_late @@ -9,7 +9,7 @@ # In that case, feel free to delete it. # Script version -SCRIPTV=4 +SCRIPTV=5 SETTRANSF=1 # Variables @@ -69,7 +69,6 @@ if [ -d "$MODPATH" ]; then log_handler "Fingerprint modification disabled." else replace_fn FINGERPRINTENB 0 1 $LATEFILE - log_handler "Fingerprint modification enabled." fi # Check the reboot variable @@ -119,44 +118,39 @@ if [ -d "$MODPATH" ]; then # Set/change MagiskHide sensitive props if [ "$PROPEDIT" == 1 ]; then log_handler "Changing sensitive props." - if [ "$REDEBUGGABLE" == "true" ]; then - resetprop -v ro.debuggable $MODULEDEBUGGABLE 2>> $LOGFILE - fi - if [ "$RESECURE" == "true" ]; then - resetprop -v ro.secure $MODULESECURE 2>> $LOGFILE - fi - if [ "$RETYPE" == "true" ]; then - resetprop -v ro.build.type $MODULETYPE 2>> $LOGFILE - fi - if [ "$RETAGS" == "true" ]; then - resetprop -v ro.build.tags $MODULETAGS 2>> $LOGFILE - fi - if [ "$RESELINUX" == "true" ]; then - resetprop -v ro.build.selinux $MODULESELINUX 2>> $LOGFILE - fi + for ITEM in $PROPSLIST; do + PROP=$(get_prop_type $ITEM) + REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') + MODULEPROP=$(echo "MODULE${PROP}" | tr '[:lower:]' '[:upper:]') + if [ "$(eval "echo \$$REPROP")" == "true" ]; then + log_handler "Changing/writing $ITEM." + resetprop -v $ITEM 2>> $LOGFILE + resetprop -v $ITEM $(eval "echo \$$MODULEPROP") 2>> $LOGFILE + fi + done fi # Set new fingerprint if [ "$FINGERPRINTENB" == 1 -o "$PRINTMODULE" == "false" ] && [ "$PRINTEDIT" == 1 ]; then log_handler "Changing fingerprint." - PRINTSTMP="$(resetprop | grep "build.fingerprint" | sed 's/\]\:\ /\]/')" - for ITEM in $PRINTSTMP; do - TMPPROP=$(echo $ITEM | sed 's/\]\[.*//' | sed 's/\[//') - resetprop -v $TMPPROP $MODULEFINGERPRINT 2>> $LOGFILE - done + for ITEM in $PRINTPROPS; do + log_handler "Changing/writing $ITEM." + resetprop -v $ITEM 2>> $LOGFILE + resetprop -v $ITEM $MODULEFINGERPRINT 2>> $LOGFILE + done fi # ---Setting custom props--- if [ "$CUSTOMEDIT" == 1 ]; then log_handler "Writing custom props." for ITEM in $CUSTOMPROPS; do - log_handler "Writing $(get_eq_left $ITEM)." + log_handler "Changing/writing $(get_eq_left $ITEM)." + resetprop -v $(get_eq_left $ITEM) 2>> $LOGFILE resetprop -v $(get_eq_left $ITEM) $(get_eq_right $ITEM) 2>> $LOGFILE done fi # ---Edits default.prop--- if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then - log_handler "Default.prop editing enabled." log_handler "Editing default.prop." mount -wo remount rootfs / if [ "$MODULEDEBUGGABLE" ]; then diff --git a/common/util_functions.sh b/common/util_functions.sh index 6a88f18..a2c3ff6 100644 --- a/common/util_functions.sh +++ b/common/util_functions.sh @@ -47,9 +47,16 @@ ro.build.tags=release-keys ro.build.selinux=0 " +# Print props +PRINTPROPS=" +ro.build.fingerprint +ro.bootimage.build.fingerprint +ro.vendor.build.fingerprint +" + # Finding file values get_file_value() { - cat $1 | grep $2 | sed "s/.*${2}//" | sed 's/\"//g' + cat $1 | grep $2 | sed "s@.*${2}@@" | sed 's@\"@@g' } # Logs @@ -90,23 +97,23 @@ menu_header() { # Find prop type get_prop_type() { - echo $1 | sed 's/.*\.//' + echo $1 | sed 's@.*\.@@' } # Get left side of = get_eq_left() { - echo $1 | sed 's/=.*//' + echo $1 | sed 's@=.*@@' } # Get right side of = get_eq_right() { - echo $1 | sed 's/.*=//' + echo $1 | sed 's@.*=@@' } # Get first word in string get_first() { case $1 in - *\ *) echo $1 | sed 's/\ .*//' + *\ *) echo $1 | sed 's@\ .*@@' ;; *=*) get_eq_left $1 ;; @@ -165,26 +172,26 @@ curr_values() { CURRFINGERPRINT=$(resetprop ro.build.fingerprint) if [ -z "$CURRFINGERPRINT" ]; then CURRFINGERPRINT=$(resetprop ro.bootimage.build.fingerprint) + if [ -z "$CURRFINGERPRINT" ]; then + CURRFINGERPRINT=$(resetprop ro.vendor.build.fingerprint) + fi fi } # Prop file values file_values() { - FILEDEBUGGABLE=$(get_file_value /default.prop "ro.debuggable=") - FILESECURE=$(get_file_value /default.prop "ro.secure=") - FILETYPE=$(get_file_value /system/build.prop "ro.build.type=") - FILETAGS=$(get_file_value /system/build.prop "ro.build.tags=") - FILESELINUX=$(get_file_value /system/build.prop "ro.build.selinux=") - FILEFINGERPRINT=$(get_file_value /system/build.prop "ro.build.fingerprint=") + FILEDEBUGGABLE=$(resetprop ro.debuggable) + FILESECURE=$(resetprop ro.secure) + FILETYPE=$(resetprop ro.build.type) + FILETAGS=$(resetprop ro.build.tags) + FILESELINUX=$(resetprop ro.build.selinux) + FILEFINGERPRINT=$(resetprop ro.build.fingerprint) if [ -z "$FILEFINGERPRINT" ]; then - FILEFINGERPRINT=$(get_file_value /system/build.prop "ro.bootimage.build.fingerprint=") + FILEFINGERPRINT=$(resetprop ro.bootimage.build.fingerprint) if [ -z "$FILEFINGERPRINT" ]; then - FILEFINGERPRINT=$(resetprop ro.build.fingerprint) - if [ -z "$FILEFINGERPRINT" ]; then - FILEFINGERPRINT=$(resetprop ro.bootimage.build.fingerprint) - fi + FILEFINGERPRINT=$(resetprop ro.vendor.build.fingerprint) fi - fi + fi } # Latefile values @@ -652,7 +659,7 @@ reset_prop_all() { set_custprop() { if [ "$2" ]; then CURRCUSTPROPS=$(get_file_value $LATEFILE "CUSTOMPROPS=") - TMPCUSTPROPS=$(echo "$CURRCUSTPROPS ${1}=${2}" | sed 's/^[ \t]*//') + TMPCUSTPROPS=$(echo "$CURRCUSTPROPS ${1}=${2}" | sed 's@^[ \t]*@@') SORTCUSTPROPS=$(echo $(printf '%s\n' $TMPCUSTPROPS | sort -u)) log_handler "Setting custom prop $1." @@ -684,7 +691,7 @@ reset_custprop() { CURRCUSTPROPS=$(get_file_value $LATEFILE "CUSTOMPROPS=") log_handler "Resetting custom props $1." - TMPCUSTPROPS=$(echo $CURRCUSTPROPS | sed "s/${1}=${2}//" | tr -s " " | sed 's/^[ \t]*//') + TMPCUSTPROPS=$(echo $CURRCUSTPROPS | sed "s@${1}=${2}@@" | tr -s " " | sed 's@^[ \t]*@@') # Removing all custom props replace_fn CUSTOMPROPS "\"$CURRCUSTPROPS\"" "\"$TMPCUSTPROPS\"" $LATEFILE diff --git a/config.sh b/config.sh index 361c455..e054cc2 100644 --- a/config.sh +++ b/config.sh @@ -102,7 +102,7 @@ set_permissions() { # Finding file values get_file_value() { - cat $1 | grep $2 | sed "s/.*$2//" | sed 's/\"//g' + cat $1 | grep $2 | sed "s@.*$2@@" | sed 's@\"@@g' } # Variables @@ -286,7 +286,7 @@ script_install() { placeholder_update $MODPATH/util_functions.sh BIN BIN_PLACEHOLDER "$BIN" placeholder_update $MODPATH/util_functions.sh USNFLIST USNF_PLACEHOLDER "$USNFLIST" placeholder_update $MODPATH/util_functions.sh CACHELOC CACHE_PLACEHOLDER "$CACHELOC" - MODVERSION=$(echo $(get_file_value $MODPATH/module.prop "version=") | sed 's/-.*//') + MODVERSION=$(echo $(get_file_value $MODPATH/module.prop "version=") | sed 's@-.*@@') placeholder_update $MODPATH/util_functions.sh MODVERSION VER_PLACEHOLDER $MODVERSION placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $BIMGPATH placeholder_update $MODPATH/system/$BIN/props IMGPATH IMG_PLACEHOLDER $BIMGPATH diff --git a/module.prop b/module.prop index 0ff60b5..491f9bf 100644 --- a/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=MagiskHidePropsConf name=MagiskHide Props Config -version=v2.1.2-v10 -versionCode=8 +version=v2.1.3-v10 +versionCode=9 author=Didgeridoohan description=Change your device's fingerprint, to pass SafetyNet's CTS Profile check. Edit prop files for better root hiding. Set/reset prop values set by MagiskHide. Change any prop values easily. minMagisk=1500 diff --git a/system/binpath/props b/system/binpath/props index 3996fbbd733bb954befe9124b493eed14ee8c3e2..ae47a547eb53e0f2396b7df864293c8d23b14fcd 100644 GIT binary patch delta 955 zcmZ`&O-~b16b-15$H$b?A_XJ83_~fTEgjTgl}8j|KrAA3J^ehi!;gy68~LHA~JO%P_l z;*+u(3f3_Iq3I<9_&dfbETz^c2W!g`|U<15hft0tIB6pWmy z89HbMMw=+=h6$;(sja0kMo6CYoz$DK$!?nk`%CE~&DUMFtZYmk!x{ccDOLD;Lo+Fb%vAOWdAP2YB!=QV_wPLSy8j2pbzGmZ1>v4|$lmZZ)QtN<5|? zyT(s`Cl^!YvGDj*LJhGD1b;*Y2m!JRT|Tk zievHVt@8rO)7(lbP48uN2v1F_<709prb3W;72?CHJQ9n`IF}W0Pieud!r98XDvaUR z!E?B!blR-O{}Mo&bu(_)e|YtHsCZB18Sw^d$3BUb1Yawy*bqHkK9hAd{ww^Z-_~#$ z21>chM~L)f$@GC{vg8)V`d3QWiU8~aSjFSpehzbUwcIK3m`Y2f%5m`-4W%3IgBQ`y bez)WU$(Ky((qiR>41kmjSkr^;wWG#g$p;kf delta 276 zcmbO{k?BDP(}t;xqWXGTw)*<&3N;GFsVNHT#riQy`udw!F-i+_>BmJY#FWHp0r}@e z4(Lse_2ZiC;%YLvJW^=#RcFb`i#(JjZ<7q;P07zo<>KVzOwB1y<(h2ZrZ+j>O?`5^ zo9blwDCx(C({C4j{TMxv=;obOw|D`d@m&r8