2018-03-18 15:39:43 +00:00
|
|
|
#!/system/bin/sh
|
|
|
|
|
|
|
|
# MagiskHide Props Config
|
2018-04-15 22:05:33 +00:00
|
|
|
# By Didgeridoohan @ XDA Developers
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
# Script version
|
2018-04-29 09:14:35 +00:00
|
|
|
SCRIPTV=6
|
2018-03-18 15:39:43 +00:00
|
|
|
SETTRANSF=1
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
IMGPATH=IMG_PLACEHOLDER
|
|
|
|
MODPATH=$IMGPATH/MagiskHidePropsConf
|
2018-04-29 09:14:35 +00:00
|
|
|
CACHELOC=CACHE_PLACEHOLDER
|
|
|
|
LATELOGFILE=$CACHELOC/propsconf_latefile.log
|
|
|
|
|
|
|
|
CACHEFILES="
|
|
|
|
propsconf.log
|
|
|
|
propsconf_last.log
|
|
|
|
propsconf_install.log
|
|
|
|
propsconf_conf
|
|
|
|
reset_mhpc
|
|
|
|
"
|
2018-04-15 22:05:33 +00:00
|
|
|
|
2018-03-18 15:39:43 +00:00
|
|
|
FINGERPRINTENB=1
|
|
|
|
PRINTEDIT=0
|
|
|
|
BUILDPROPENB=1
|
|
|
|
FILESAFE=1
|
|
|
|
BUILDEDIT=0
|
|
|
|
DEFAULTEDIT=0
|
|
|
|
PROPCOUNT=0
|
|
|
|
PROPEDIT=0
|
2018-04-15 22:05:33 +00:00
|
|
|
CUSTOMEDIT=0
|
2018-03-18 15:39:43 +00:00
|
|
|
REBOOTCHK=0
|
2018-04-15 22:05:33 +00:00
|
|
|
OPTIONCOLOUR=1
|
|
|
|
OPTIONWEB=1
|
|
|
|
|
|
|
|
# Function to clean up different files after the module has been uninstalled
|
|
|
|
cleanup() {
|
2018-04-29 09:14:35 +00:00
|
|
|
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
|
|
|
|
fi
|
|
|
|
done
|
2018-04-15 22:05:33 +00:00
|
|
|
# Suicide.
|
2018-04-29 09:14:35 +00:00
|
|
|
echo "Removing script." >> $LATELOGFILE
|
2018-04-15 22:05:33 +00:00
|
|
|
rm $0
|
|
|
|
}
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# Checks if the module is installed. Deletes itself if it isn't.
|
2018-04-15 22:05:33 +00:00
|
|
|
if [ -d "$MODPATH" ]; then
|
2018-03-18 15:39:43 +00:00
|
|
|
# Checks if the module is set for removal
|
2018-04-29 09:14:35 +00:00
|
|
|
if [ -f "$MODPATH/remove" ]; then
|
|
|
|
echo "Module set for removal." >> $LATELOGFILE
|
2018-04-15 22:05:33 +00:00
|
|
|
# Cleanup
|
|
|
|
cleanup
|
2018-03-18 15:39:43 +00:00
|
|
|
else
|
|
|
|
# Load functions
|
|
|
|
. $MODPATH/util_functions.sh
|
|
|
|
|
2018-04-19 03:13:40 +00:00
|
|
|
log_script_chk "Running boot script."
|
2018-03-18 15:39:43 +00:00
|
|
|
|
2018-04-15 22:05:33 +00:00
|
|
|
if [ -f "$MODPATH/disable" ]; then
|
2018-04-29 09:14:35 +00:00
|
|
|
log_start
|
2018-04-15 22:05:33 +00:00
|
|
|
log_handler "Module disabled."
|
|
|
|
else
|
2018-04-25 22:17:32 +00:00
|
|
|
# Checks for the Universal SafetyNet Fix module and similar modules editing the device fingerprint
|
|
|
|
PRINTMODULE=false
|
|
|
|
for USNF in $USNFLIST; do
|
|
|
|
if [ -d "$IMGPATH/$USNF" ]; then
|
|
|
|
NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=")
|
|
|
|
log_handler "'$NAME' installed (modifies the device fingerprint)."
|
|
|
|
PRINTMODULE=true
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ "$PRINTMODULE" == "true" ]; then
|
|
|
|
replace_fn FINGERPRINTENB 1 0 $LATEFILE
|
|
|
|
log_handler "Fingerprint modification disabled."
|
|
|
|
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
|
|
|
|
fi
|
|
|
|
|
2018-03-18 15:39:43 +00:00
|
|
|
# ---Original values---
|
|
|
|
# default.prop
|
2018-04-15 22:05:33 +00:00
|
|
|
FILEDEBUGGABLE=""
|
|
|
|
FILESECURE=""
|
2018-03-18 15:39:43 +00:00
|
|
|
# build.prop
|
2018-04-15 22:05:33 +00:00
|
|
|
FILETYPE=""
|
|
|
|
FILETAGS=""
|
|
|
|
FILESELINUX=""
|
2018-04-25 22:17:32 +00:00
|
|
|
FILEFINGERPRINT=""
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# ---Module values---
|
2018-04-15 22:05:33 +00:00
|
|
|
MODULEDEBUGGABLE=""
|
|
|
|
MODULESECURE=""
|
|
|
|
MODULETYPE=""
|
|
|
|
MODULETAGS=""
|
|
|
|
MODULESELINUX=""
|
|
|
|
MODULEFINGERPRINT=""
|
|
|
|
|
|
|
|
# ---Custom prop values---
|
|
|
|
CUSTOMPROPS=""
|
|
|
|
|
|
|
|
# ---MagiskHide sensitive props---
|
|
|
|
REDEBUGGABLE=false
|
|
|
|
RESECURE=false
|
|
|
|
RETYPE=false
|
|
|
|
RETAGS=false
|
|
|
|
RESELINUX=false
|
|
|
|
|
|
|
|
# ---Editing default.prop---
|
|
|
|
SETDEBUGGABLE=false
|
|
|
|
SETSECURE=false
|
|
|
|
|
|
|
|
# ---Editing build.prop---
|
|
|
|
SETTYPE=false
|
|
|
|
SETTAGS=false
|
|
|
|
SETSELINUX=false
|
2018-04-19 03:13:40 +00:00
|
|
|
SETFINGERPRINT=false
|
2018-03-18 15:39:43 +00:00
|
|
|
|
|
|
|
# ---Setting/Changing props---
|
|
|
|
# Set/change MagiskHide sensitive props
|
|
|
|
if [ "$PROPEDIT" == 1 ]; then
|
|
|
|
log_handler "Changing sensitive props."
|
2018-04-26 20:40:46 +00:00
|
|
|
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
|
2018-03-18 15:39:43 +00:00
|
|
|
fi
|
|
|
|
# Set new fingerprint
|
2018-04-25 22:17:32 +00:00
|
|
|
if [ "$FINGERPRINTENB" == 1 -o "$PRINTMODULE" == "false" ] && [ "$PRINTEDIT" == 1 ]; then
|
2018-04-15 22:05:33 +00:00
|
|
|
log_handler "Changing fingerprint."
|
2018-04-26 20:40:46 +00:00
|
|
|
for ITEM in $PRINTPROPS; do
|
|
|
|
log_handler "Changing/writing $ITEM."
|
|
|
|
resetprop -v $ITEM 2>> $LOGFILE
|
|
|
|
resetprop -v $ITEM $MODULEFINGERPRINT 2>> $LOGFILE
|
|
|
|
done
|
2018-03-18 15:39:43 +00:00
|
|
|
fi
|
|
|
|
|
2018-04-15 22:05:33 +00:00
|
|
|
# ---Setting custom props---
|
|
|
|
if [ "$CUSTOMEDIT" == 1 ]; then
|
|
|
|
log_handler "Writing custom props."
|
|
|
|
for ITEM in $CUSTOMPROPS; do
|
2018-04-26 20:40:46 +00:00
|
|
|
log_handler "Changing/writing $(get_eq_left $ITEM)."
|
|
|
|
resetprop -v $(get_eq_left $ITEM) 2>> $LOGFILE
|
2018-04-15 22:05:33 +00:00
|
|
|
resetprop -v $(get_eq_left $ITEM) $(get_eq_right $ITEM) 2>> $LOGFILE
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ---Edits default.prop---
|
2018-03-18 15:39:43 +00:00
|
|
|
if [ "$DEFAULTEDIT" == 1 ] && [ "$FILESAFE" == 0 ]; then
|
|
|
|
log_handler "Editing default.prop."
|
|
|
|
mount -wo remount rootfs /
|
2018-04-29 09:14:35 +00:00
|
|
|
change_prop_file "default"
|
2018-03-18 15:39:43 +00:00
|
|
|
mount -ro remount rootfs /
|
|
|
|
else
|
|
|
|
log_handler "Default.prop editing disabled."
|
2018-04-29 09:14:35 +00:00
|
|
|
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
|
2018-04-25 22:17:32 +00:00
|
|
|
fi
|
2018-04-19 03:13:40 +00:00
|
|
|
log_script_chk "Boot script finished.\n\n=================="
|
2018-03-18 15:39:43 +00:00
|
|
|
fi
|
|
|
|
else
|
2018-04-29 09:14:35 +00:00
|
|
|
echo "$MODPATH not found." >> $LATELOGFILE
|
|
|
|
echo "Module no longer installed." >> $LATELOGFILE
|
2018-04-15 22:05:33 +00:00
|
|
|
# Cleanup
|
|
|
|
cleanup
|
2018-03-18 15:39:43 +00:00
|
|
|
fi
|