This commit is contained in:
Didgeridoohan 2018-04-29 11:14:35 +02:00 committed by GitHub
parent 35df7ea922
commit d3a5b6c800
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 178 additions and 117 deletions

View File

@ -48,7 +48,18 @@ If you've picked a certified fingerprint from the provided list, or you're using
- 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. - 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. - 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. - 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.
- If you can't get things working, make sure to provide logs. See "Logs, etc" below. - 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.
## 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.
Magisk, and this module, can help with that.
Before setting up your device, install Magisk, this module and use the configuration file described below 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 Magisk troubleshooting guide linked below.
## Current fingerprints list version ## Current fingerprints list version
@ -86,16 +97,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. 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.
## 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.
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 Magisk troubleshooting guide linked below.
## Miscellaneous MagiskHide issues ## Miscellaneous MagiskHide issues
If you're having issues passing SafetyNet, getting your device certified, or otherwise getting MagiskHide to work, take a look in the [Magisk and MagiskHide Installation and Troubleshooting Guide](https://www.didgeridoohan.com/magisk). Lots of good info there (if I may say so myself)... If you're having issues passing SafetyNet, getting your device certified, or otherwise getting MagiskHide to work, take a look in the [Magisk and MagiskHide Installation and Troubleshooting Guide](https://www.didgeridoohan.com/magisk). Lots of good info there (if I may say so myself)...
@ -113,7 +114,9 @@ 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. 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 ### 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. 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.
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.
## Source ## Source
@ -126,6 +129,13 @@ In case of issues, please provide the logs, saved in /cache, "magisk.log", "prop
## Changelog ## Changelog
### v2.1.4
- Fixed improved hiding.
- Fixed using the configuration file on a clean install.
- Fixed a fault in the AE-35 Unit.
- Improved logging.
- A bunch of optimisations that will probably break stuff.
### v2.1.3 ### v2.1.3
- Reverted the function to only editing existing fingerprint props. - Reverted the function to only editing existing fingerprint props.
- Optimised setting the different props. - Optimised setting the different props.

View File

@ -19,16 +19,8 @@ IMGPATH=$(dirname "$MODPATH")
rm -f $RUNFILE rm -f $RUNFILE
touch $RUNFILE touch $RUNFILE
# Saves the previous log (if available) and creates a new one # Start logging
if [ -f "$LOGFILE" ]; then log_start
mv -f $LOGFILE $LASTLOGFILE
fi
touch $LOGFILE
echo "***************************************************" >> $LOGFILE
echo "******** MagiskHide Props Config $MODVERSION ********" >> $LOGFILE
echo "**************** By Didgeridoohan ***************" >> $LOGFILE
echo "***************************************************" >> $LOGFILE
log_script_chk "Log start."
# Check for boot scripts and restore backup if deleted, or if the resetfile is present # Check for boot scripts and restore backup if deleted, or if the resetfile is present
if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then
@ -56,12 +48,12 @@ replace_fn FILESELINUX "\"$LATEFILESELINUX\"" "\"$FILESELINUX\"" $LATEFILE
replace_fn FILEFINGERPRINT "\"$LATEFILEFINGERPRINT\"" "\"$FILEFINGERPRINT\"" $LATEFILE replace_fn FILEFINGERPRINT "\"$LATEFILEFINGERPRINT\"" "\"$FILEFINGERPRINT\"" $LATEFILE
log_handler "Default values saved to $LATEFILE." log_handler "Default values saved to $LATEFILE."
# Checks for configuration file
config_file
# Check if original file values are safe # Check if original file values are safe
orig_safe orig_safe
# Checks for configuration file
config_file
# Edits build.prop # Edits build.prop
if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then
log_handler "Checking for conflicting build.prop modules." log_handler "Checking for conflicting build.prop modules."
@ -91,24 +83,8 @@ if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then
# Edits the module copy of build.prop # Edits the module copy of build.prop
module_values module_values
log_handler "Editing build.prop." log_handler "Editing build.prop."
for ITEM in $PROPSLIST; do # ro.build props
PROP=$(get_prop_type $ITEM) change_prop_file "build"
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 # Fingerprint
if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then if [ "$MODULEFINGERPRINT" ] && [ "$(get_file_value $LATEFILE "SETFINGERPRINT=")" == "true" ]; then
PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")" PRINTSTMP="$(cat /system/build.prop | grep "$FILEFINGERPRINT")"

View File

@ -9,12 +9,22 @@
# In that case, feel free to delete it. # In that case, feel free to delete it.
# Script version # Script version
SCRIPTV=5 SCRIPTV=6
SETTRANSF=1 SETTRANSF=1
# Variables # Variables
IMGPATH=IMG_PLACEHOLDER IMGPATH=IMG_PLACEHOLDER
MODPATH=$IMGPATH/MagiskHidePropsConf 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 FINGERPRINTENB=1
PRINTEDIT=0 PRINTEDIT=0
@ -31,12 +41,15 @@ OPTIONWEB=1
# Function to clean up different files after the module has been uninstalled # Function to clean up different files after the module has been uninstalled
cleanup() { cleanup() {
CACHELOC=CACHE_PLACEHOLDER echo "Cleaning up files in $CACHELOC." >> $LATELOGFILE
rm -f $CACHELOC/propsconf.log for ITEM in $CACHEFILES; do
rm -f $CACHELOC/propsconf_last.log if [ -f "$CACHELOC/$ITEM" ]; then
rm -f $CACHELOC/propsconf_conf echo "Deleting ${ITEM}." >> $LATELOGFILE
rm -f $CACHELOC/reset_mhpc rm -f $CACHELOC/$ITEM
fi
done
# Suicide. # Suicide.
echo "Removing script." >> $LATELOGFILE
rm $0 rm $0
} }
@ -44,6 +57,7 @@ cleanup() {
if [ -d "$MODPATH" ]; then if [ -d "$MODPATH" ]; then
# Checks if the module is set for removal # Checks if the module is set for removal
if [ -f "$MODPATH/remove" ]; then if [ -f "$MODPATH/remove" ]; then
echo "Module set for removal." >> $LATELOGFILE
# Cleanup # Cleanup
cleanup cleanup
else else
@ -53,6 +67,7 @@ if [ -d "$MODPATH" ]; then
log_script_chk "Running boot script." log_script_chk "Running boot script."
if [ -f "$MODPATH/disable" ]; then if [ -f "$MODPATH/disable" ]; then
log_start
log_handler "Module disabled." log_handler "Module disabled."
else else
# Checks for the Universal SafetyNet Fix module and similar modules editing the device fingerprint # Checks for the Universal SafetyNet Fix module and similar modules editing the device fingerprint
@ -153,30 +168,22 @@ if [ -d "$MODPATH" ]; then
if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then
log_handler "Editing default.prop." log_handler "Editing default.prop."
mount -wo remount rootfs / mount -wo remount rootfs /
if [ "$MODULEDEBUGGABLE" ]; then change_prop_file "default"
SEDDEBUGGABLE="$MODULEDEBUGGABLE"
else
SEDDEBUGGABLE="0"
fi
if [ "$SETDEBUGGABLE" == "true" ]; then
replace_fn "ro.debuggable" $FILEDEBUGGABLE $SEDDEBUGGABLE /default.prop && log_handler "ro.debuggable=$SEDDEBUGGABLE"
fi
if [ "$MODULESECURE" ]; then
SEDSECURE="$MODULESECURE"
else
SEDSECURE="1"
fi
if [ "$SETSECURE" == "true" ]; then
replace_fn "ro.secure" $FILESECURE $SEDSECURE /default.prop && log_handler "ro.secure=$SEDSECURE"
fi
mount -ro remount rootfs / mount -ro remount rootfs /
else else
log_handler "Default.prop editing disabled." log_handler "Default.prop editing disabled."
fi fi
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
fi
log_script_chk "Boot script finished.\n\n==================" log_script_chk "Boot script finished.\n\n=================="
fi fi
else else
echo "$MODPATH not found." >> $LATELOGFILE
echo "Module no longer installed." >> $LATELOGFILE
# Cleanup # Cleanup
cleanup cleanup
fi fi

View File

@ -60,6 +60,18 @@ get_file_value() {
} }
# Logs # Logs
# Saves the previous log (if available) and creates a new one
log_start() {
if [ -f "$LOGFILE" ]; then
mv -f $LOGFILE $LASTLOGFILE
fi
touch $LOGFILE
echo "***************************************************" >> $LOGFILE
echo "******** MagiskHide Props Config $MODVERSION ********" >> $LOGFILE
echo "**************** By Didgeridoohan ***************" >> $LOGFILE
echo "***************************************************" >> $LOGFILE
log_script_chk "Log start."
}
log_handler() { log_handler() {
echo "" >> $LOGFILE echo "" >> $LOGFILE
echo -e "$(date +"%m-%d-%Y %H:%M:%S") - $1" >> $LOGFILE echo -e "$(date +"%m-%d-%Y %H:%M:%S") - $1" >> $LOGFILE
@ -128,10 +140,10 @@ replace_fn() {
# Updates placeholders # Updates placeholders
placeholder_update() { placeholder_update() {
FILEVALUE=$(get_file_value $1 "$2=") FILEVALUE=$(get_file_value $1 "$2=")
log_handler "Checking for '$3' in '$1'. Current value is '$FILEVALUE'." log_handler "Checking for ${3} in ${1}. Current value is ${FILEVALUE}."
case $FILEVALUE in case $FILEVALUE in
*PLACEHOLDER*) replace_fn $2 $3 $4 $1 *PLACEHOLDER*) replace_fn $2 $3 $4 $1
log_handler "Placeholder '$3' updated to '$4' in '$1'." log_handler "Placeholder ${3} updated to ${4} in ${1}."
;; ;;
esac esac
} }
@ -414,7 +426,7 @@ download_prints() {
# Reset the module fingerprint change # Reset the module fingerprint change
reset_print() { reset_print() {
log_handler "Resetting device fingerprint." log_handler "Resetting device fingerprint to default system value."
SUBA=$(get_file_value $LATEFILE "MODULEFINGERPRINT=") SUBA=$(get_file_value $LATEFILE "MODULEFINGERPRINT=")
@ -492,6 +504,7 @@ edit_prop_files() {
# Checking if the device fingerprint is set by the module # Checking if the device fingerprint is set by the module
if [ "$(get_file_value $LATEFILE "FINGERPRINTENB=")" == 1 ] && [ "$(get_file_value $LATEFILE "PRINTEDIT=")" == 1 ]; then if [ "$(get_file_value $LATEFILE "FINGERPRINTENB=")" == 1 ] && [ "$(get_file_value $LATEFILE "PRINTEDIT=")" == 1 ]; then
if [ "$(cat /system/build.prop | grep "$FILEFINGERPRINT")" ]; then if [ "$(cat /system/build.prop | grep "$FILEFINGERPRINT")" ]; then
log_handler "Enabling prop file editing for device fingerprint."
replace_fn SETFINGERPRINT "false" "true" $LATEFILE replace_fn SETFINGERPRINT "false" "true" $LATEFILE
fi fi
fi fi
@ -535,6 +548,44 @@ edit_prop_files() {
fi fi
} }
change_prop_file() {
case $1 in
build)
FNLIST="
ro.build.type
ro.build.tags
ro.build.selinux
"
PROPFILELOC=$MODPATH/system/build.prop
;;
default)
FNLIST="
ro.debuggable
ro.secure
"
PROPFILELOC=/default.prop
;;
esac
for ITEM in $FNLIST; 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 $PROPFILELOC && log_handler "${ITEM}=${SEDVAR}"
fi
done
}
# ======================== MagiskHide Props functions ======================== # ======================== MagiskHide Props functions ========================
# Check safe values # Check safe values
safe_props() { safe_props() {
@ -578,7 +629,7 @@ reset_prop() {
REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]') REPROP=$(echo "RE${PROP}" | tr '[:lower:]' '[:upper:]')
SUBA=$(get_file_value $LATEFILE "${MODULEPROP}=") SUBA=$(get_file_value $LATEFILE "${MODULEPROP}=")
log_handler "Resetting $1 to default value." log_handler "Resetting $1 to default system value."
# Saves new module value # Saves new module value
replace_fn $MODULEPROP "\"$SUBA\"" "\"\"" $LATEFILE replace_fn $MODULEPROP "\"$SUBA\"" "\"\"" $LATEFILE

103
config.sh
View File

@ -40,8 +40,9 @@ LATESTARTSERVICE=false
# Set what you want to show when installing your mod # Set what you want to show when installing your mod
print_modname() { print_modname() {
MODVERSION=$(echo $(get_file_value $INSTALLER/module.prop "version=") | sed 's@-.*@@')
ui_print "*******************************" ui_print "*******************************"
ui_print " MagiskHide Props Config" ui_print " MagiskHide Props Config $MODVERSION"
ui_print "*******************************" ui_print "*******************************"
} }
@ -110,6 +111,12 @@ BIMGPATH=/sbin/.core/img
$BOOTMODE && IMGPATH=$BIMGPATH || IMGPATH=$MOUNTPATH $BOOTMODE && IMGPATH=$BIMGPATH || IMGPATH=$MOUNTPATH
UPDATELATEFILE=$INSTALLER/common/propsconf_late UPDATELATEFILE=$INSTALLER/common/propsconf_late
LATEFILE=$IMGPATH/.core/service.d/propsconf_late LATEFILE=$IMGPATH/.core/service.d/propsconf_late
if [ -z $SLOT ]; then
CACHELOC=/cache
else
CACHELOC=/data/cache
fi
INSTLOG=$CACHELOC/propsconf_install.log
UPDATEV=$(get_file_value $UPDATELATEFILE "SCRIPTV=") UPDATEV=$(get_file_value $UPDATELATEFILE "SCRIPTV=")
SETTRANSF=$(get_file_value $UPDATELATEFILE "SETTRANSF=") SETTRANSF=$(get_file_value $UPDATELATEFILE "SETTRANSF=")
if [ -f "$LATEFILE" ]; then if [ -f "$LATEFILE" ]; then
@ -156,25 +163,46 @@ fingerprint
" "
USNFLIST="xiaomi-safetynet-fix safetynet-fingerprint-fix" USNFLIST="xiaomi-safetynet-fix safetynet-fingerprint-fix"
log_handler() {
echo "" >> $INSTLOG
echo -e "$(date +"%m-%d-%Y %H:%M:%S") - $1" >> $INSTLOG
}
log_start() {
if [ -f "$INSTLOG" ]; then
rm -f $INSTLOG
fi
touch $INSTLOG
echo "***************************************************" >> $INSTLOG
echo "******** MagiskHide Props Config $MODVERSION ********" >> $INSTLOG
echo "**************** By Didgeridoohan ***************" >> $INSTLOG
echo "***************************************************" >> $INSTLOG
log_handler "Starting module installation script"
}
log_print() {
ui_print "$1"
log_handler "$1"
}
# Places various module scripts in their proper places # Places various module scripts in their proper places
script_placement() { script_placement() {
ui_print "- Installing scripts" log_print "- Installing scripts"
cp -af $INSTALLER/common/util_functions.sh $MODPATH/util_functions.sh cp -af $INSTALLER/common/util_functions.sh $MODPATH/util_functions.sh
cp -af $INSTALLER/common/prints.sh $MODPATH/prints.sh cp -af $INSTALLER/common/prints.sh $MODPATH/prints.sh
cp -af $UPDATELATEFILE $MODPATH/propsconf_late cp -af $UPDATELATEFILE $MODPATH/propsconf_late
if [ "$UPDATEV" -gt "$FILEV" ]; then if [ "$UPDATEV" -gt "$FILEV" ]; then
if [ "$FILEV" == 0 ]; then if [ "$FILEV" == 0 ]; then
ui_print "- Placing settings script" log_print "- Placing settings script"
elif [ "$SETTRANSF" -gt "$FILEV" ]; then elif [ "$SETTRANSF" -gt "$FILEV" ]; then
ui_print "- Settings cleared (script updated)" log_print "- Settings cleared (script updated)"
else else
ui_print "- Script updated" log_print "- Script updated"
ui_print "- Transferring settings from old script" log_print "- Transferring settings from old script"
# Prop settings # Prop settings
for ITEM in $SETTINGSLIST; do for ITEM in $SETTINGSLIST; do
SOLD=$(get_file_value $LATEFILE "${ITEM}=") SOLD=$(get_file_value $LATEFILE "${ITEM}=")
SNEW=$(get_file_value $UPDATELATEFILE "${ITEM}=") SNEW=$(get_file_value $UPDATELATEFILE "${ITEM}=")
if [ "$SOLD" ]; then if [ "$SOLD" ] && [ "$SOLD" != "$SNEW" ]; then
log_handler "Setting ${ITEM} from ${SNEW} to ${SOLD}."
sed -i "s@${ITEM}=${SNEW}@${ITEM}=${SOLD}@" $UPDATELATEFILE sed -i "s@${ITEM}=${SNEW}@${ITEM}=${SOLD}@" $UPDATELATEFILE
fi fi
done done
@ -182,6 +210,7 @@ script_placement() {
for ITEM in $PROPSETTINGSLIST; do for ITEM in $PROPSETTINGSLIST; do
SOLD=$(get_file_value $LATEFILE "${ITEM}=") SOLD=$(get_file_value $LATEFILE "${ITEM}=")
if [ "$SOLD" ]; then if [ "$SOLD" ]; then
log_handler "Setting ${ITEM} to ${SOLD}."
sed -i "s@${ITEM}=\"\"@${ITEM}=\"${SOLD}\"@" $UPDATELATEFILE sed -i "s@${ITEM}=\"\"@${ITEM}=\"${SOLD}\"@" $UPDATELATEFILE
fi fi
done done
@ -191,10 +220,12 @@ script_placement() {
SETPROP=$(echo "SET${ITEM}" | tr '[:lower:]' '[:upper:]') SETPROP=$(echo "SET${ITEM}" | tr '[:lower:]' '[:upper:]')
REOLD=$(get_file_value $LATEFILE "${REPROP}=") REOLD=$(get_file_value $LATEFILE "${REPROP}=")
SETOLD=$(get_file_value $LATEFILE "${SETPROP}=") SETOLD=$(get_file_value $LATEFILE "${SETPROP}=")
if [ "$REOLD" != "false" ]; then if [ "$REOLD" ] && [ "$REOLD" != "false" ]; then
log_handler "Setting sensitive prop ${ITEM} to ${REOLD}."
sed -i "s/${REPROP}=false/${REPROP}=${REOLD}/" $UPDATELATEFILE sed -i "s/${REPROP}=false/${REPROP}=${REOLD}/" $UPDATELATEFILE
fi fi
if [ "$SETOLD" != "false" ]; then if [ "$SETOLD" ] && [ "$SETOLD" != "false" ]; then
log_handler "Setting file edit ${ITEM} to ${SETOLD}."
sed -i "s/${SETPROP}=false/${SETPROP}=${SETOLD}/" $UPDATELATEFILE sed -i "s/${SETPROP}=false/${SETPROP}=${SETOLD}/" $UPDATELATEFILE
fi fi
done done
@ -202,35 +233,37 @@ script_placement() {
cp -af $UPDATELATEFILE $LATEFILE cp -af $UPDATELATEFILE $LATEFILE
chmod 755 $LATEFILE chmod 755 $LATEFILE
elif [ "$UPDATEV" -lt "$FILEV" ]; then elif [ "$UPDATEV" -lt "$FILEV" ]; then
ui_print "- Settings cleared (script downgraded)" log_print "- Settings cleared (script downgraded)"
cp -af $UPDATELATEFILE $LATEFILE cp -af $UPDATELATEFILE $LATEFILE
chmod 755 $LATEFILE chmod 755 $LATEFILE
else else
ui_print "- Module settings preserved" log_print "- Module settings preserved"
fi fi
} }
# Updates placeholder # Updates placeholders
placeholder_update() { placeholder_update() {
FILEVALUE=$(get_file_value $1 "$2=") FILEVALUE=$(get_file_value $1 "$2=")
log_handler "Checking for ${3} in ${1}. Current value is ${FILEVALUE}."
case $FILEVALUE in case $FILEVALUE in
*PLACEHOLDER*) sed -i "s@${2}=${3}@${2}=\"${4}\"@g" $1 *PLACEHOLDER*) sed -i "s@${2}=${3}@${2}=\"${4}\"@g" $1
log_handler "Placeholder ${3} updated to ${4} in ${1}."
;; ;;
esac esac
} }
# Checks if any other module is using a local copy of build.prop # Checks if any other module is using a local copy of build.prop
build_prop_check() { build_prop_check() {
ui_print "- Checking for build.prop conflicts" log_print "- Checking for build.prop conflicts"
for D in $(ls $IMGPATH); do for D in $(ls $IMGPATH); do
if [ "$D" != "$MODID" ]; then if [ "$D" != "$MODID" ]; then
if [ -f "$IMGPATH/$D/system/build.prop" ]; then if [ -f "$IMGPATH/$D/system/build.prop" ]; then
NAME=$(get_file_value $IMGPATH/$D/module.prop "name=") NAME=$(get_file_value $IMGPATH/$D/module.prop "name=")
ui_print "" log_print ""
ui_print "! Another module editing build.prop detected!" log_print "! Another module editing build.prop detected!"
ui_print "! Module - '$NAME'!" log_print "! Module - '$NAME'!"
ui_print "! Modification of build.prop disabled!" log_print "! Modification of build.prop disabled!"
ui_print "" log_print ""
sed -i 's/BUILDPROPENB=1/BUILDPROPENB=0/' $UPDATELATEFILE sed -i 's/BUILDPROPENB=1/BUILDPROPENB=0/' $UPDATELATEFILE
break break
fi fi
@ -240,15 +273,15 @@ build_prop_check() {
# Checks for the Universal SafetyNet Fix module and similar modules editing device fingerprint # Checks for the Universal SafetyNet Fix module and similar modules editing device fingerprint
usnf_check() { usnf_check() {
ui_print "- Checking for fingerprint conflicts" log_print "- Checking for fingerprint conflicts"
for USNF in $USNFLIST; do for USNF in $USNFLIST; do
if [ -d "$IMGPATH/$USNF" ]; then if [ -d "$IMGPATH/$USNF" ]; then
NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=") NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=")
ui_print "" log_print ""
ui_print "! Module editing fingerprint detected!" log_print "! Module editing fingerprint detected!"
ui_print "! Module - '$NAME'!" log_print "! Module - '$NAME'!"
ui_print "! Fingerprint modification disabled!" log_print "! Fingerprint modification disabled!"
ui_print "" log_print ""
sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $UPDATELATEFILE sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $UPDATELATEFILE
break break
fi fi
@ -262,39 +295,23 @@ bin_check() {
else else
BIN=bin BIN=bin
fi fi
log_handler "Using /system/$BIN."
mv -f $MODPATH/system/binpath $MODPATH/system/$BIN mv -f $MODPATH/system/binpath $MODPATH/system/$BIN
} }
# Check for A/B devices
ab_check() {
if [ -z $SLOT ]; then
CACHELOC=/cache
else
CACHELOC=/data/cache
fi
}
# Installs everything # Installs everything
script_install() { script_install() {
log_start
build_prop_check build_prop_check
usnf_check usnf_check
bin_check bin_check
ab_check
script_placement script_placement
ui_print "- Updating placeholders" log_print "- Updating placeholders"
placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC" placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
placeholder_update $MODPATH/util_functions.sh BIN BIN_PLACEHOLDER "$BIN" 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 USNFLIST USNF_PLACEHOLDER "$USNFLIST"
placeholder_update $MODPATH/util_functions.sh CACHELOC CACHE_PLACEHOLDER "$CACHELOC" placeholder_update $MODPATH/util_functions.sh CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
MODVERSION=$(echo $(get_file_value $MODPATH/module.prop "version=") | sed 's@-.*@@')
placeholder_update $MODPATH/util_functions.sh MODVERSION VER_PLACEHOLDER $MODVERSION placeholder_update $MODPATH/util_functions.sh MODVERSION VER_PLACEHOLDER $MODVERSION
placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $BIMGPATH placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $BIMGPATH
placeholder_update $MODPATH/system/$BIN/props IMGPATH IMG_PLACEHOLDER $BIMGPATH placeholder_update $MODPATH/system/$BIN/props IMGPATH IMG_PLACEHOLDER $BIMGPATH
# Load module functions
. $MODPATH/util_functions.sh
# Checks original file values
file_values
orig_safe
# Checks for configuration file
config_file
} }

View File

@ -1,7 +1,7 @@
id=MagiskHidePropsConf id=MagiskHidePropsConf
name=MagiskHide Props Config name=MagiskHide Props Config
version=v2.1.3-v10 version=v2.1.4-v10
versionCode=9 versionCode=10
author=Didgeridoohan 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. 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 minMagisk=1500