diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 54dd2d7..7e83b8a 100755 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -100,6 +100,11 @@ request_zip_size_check "$ZIP" # This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM mount_magisk_img +# Start module installation log +log_start +# Check for fresh Magisk installation +install_check + # Create mod paths rm -rf $MODPATH 2>/dev/null mkdir -p $MODPATH diff --git a/README.md b/README.md index 8a7eee7..4329401 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,13 @@ Google Nexus 6=google/shamu/shamu:7.1.1/N8I11B/4171878:user/release-keys ``` ### I still can't pass the ctsProfile check -If you've picked a certified fingerprint from the provided list, or you're using a fingerprint that you know is certified but still can't pass the ctsProfile check, do the following. +If you've picked a certified fingerprint from the provided list, or you're using a fingerprint that you know is certified but still can't pass the ctsProfile check, try one or more of the following: - First, do you pass basicIntegrity? If you don't, there's something else going on that this module can't help you with. Take a look under "Miscellaneous MagiskHide issues" below. -- Try a different fingerprint from the provided list. -- Make sure you don't have any remnants from previous root methods that may interfere with the SafetyNet check. A clean install of your system may be required. -- Some ROMs will just not be able to pass the ctsProfile check, if they contain signs of a rooted/modified device that Magisk can't hide. -- If you can't get things working, and want help, make sure to provide logs. See "Logs, etc" below. +- Go into the script options and move the execution of the boot script to post-fs-data. See "Boot stage" below. +- Try a different fingerprint (pick one from the provided list). +- Some ROMs will just not be able to pass the ctsProfile check, if they contain signs of a rooted/modified device that Magisk can't hide. Check in your ROM thread or with the creator/developer. +- You might have remnants of previous tampering on your device. A clean install of your system may be required. +- If you can't get things working, and want help, make sure to provide logs and details. See "Logs, etc" below. ## Keeping your device "certified" @@ -85,7 +86,7 @@ The fingerprints list will update without the need to update the entire module. Just run the `props` command and the list will be updated automatically. Use the -nw option to disable or disable it completely in the script settings (see below). If you've disabled the this setting you can update the list manually in the `Edit device fingerprint` menu. -**_Current fingerprints list version - v16_** +**_Current fingerprints list version - v17_** ## Improved root hiding - Editing build.prop and default.prop @@ -108,7 +109,16 @@ It's quite easy to change prop values with Magisk. With this module it's even ea ## Prop script settings -There are a couple of persistent options that you can set for the `props` script. These are currently "Colour" and "Fingerprints list check". The colour option disables or enables colours for the script, and the fingerprints list check option disables or enables automatic updating of the fingerprints list when the script starts. If the fingerprints list check is disabled, the list can be manually updated from within the script, under the `Edit device fingerprint` menu. +There are a couple of persistent options that you can set for the `props` script. These are currently "Boot stage", "Script colours" and "Fingerprints list check". + +### Boot stage +It's possible to move the execution of the boot script from the default late_start service to post-fs-data.d. This is required for the SafetyNet fix and custom props to work on some ROM/device combinations (known: LineageOS 15.1). The option is found under "Script settings" when running the `props` script. The reason late_start service is default is that it's best to try to keep the number of scripts running during post-fs-data mode as low as possible. + +### Script colours +This option will disable or enable colours for the `props` script. + +### Fingerprints list check +This option will disable or enable the automatic updating of the fingerprints list when the `props` script starts. If the fingerprints list check is disabled, the list can be manually updated from within the script, under the `Edit device fingerprint` menu, or with the -f option (use -h for details). ## Configuration file @@ -124,6 +134,9 @@ 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-t3789228) @ XDA. +### Props don't seem to set properly +If it seems like props you're trying to set with the module don't get set properly (ctsProfile still doesn't pass, custom props don't work, etc), go into the script options and change the execution of the boot script to post-fs-data. See "Boot stage" above. + ### 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. @@ -132,7 +145,7 @@ Place a file named `reset_mhpc` in /cache (or /data/cache on A/B devices) and re 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 different log files, found in /cache (or /data/cache for A/B devices), together with a detailed description of your problem. The logs available could include "magisk.log", "propsconf.log", "propsconf_last.log", "propsconf_install.log" and "propsconf_latefile.log" Providing the output from terminal might also be useful. +In case of issues, please provide the different log files, found in /cache (or /data/cache for A/B devices), together with a detailed description of your problem. The logs available could include "magisk.log" and any files starting with "propsconf". 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 (the only difference is the more verbose logging), so that you can collect the debug log. @@ -147,6 +160,14 @@ If you have the latest beta release of Magisk installed, the "magisk_debug.log" ## Changelog +### v2.2.0 +- Added an option to set prop values earlier in the boot process. +- Moved module setup from post-fs-data.sh to post-fs-data.d. +- Fixed installing module on a fresh Magisk install. +- Fixed restoring the boot scripts during post-fs-data boot stage. +- Updated and added some new fingerprints (Google Pixel 2 XL, Huawei Honor 9, Samsung Galaxy J5 and Note 8, Xiaomi Mi A1, Mi Max 2 and Redmi Note 5 Pro), list v17. +- As usual, a bunch of improvements. They'll likely not harm any kittens, but might break the module. + ### v2.1.6 - Added some new fingerprints (Sony Xperia Z, Sony Xperia Z1, Xiaomi Redmi 4 Prime, Xiaomi Redmi Note 5/5 Plus), list v15. - Very minor improvements that doesn't even deserve their own release, or changelog. @@ -214,7 +235,7 @@ If you have the latest beta release of Magisk installed, the "magisk_debug.log" ## Current fingerprints list -### List v16  +### List v17  - Asus Zenfone 2 Laser (6.0.1) - Google Nexus 4 (5.1.1) - Google Nexus 5 (6.0.1) @@ -230,6 +251,7 @@ If you have the latest beta release of Magisk installed, the "magisk_debug.log" - Google Pixel 2 XL (8.1.0) - Google Pixel 2 XL (P DP1) - HTC 10 (6.0.1) +- Huawei Honor 9 (8.0.0) - Huawei Mate 10 Pro (8.0.0) - Motorola Moto E4 (7.1.1) - Motorola Moto G4 (7.0) @@ -242,10 +264,12 @@ If you have the latest beta release of Magisk installed, the "magisk_debug.log" - OnePlus 5T (8.0.0) - Samsung Galaxy A8 Plus (7.1.1) - Samsung Galaxy Grand Prime (5.0.2) +- Samsung Galaxy J5 (7.1.1) - Samsung Galaxy J5 Prime (7.0) - Samsung Galaxy Note 3 (7.1.1) - Samsung Galaxy Note 4 (6.0.1) - Samsung Galaxy Note 5 (7.0) +- Samsung Galaxy Note 8 (8.0.0) - Samsung Galaxy S3 Neo (4.4.4) - Samsung Galaxy S4 (5.0.1) - Samsung Galaxy S6 (7.0) @@ -278,11 +302,14 @@ If you have the latest beta release of Magisk installed, the "magisk_debug.log" - Xiaomi Mi 5S Plus (6.0.1) - Xiaomi Mi 6 (7.1.1) - Xiaomi Mi 6 (8.0.0) +- Xiaomi Mi A1 (8.0.0) +- Xiaomi Mi Max 2 (7.1.1) - Xiaomi Redmi 4 Prime (6.0.1) - Xiaomi Redmi 4X (6.0.1) - Xiaomi Redmi Note 3 Pro (6.0.1) - Xiaomi Redmi Note 4/4X (7.0) - Xiaomi Redmi Note 5/5 Plus (7.1.2) +- Xiaomi Redmi Note 5 Pro (8.1.0) - ZTE Axon 7 (7.1.1) - ZTE Nubia Z17 (7.1.1) - Zuk Z2 Pro (7.0) diff --git a/common/post-fs-data.sh b/common/post-fs-data.sh index e6bc5d2..4a8c92f 100644 --- a/common/post-fs-data.sh +++ b/common/post-fs-data.sh @@ -15,90 +15,34 @@ IMGPATH=$(dirname "$MODPATH") # Load functions . $MODPATH/util_functions.sh -# Clears out the script check file -rm -f $RUNFILE -touch $RUNFILE - -# Start logging -log_start +if [ ! -f "$POSTCHKFILE" ]; then + touch $POSTCHKFILE +fi # Check for boot scripts and restore backup if deleted, or if the resetfile is present +if [ ! -f "$POSTFILE" ]; then + # Start logging + log_start + log_handler "Post-fs-data boot script not found." + log_handler "Restoring boot script (${POSTFILE})." + cp -afv $MODPATH/propsconf_post $POSTFILE >> $LOGFILE + chmod 755 $POSTFILE + # Deleting settings script to force a restore + rm -f $LATEFILE +fi if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then - cp -af $MODPATH/propsconf_late $LATEFILE - chmod 755 $LATEFILE if [ -f "$RESETFILE" ]; then - RSTTXT="reset" + RSTTXT="Resetting" else - RSTTXT="restored" - fi - log_handler "Boot script $RSTTXT (${LATEFILE})." + RSTTXT="Restoring" + log_handler "Late_start service boot script not found." + fi + log_handler "$RSTTXT boot script (${LATEFILE})." + cp -afv $MODPATH/propsconf_late $LATEFILE >> $LOGFILE + chmod 755 $LATEFILE fi -# Get the current values saved in propsconf_late -latefile_values -# Get default values -file_values +log_handler "post-fs-data.sh finished.\n\n====================" -# Save default file values in propsconf_late -replace_fn FILEDEBUGGABLE "\"$LATEFILEDEBUGGABLE\"" "\"$FILEDEBUGGABLE\"" $LATEFILE -replace_fn FILESECURE "\"$LATEFILESECURE\"" "\"$FILESECURE\"" $LATEFILE -replace_fn FILETYPE "\"$LATEFILETYPE\"" "\"$FILETYPE\"" $LATEFILE -replace_fn FILETAGS "\"$LATEFILETAGS\"" "\"$FILETAGS\"" $LATEFILE -replace_fn FILESELINUX "\"$LATEFILESELINUX\"" "\"$FILESELINUX\"" $LATEFILE -replace_fn FILEFINGERPRINT "\"$LATEFILEFINGERPRINT\"" "\"$FILEFINGERPRINT\"" $LATEFILE -log_handler "Default values saved to $LATEFILE." - -# Check if original file values are safe -orig_safe - -# Checks for configuration file -config_file - -# Edits build.prop -if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then - log_handler "Checking for conflicting build.prop modules." - # Checks if any other modules are using a local copy of build.prop - BUILDMODULE=false - MODID=$(get_file_value $MODPATH/module.prop "id=") - for D in $(ls $IMGPATH); do - if [ $D != "$MODID" ]; then - if [ -f "$IMGPATH/$D/system/build.prop" ]; then - NAME=$(get_file_value $IMGPATH/$D/module.prop "name=") - log_handler "Conflicting build.prop editing in module '$NAME'." - BUILDMODULE=true - fi - fi - done - if [ "$BUILDMODULE" == "true" ]; then - replace_fn BUILDPROPENB 1 0 $LATEFILE - else - replace_fn BUILDPROPENB 0 1 $LATEFILE - fi - - # 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 - 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." - # ro.build props - change_prop_file "build" - # Fingerprint - if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then - PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")" - for ITEM in $PRINTSTMP; do - replace_fn $(get_eq_left "$ITEM") $(get_eq_right "$ITEM") $MODULEFINGERPRINT $MODPATH/system/build.prop && log_handler "$(get_eq_left "$ITEM")=$MODULEFINGERPRINT" - done - fi - else - rm -f $MODPATH/system/build.prop - log_handler "Build.prop editing disabled." - fi -else - rm -f $MODPATH/system/build.prop - log_handler "Prop file editing disabled. All values ok." -fi - -log_script_chk "post-fs-data.sh finished.\n\n====================" +# Deletes the post-fs-data control file +rm -f $POSTCHKFILE \ No newline at end of file diff --git a/common/prints.sh b/common/prints.sh index af5395b..dd523a6 100644 --- a/common/prints.sh +++ b/common/prints.sh @@ -3,7 +3,7 @@ # MagiskHide Props Config # By Didgeridoohan @ XDA Developers -PRINTSV=16 +PRINTSV=17 PRINTSTRANSF=1 PRINTSFILE=/sdcard/printslist @@ -22,9 +22,10 @@ Google Pixel XL (8.1.0)=google/marlin/marlin:8.1.0/OPM2.171019.029/4657601:user/ Google Pixel XL (P DP1)=google/marlin/marlin:P/PPP1.180208.014/4633861:user/release-keys Google Pixel 2 (8.1.0)=google/walleye/walleye:8.1.0/OPM2.171019.029/4657601:user/release-keys Google Pixel 2 (P DP1)=google/walleye/walleye:P/PPP1.180208.014/4633861:user/release-keys -Google Pixel 2 XL (8.1.0)=google/taimen/taimen:8.1.0/OPM2.171019.029/4657601:user/release-keys +Google Pixel 2 XL (8.1.0)=google/taimen/taimen:8.1.0/OPM4.171019.016.B1/4720843:user/release-keys Google Pixel 2 XL (P DP1)=google/taimen/taimen:P/PPP1.180208.014/4633861:user/release-keys HTC 10 (6.0.1)=htc/HTCOneM10vzw/htc_pmewl:6.0.1/MMB29M/774095.8:user/release-keys +Huawei Honor 9 (8.0.0)=HONOR/STF-L09/HWSTF:8.0.0/HUAWEISTF-L09/364(C432):user/release-keys Huawei Mate 10 Pro (8.0.0)=HUAWEI/BLA-L29/HWBLA:8.0.0/HUAWEIBLA-L29S/137(C432):user/release-keys Motorola Moto E4 (7.1.1)=motorola/sperry_sprint/sperry:7.1.1/NCQ26.69-64/68:user/release-keys Motorola Moto G4 (7.0)=motorola/athene/athene:7.0/NPJS25.93-14-13/3:user/release-keys @@ -37,10 +38,12 @@ OnePlus 5T (7.1.1)=OnePlus/OnePlus5T/OnePlus5T:7.1.1/NMF26X/12152312:user/releas OnePlus 5T (8.0.0)=OnePlus/OnePlus5T/OnePlus5T:8.0.0/OPR1.170623.032/02040656:user/release-keys Samsung Galaxy A8 Plus (7.1.1)=samsung/jackpot2ltexx/jackpot2lte:7.1.1/NMF26X/A730FXXU2ARD1:user/release-keys Samsung Galaxy Grand Prime (5.0.2)=samsung/fortuna3gdtvvj/fortuna3gdtv:5.0.2/LRX22G/G530BTVJU1BPH4:user/release-keys +Samsung Galaxy J5 (7.1.1)=samsung/j5xnltexx/j5xnlte:7.1.1/NMF26X/J510FNXXS2BRA2:user/release-keys Samsung Galaxy J5 Prime (7.0)=samsung/on5xeltejv/on5xelte:7.0/NRD90M/G570FXXU1BQI6:user/release-keys Samsung Galaxy Note 3 (7.1.1)=samsung/greatltexx/greatlte:7.1.1/NMF26X/N950FXXU1AQHA:user/release-keys Samsung Galaxy Note 4 (6.0.1)=samsung/trltexx/trlte:6.0.1/MMB29M/N910FXXS1DQH9:user/release-keys Samsung Galaxy Note 5 (7.0)=samsung/nobleltejv/noblelte:7.0/NRD90M/N920CXXU3CQH6:user/release-keys +Samsung Galaxy Note 8 (8.0.0)=samsung/greatltexx/greatlte:8.0.0/R16NW/N950FXXU3CRC1:user/release-keys Samsung Galaxy S3 Neo (4.4.4)=samsung/s3ve3gdd/s3ve3gdd:4.4.4/KTU84P/I9300IDDUBQE2:user/release-keys Samsung Galaxy S4 (5.0.1)=samsung/jfltexx/jflte:5.0.1/LRX22C/I9505XXUHPF4:user/release-keys Samsung Galaxy S6 (7.0)=samsung/zerofltexx/zeroflte:7.0/NRD90M/G920FXXS5EQL1:user/release-keys @@ -73,11 +76,14 @@ Xiaomi Mi 5S (7.0)=Xiaomi/capricorn/capricorn:7.0/NRD90M/V9.2.1.0.NAGMIEK:user/r Xiaomi Mi 5S Plus (6.0.1)=Xiaomi/natrium/natrium:6.0.1/MXB48T/V8.5.2.0.MBGMIED:user/release-keys Xiaomi Mi 6 (7.1.1)=Xiaomi/sagit/sagit:7.1.1/NMF26X/V8.2.17.0.NCACNEC:user/release-keys Xiaomi Mi 6 (8.0.0)=Xiaomi/sagit/sagit:8.0.0/OPR1.170623.027/V9.2.3.0.OCAMIEK:user/release-keys +Xiaomi Mi A1 (8.0.0)=xiaomi/tissot/tissot_sprout:8.0.0/OPR1.170623.026/V.9.5.10.0.ODHMIFA:user/release-keys +Xiaomi Mi Max 2 (7.1.1)=Xiaomi/oxygen/oxygen:7.1.1/NMF26F/V9.5.4.0.NDDMIFA:user/release-keys Xiaomi Redmi 4 Prime (6.0.1)=Xiaomi/markw/markw:6.0.1/MMB29M/V9.5.3.0.MBEMIFA:user/release-keys Xiaomi Redmi 4X (6.0.1)=Xiaomi/santoni/santoni:6.0.1/MMB29M/V8.5.4.0.MAMCNED:user/release-keys Xiaomi Redmi Note 3 Pro (6.0.1)=Xiaomi/kenzo/kenzo:6.0.1/MMB29M/V8.2.1.0.MHOCNDL:user/release-keys Xiaomi Redmi Note 4/4X (7.0)=xiaomi/mido/mido:7.0/NRD90M/V9.2.1.0.NCFMIEK:user/release-keys Xiaomi Redmi Note 5/5 Plus (7.1.2)=xiaomi/vince/vince:7.1.2/N2G47H/V9.5.4.0.NEGMIFA:user/release-keys +Xiaomi Redmi Note 5 Pro (8.1.0)=xiaomi/whyred/whyred:8.1.0/OPM1.171019.011/V9.5.6.0.OEIMIFA:user/release-keys ZTE Axon 7 (7.1.1)=ZTE/P996A01_N/ailsa_ii:7.1.1/NMF26V/20171211.005949:user/release-keys ZTE Nubia Z17 (7.1.1)=nubia/NX563J/NX563J:7.1.1/NMF26X/eng.nubia.20171019.101529:user/release-keys Zuk Z2 Pro (7.0)=ZUK/z2_row/z2_row:7.0/NRD90M/2.5.435_170525:user/release-keys diff --git a/common/propsconf_conf b/common/propsconf_conf index b26d31a..8d3e601 100644 --- a/common/propsconf_conf +++ b/common/propsconf_conf @@ -16,6 +16,7 @@ CONFSELINUX="" CONFPROPS="" PROPOPTION=replace +CONFLATE=true CONFCOLOUR=enabled CONFWEB=enabled @@ -52,6 +53,12 @@ CONFWEB=enabled # This option supersedes the preserve option described below, but only # for the CONFPROPS variable. # +# CONFLATE is by default set to "true". This loads the boot script during the +# late_start service mode. If the setting is changed to "false", the boot script +# will instead be loaded earlier during boot, in the post-fs-data mode. This is +# useful if the module can't set the props correctly. Known to happen on some +# LineageOS 15.1 ROMs, and possibly others. +# # CONFCOLOUR and CONFWEB are the options for colour and automatic fingerprints # list update. See the module documentation for more details. # diff --git a/common/propsconf_late b/common/propsconf_late index 45ec5b5..47aa010 100644 --- a/common/propsconf_late +++ b/common/propsconf_late @@ -9,7 +9,7 @@ # In that case, feel free to delete it. # Script version -SCRIPTV=6 +SCRIPTV=7 SETTRANSF=1 # Variables @@ -18,14 +18,6 @@ MODPATH=$IMGPATH/MagiskHidePropsConf CACHELOC=CACHE_PLACEHOLDER LATELOGFILE=$CACHELOC/propsconf_latefile.log -CACHEFILES=" -propsconf.log -propsconf_last.log -propsconf_install.log -propsconf_conf -reset_mhpc -" - FINGERPRINTENB=1 PRINTEDIT=0 BUILDPROPENB=1 @@ -36,21 +28,33 @@ PROPCOUNT=0 PROPEDIT=0 CUSTOMEDIT=0 REBOOTCHK=0 +OPTIONLATE=1 OPTIONCOLOUR=1 OPTIONWEB=1 +CACHEFILES=" +propsconf.log +propsconf_last.log +propsconf_install.log +propsconf_conf +reset_mhpc +" + +rm -f $LATELOGFILE + # Function to clean up different files after the module has been uninstalled cleanup() { echo "Cleaning up files in $CACHELOC." >> $LATELOGFILE for ITEM in $CACHEFILES; do if [ -f "$CACHELOC/$ITEM" ]; then echo "Deleting ${ITEM}." >> $LATELOGFILE - rm -f $CACHELOC/$ITEM + rm -fv $CACHELOC/$ITEM >> $LATELOGFILE fi done # Suicide. - echo "Removing script." >> $LATELOGFILE - rm $0 + echo "Removing scripts." >> $LATELOGFILE + rm -fv $IMGPATH/.core/post-fs-data.d/propsconf_post >> $LATELOGFILE + rm -fv $0 >> $LATELOGFILE } # Checks if the module is installed. Deletes itself if it isn't. @@ -64,6 +68,12 @@ if [ -d "$MODPATH" ]; then # Load functions . $MODPATH/util_functions.sh + if [ "$OPTIONLATE" == 0 ]; then + until [ ! -f "$POSTCHKFILE" ]; do + sleep 1 + done + fi + log_script_chk "Running boot script." if [ -f "$MODPATH/disable" ]; then @@ -85,7 +95,7 @@ if [ -d "$MODPATH" ]; then else replace_fn FINGERPRINTENB 0 1 $LATEFILE fi - + # Check the reboot variable if [ "$(get_file_value $LATEFILE "REBOOTCHK\=")" == 1 ]; then replace_fn REBOOTCHK 1 0 $LATEFILE @@ -129,8 +139,14 @@ if [ -d "$MODPATH" ]; then SETSELINUX=false SETFINGERPRINT=false - # ---Setting/Changing props--- - # Set/change MagiskHide sensitive props + # Edits prop values if set for late_start service + if [ "$OPTIONLATE" == 1 ]; then + # ---Setting/Changing fingerprint--- + print_edit + # ---Setting custom props--- + custom_edit + fi + # Edit MagiskHide sensitive values if [ "$PROPEDIT" == 1 ]; then log_handler "Changing sensitive props." for ITEM in $PROPSLIST; do @@ -140,29 +156,10 @@ if [ -d "$MODPATH" ]; then if [ "$(eval "echo \$$REPROP")" == "true" ]; then log_handler "Changing/writing $ITEM." resetprop -v $ITEM 2>> $LOGFILE - resetprop -v $ITEM $(eval "echo \$$MODULEPROP") 2>> $LOGFILE + resetprop -nv $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." - 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 "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 @@ -174,10 +171,11 @@ if [ -d "$MODPATH" ]; then log_handler "Default.prop editing disabled." fi fi + # Check if the late_start service log file exists. if [ -f "$LATELOGFILE" ]; then log_handler "Removing late_start service log ($LATELOGFILE)." - rm -f $LATELOGFILE + rm -fv $LATELOGFILE >> $LOGFILE fi log_script_chk "Boot script finished.\n\n==================" fi diff --git a/common/propsconf_post b/common/propsconf_post new file mode 100644 index 0000000..8ea480f --- /dev/null +++ b/common/propsconf_post @@ -0,0 +1,124 @@ +#!/system/bin/sh + +# MagiskHide Props Config +# By Didgeridoohan @ XDA Developers + +# This is a script file for the Magisk module "MagiskHide Props Config" By Didgeridoohan @ XDA Developers. +# DO NOT DELETE! +# 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. + +# Variables +IMGPATH=IMG_PLACEHOLDER +MODPATH=$IMGPATH/MagiskHidePropsConf +POSTLOGFILE=$CACHELOC/propsconf_postfile.log + +# Checks if the module is installed. Deletes itself if it isn't. +if [ -d "$MODPATH" ]; then + # Checks if the module is set for removal + if [ -f "$MODPATH/remove" ]; then + echo "Module set for removal." >> $POSTLOGFILE + else + # Load functions + . $MODPATH/util_functions.sh + + # Clears out the script control file + rm -f $POSTCHKFILE + touch $POSTCHKFILE + + # Clears out the script check file + rm -f $RUNFILE + touch $RUNFILE + + # Start logging + log_start + + # Get the current values saved in propsconf_late + latefile_values + # Get default values + file_values + + # Save default file values in propsconf_late + replace_fn FILEDEBUGGABLE "\"$LATEFILEDEBUGGABLE\"" "\"$FILEDEBUGGABLE\"" $LATEFILE + replace_fn FILESECURE "\"$LATEFILESECURE\"" "\"$FILESECURE\"" $LATEFILE + replace_fn FILETYPE "\"$LATEFILETYPE\"" "\"$FILETYPE\"" $LATEFILE + replace_fn FILETAGS "\"$LATEFILETAGS\"" "\"$FILETAGS\"" $LATEFILE + replace_fn FILESELINUX "\"$LATEFILESELINUX\"" "\"$FILESELINUX\"" $LATEFILE + replace_fn FILEFINGERPRINT "\"$LATEFILEFINGERPRINT\"" "\"$FILEFINGERPRINT\"" $LATEFILE + log_handler "Default values saved to $LATEFILE." + + # Check if original file values are safe + orig_safe + + # Checks for configuration file + config_file + + # Edits prop values if set for post-fs-data + if [ "$(get_file_value $LATEFILE "OPTIONLATE=")" == 0 ]; then + echo "\n--------------------" >> $LOGFILE + log_handler "Setting prop values in post-fs-data mode." + # ---Setting/Changing fingerprint--- + print_edit + # ---Setting custom props--- + custom_edit + echo "\n--------------------" >> $LOGFILE + fi + + # Edits build.prop + if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then + log_handler "Checking for conflicting build.prop modules." + # Checks if any other modules are using a local copy of build.prop + BUILDMODULE=false + MODID=$(get_file_value $MODPATH/module.prop "id=") + for D in $(ls $IMGPATH); do + if [ $D != "$MODID" ]; then + if [ -f "$IMGPATH/$D/system/build.prop" ]; then + NAME=$(get_file_value $IMGPATH/$D/module.prop "name=") + log_handler "Conflicting build.prop editing in module '$NAME'." + BUILDMODULE=true + fi + fi + done + if [ "$BUILDMODULE" == "true" ]; then + replace_fn BUILDPROPENB 1 0 $LATEFILE + else + replace_fn BUILDPROPENB 0 1 $LATEFILE + fi + + # 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 "Stock build.prop copied from /system." + cp -afv /system/build.prop $MODPATH/system/build.prop >> $LOGFILE + + # Edits the module copy of build.prop + module_values + log_handler "Editing build.prop." + # ro.build props + change_prop_file "build" + # Fingerprint + if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then + PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")" + for ITEM in $PRINTSTMP; do + replace_fn $(get_eq_left "$ITEM") $(get_eq_right "$ITEM") $MODULEFINGERPRINT $MODPATH/system/build.prop && log_handler "$(get_eq_left "$ITEM")=$MODULEFINGERPRINT" + done + fi + else + rm -f $MODPATH/system/build.prop + log_handler "Build.prop editing disabled." + fi + else + rm -f $MODPATH/system/build.prop + log_handler "Prop file editing disabled. All values ok." + fi + + # Check if the late_start service log file exists. + if [ -f "$POSTLOGFILE" ]; then + log_handler "Removing post-fs-data log ($POSTLOGFILE)." + rm -f $POSTLOGFILE + fi + log_script_chk "post-fs-data.d finished.\n\n====================" + fi +else + echo "$MODPATH not found." >> $POSTLOGFILE + echo "Module no longer installed." >> $POSTLOGFILE +fi diff --git a/common/util_functions.sh b/common/util_functions.sh index a5e7e06..dae3a03 100644 --- a/common/util_functions.sh +++ b/common/util_functions.sh @@ -8,6 +8,7 @@ MODVERSION=VER_PLACEHOLDER POSTFILE=$IMGPATH/.core/post-fs-data.d/propsconf_post LATEFILE=$IMGPATH/.core/service.d/propsconf_late CACHELOC=CACHE_PLACEHOLDER +POSTCHKFILE=$CACHELOC/propsconf_postchk RUNFILE=$MODPATH/script_check LOGFILE=$CACHELOC/propsconf.log LASTLOGFILE=$CACHELOC/propsconf_last.log @@ -15,11 +16,6 @@ CONFFILE=$CACHELOC/propsconf_conf RESETFILE=$CACHELOC/reset_mhpc MAGISKLOC=/data/adb/magisk BBPATH=$MAGISKLOC/busybox -PRINTSLOC=$MODPATH/prints.sh -PRINTSTMP=$CACHELOC/prints.sh -PRINTSWWW="https://raw.githubusercontent.com/Magisk-Modules-Repo/MagiskHide-Props-Config/master/common/prints.sh" -BIN=BIN_PLACEHOLDER -USNFLIST=USNF_PLACEHOLDER alias cat="$BBPATH cat" alias grep="$BBPATH grep" alias printf="$BBPATH printf" @@ -28,6 +24,11 @@ alias sed="$BBPATH sed" alias sort="$BBPATH sort" alias tr="$BBPATH tr" alias wget="$BBPATH wget" +PRINTSLOC=$MODPATH/prints.sh +PRINTSTMP=$CACHELOC/prints.sh +PRINTSWWW="https://raw.githubusercontent.com/Magisk-Modules-Repo/MagiskHide-Props-Config/master/common/prints.sh" +BIN=BIN_PLACEHOLDER +USNFLIST=USNF_PLACEHOLDER # MagiskHide props PROPSLIST=" @@ -67,8 +68,8 @@ log_start() { fi touch $LOGFILE echo "***************************************************" >> $LOGFILE - echo "******** MagiskHide Props Config $MODVERSION ********" >> $LOGFILE - echo "**************** By Didgeridoohan ***************" >> $LOGFILE + echo "********* MagiskHide Props Config $MODVERSION ********" >> $LOGFILE + echo "***************** By Didgeridoohan ***************" >> $LOGFILE echo "***************************************************" >> $LOGFILE log_script_chk "Log start." } @@ -174,7 +175,7 @@ orig_check() { script_ran_check() { POSTCHECK=0 - if [ "$(cat $RUNFILE | grep "post-fs-data.sh finished")" ]; then + if [ "$(cat $RUNFILE | grep "post-fs-data.d finished")" ]; then POSTCHECK=1 fi LATECHECK=0 @@ -274,21 +275,24 @@ reboot_chk() { reset_fn() { BUILDPROPENB=$(get_file_value $LATEFILE "BUILDPROPENB=") FINGERPRINTENB=$(get_file_value $LATEFILE "FINGERPRINTENB=") - cp -af $MODPATH/propsconf_late $LATEFILE - if [ "$BUILDPROPENB" ] && [ -z "$BUILDPROPENB" == 1 ]; then + cp -afv $MODPATH/propsconf_late $LATEFILE >> $LOGFILE + if [ "$BUILDPROPENB" ] && [ "$BUILDPROPENB" != 1 ]; then replace_fn BUILDPROPENB 1 $BUILDPROPENB $LATEFILE fi - if [ "$FINGERPRINTENB" ] && [ -z "$FINGERPRINTENB" == 1 ]; then + if [ "$FINGERPRINTENB" ] && [ "$FINGERPRINTENB" != 1 ]; then replace_fn FINGERPRINTENB 1 $FINGERPRINTENB $LATEFILE fi - chmod 755 $LATEFILE + chmod 755 $LATEFILE placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $IMGPATH + placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER $CACHELOC - # Update the reboot variable - reboot_chk + if [ "$1" != "post" ]; then + # Update the reboot variable + reboot_chk - # Update all prop value variables - all_values + # Update all prop value variables + all_values + fi } # Check if original file values are safe @@ -371,8 +375,18 @@ config_file() { fi # Updates options + OPTLCURR=$(get_file_value $LATEFILE "OPTIONLATE=") OPTCCURR=$(get_file_value $LATEFILE "OPTIONCOLOUR=") OPTWCURR=$(get_file_value $LATEFILE "OPTIONWEB=") + if [ "$CONFLATE" == "true" ]; then + OPTLCHNG=1 + TMPTXT="late_start service" + else + OPTLCHNG=0 + TMPTXT="post-fs-data" + fi + replace_fn OPTIONLATE $OPTLCURR $OPTLCHNG $LATEFILE + log_handler "Boot stage is ${TMPTXT}." if [ "$CONFCOLOUR" == "enabled" ]; then OPTCCHNG=1 else @@ -397,6 +411,18 @@ config_file() { } # ======================== Fingerprint functions ======================== +# Set new fingerprint +print_edit() { + if [ "$(get_file_value $LATEFILE "FINGERPRINTENB=")" == 1 -o "$(get_file_value $LATEFILE "PRINTMODULE=")" == "false" ] && [ "$(get_file_value $LATEFILE "PRINTEDIT=")" == 1 ]; then + log_handler "Changing fingerprint." + for ITEM in $PRINTPROPS; do + log_handler "Changing/writing $ITEM." + resetprop -v $ITEM 2>> $LOGFILE + resetprop -nv $ITEM "$(get_file_value $LATEFILE "MODULEFINGERPRINT=")" 2>> $LOGFILE + done + fi +} + # Checks and updates the prints list download_prints() { if [ -z "$LOGNAME" ]; then @@ -658,9 +684,9 @@ reset_prop() { PROPCOUNTP=$(($PROPCOUNT-1)) replace_fn PROPCOUNT $PROPCOUNT $PROPCOUNTP $LATEFILE fi - if [ "$PROPCOUNT" == 0 ]; then - replace_fn PROPEDIT 1 0 $LATEFILE - fi + fi + if [ "$(get_file_value $LATEFILE "PROPCOUNT=")" == 0 ]; then + replace_fn PROPEDIT 1 0 $LATEFILE fi if [ "$2" != "file" ]; then @@ -716,11 +742,24 @@ reset_prop_all() { PROPCOUNT=$(get_file_value $LATEFILE "PROPCOUNT=") replace_fn PROPCOUNT $PROPCOUNT 0 $LATEFILE replace_fn PROPEDIT 1 0 $LATEFILE - + after_change "$1" } # ======================== Custom Props functions ======================== +# Set custom props +custom_edit() { + if [ "$(get_file_value $LATEFILE "CUSTOMEDIT=")" == 1 ]; then + log_handler "Writing custom props." + TMPLST="$(get_file_value $LATEFILE "CUSTOMPROPS=")" + for ITEM in $TMPLST; do + log_handler "Changing/writing $(get_eq_left "$ITEM")." + resetprop -v $(get_eq_left "$ITEM") 2>> $LOGFILE + resetprop -nv $(get_eq_left "$ITEM") $(get_eq_right "$ITEM") 2>> $LOGFILE + done + fi +} + # Set custom prop value set_custprop() { if [ "$2" ]; then diff --git a/config.sh b/config.sh index 47d75da..022e0bb 100644 --- a/config.sh +++ b/config.sh @@ -109,8 +109,13 @@ get_file_value() { # Variables BIMGPATH=/sbin/.core/img $BOOTMODE && IMGPATH=$BIMGPATH || IMGPATH=$MOUNTPATH +POSTPATH=$IMGPATH/.core/post-fs-data.d +SERVICEPATH=$IMGPATH/.core/service.d +POSTFILE=$POSTPATH/propsconf_post +UPDATEPOSTFILE=$INSTALLER/common/propsconf_post +LATEFILE=$SERVICEPATH/propsconf_late +POSTLATEFILE=$POSTPATH/propsconf_late UPDATELATEFILE=$INSTALLER/common/propsconf_late -LATEFILE=$IMGPATH/.core/service.d/propsconf_late if [ -z $SLOT ]; then CACHELOC=/cache else @@ -141,6 +146,7 @@ PROPEDIT CUSTOMEDIT CUSTOMCHK REBOOTCHK +OPTIONLATE OPTIONCOLOUR OPTIONWEB " @@ -186,9 +192,12 @@ log_print() { # Places various module scripts in their proper places script_placement() { log_print "- Installing scripts" - cp -af $INSTALLER/common/util_functions.sh $MODPATH/util_functions.sh - cp -af $INSTALLER/common/prints.sh $MODPATH/prints.sh - cp -af $UPDATELATEFILE $MODPATH/propsconf_late + cp -afv $INSTALLER/common/util_functions.sh $MODPATH/util_functions.sh >> $INSTLOG + cp -afv $INSTALLER/common/prints.sh $MODPATH/prints.sh >> $INSTLOG + cp -afv $UPDATEPOSTFILE $MODPATH/propsconf_post >> $INSTLOG + cp -afv $UPDATEPOSTFILE $POSTFILE >> $INSTLOG + chmod 755 $POSTFILE + cp -afv $UPDATELATEFILE $MODPATH/propsconf_late >> $INSTLOG if [ "$UPDATEV" -gt "$FILEV" ]; then if [ "$FILEV" == 0 ]; then log_print "- Placing settings script" @@ -230,11 +239,11 @@ script_placement() { fi done fi - cp -af $UPDATELATEFILE $LATEFILE + cp -afv $UPDATELATEFILE $LATEFILE >> $INSTLOG chmod 755 $LATEFILE elif [ "$UPDATEV" -lt "$FILEV" ]; then log_print "- Settings cleared (script downgraded)" - cp -af $UPDATELATEFILE $LATEFILE + cp -afv $UPDATELATEFILE $LATEFILE >> $INSTLOG chmod 755 $LATEFILE else log_print "- Module settings preserved" @@ -299,19 +308,37 @@ bin_check() { mv -f $MODPATH/system/binpath $MODPATH/system/$BIN } +# Magisk installation check +install_check() { + if [ ! -d "$SERVICEPATH"]; then + log_handler "Fresh Magisk installation detected." + log_handler "Creating path for boot script." + mkdir -pv $SERVICEPATH >> $INSTLOG + fi +} + +# Check for boot script in post-fs-data.d +post_check() { + if [ -f "$POSTLATEFILE" ]; then + log_handler "Removing boot script from post-fs-data.d." + rm -f $POSTLATEFILE + fi +} + # Installs everything script_install() { - log_start build_prop_check usnf_check bin_check + post_check script_placement log_print "- Updating placeholders" placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC" 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" - 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 + placeholder_update $MODPATH/util_functions.sh MODVERSION VER_PLACEHOLDER "$MODVERSION" + placeholder_update $POSTFILE IMGPATH IMG_PLACEHOLDER "$BIMGPATH" + 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 16622ce..9366371 100644 --- a/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=MagiskHidePropsConf name=MagiskHide Props Config -version=v2.1.6-v16 -versionCode=12 +version=v2.2.0-v17 +versionCode=13 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 3ddda3f..c903d36 100644 Binary files a/system/binpath/props and b/system/binpath/props differ