Add files via upload

This commit is contained in:
Didgeridoohan 2018-03-18 16:39:43 +01:00 committed by GitHub
parent 50249f660a
commit 34307ed80a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 689 additions and 12 deletions

View File

@ -136,6 +136,9 @@ $POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
# service mode scripts
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
# Module boot script placement and backup, etc
script_install
ui_print "- Setting permissions"
set_permissions

View File

@ -1,9 +1,81 @@
# Magisk Module Template
# MagiskHide Props Config
## By Didgeridoohan @ XDA Developers
This `README.md` will be shown in Magisk Manager. Place any information / changelog / notes you like.
**Please update `README.md` if you want to submit your module to the online repo!**
## Installation
Download the zip from the [module support thread](https://forum.xda-developers.com/apps/magisk/ ), and install through the Magisk Manager -> Modules, or from recovery.
Any previous versions are kept in the first post of the [module support thread](https://forum.xda-developers.com/apps/magisk/ ).
Github has its own online markdown editor with a preview feature, you can use it to update your `README.md`! If you need more advanced syntax, check the [Markdown Cheat Sheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
For more information about modules and repos, please check the [official documentations](https://github.com/topjohnwu/Magisk/blob/master/docs/modules.md)
## Use
Run the command `props` (as su) in a terminal emulator (you can find a one on [F-Droid](https://f-droid.org/) or in the [Play Store](https://play.google.com/store/apps)).
```
su
props
```
You can also run the command with options. Use -h or --help for details.
## Spoofing device's fingerprint
If your device can't pass SafetyNet fully, the CTS profile check fails while basic integrity passes, that means MagiskHide is working on your device but Google doesn't recognise your device as being certified.
This might be because your device simply hasn't been certified or that the ROM you are using on your device isn't recognised by Google (because it's a custom ROM).
To fix this, you can use a known working fingerprint (one that has been certified by Google), usually from a stock ROM/firmware/factory image, and replace your device's current fingerprint with this.
Keep in mind that changing the fingerprint of your device might have some side-effects, since you are changing how your device is percieved. Most of the times it works fine though. IMO it is preferable to use a fingerprint from a stock ROM for your specific device.
There are a few pre-configured certified fingerprints available in the module, just in case you can't get a hold of one for your device. If you have a working fingerprint that could be added to the list, or an updated one for one already on there, please post that in the [module support thread](https://forum.xda-developers.com/apps/magisk/ ) toghether with device details.
### Finding a certified fingerprint
The easies way to find a certified fingerprint for your device is to run the getprop command below on a stock ROM/firmware/factory image that fully passes SafetyNet.
```
getprop ro.build.fingerprint
```
If you're already on a custom ROM that can't pass the CTS profile check, this might not be an option... Head over to your device's forum and ask for help. If someone can run the getprop command on their device for you, you're good to go.
### Custom fingerprints list
You can add your own fingerprint to the list by placing a file in the root of your internal storage with the fingerprint. It needs to be formated as follows:`<device name>=<fingerprint>`.
Here's an example:
```
Google Nexus 6=google/shamu/shamu:7.1.1/N8I11B/4171878:user/release-keys
```
## Editing build.prop and default.prop
Some apps and services look at the actual files, rather than the set prop values. With this module feature you can make sure that the actual prop in build.prop and default.prop is changed to match whatever value the prop has been set to by either MagiskHide or the module. If there's a prop value set by the module (see below), that value takes precedence.
## Set/reset MagiskHide Sensitive props
By default, if MagiskHide detects certain sensitive prop values they will be changed to known safe values. These are currently:
- ro.debuggable (set to "0" by MagiskHide - sensitive value is "1")
- ro.secure (set to "1" by MagiskHide - sensitive value is "0")
- ro.build.type (set to "user" by MagiskHide - sensitive value is "userdebug")
- ro.build.tags (set to "release-keys" by MagiskHide - sensitive value is "test-keys")
- ro.build.selinux (set to "0" by MagiskHide - sensitive value is "1")
If, for some reason, you need one or more of these to be kept as their original value (one example would be resetting ro.build.type to userdebug since some ROMs need this to work properly), you can reset to the original value with this module. Keep in mind that this might trigger some apps looking for these prop values as a sign of your device being rooted.
You can also use this module to set these props to your preferred value with MagiskHide disabled.
## Miscellaneous
If you're having issues passing SafetyNet 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)...
## Support, etc
If you're having issues, questions or suggestions, visit the [module support thread](https://forum.xda-developers.com/apps/magisk/ ) @XDA.
## Source
[GitHub](https://github.com/Didgeridoohan/MagiskHide-Props-Config)
## Credits
@topjohnwu @ XDA Developers, for Magisk
@Zackptg5 and @veez21 @ XDA Developers, for inspiration
## Changelog
### v1.0.0
- Initial release. Compatible with Magisk v15+.

View File

@ -5,3 +5,194 @@ MODDIR=${0%/*}
# This script will be executed in post-fs-data mode
# More info in the main Magisk thread
# MagiskHide Props Config
# By Didgeridoohan @ XDA-Developers
# Variables
IMGPATH=$(dirname "$MODDIR")
LASTLOGFILE=/cache/propsconf_last.log
BIN=BIN_PLACEHOLDER
USNFLIST=USNF_PLACEHOLDER
# Load functions
. $MODDIR/util_functions.sh
MODVERSION=$(get_file_value $MODDIR/module.prop "version=")
# Saves the previous log (if available) and creates a new one
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_handler "Log start."
# Check for boot scripts, restore backup if deleted
if [ ! -f "$LATEFILE" ]; then
cp -af $MODDIR/propsconf_late $LATEFILE
chmod 755 $LATEFILE
log_handler "Boot script restored."
fi
# Update placeholders in util_functions.sh
# Image path
placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $IMGPATH
placeholder_update $MODDIR/system/$BIN/props IMGPATH IMG_PLACEHOLDER $IMGPATH
# Module version
placeholder_update $MODDIR/system/$BIN/props MODVERSION VER_PLACEHOLDER $MODVERSION
# Check the reboot variable
if [ "$(get_file_value $LATEFILE "REBOOTCHK=")" == 1 ]; then
sed -i 's/REBOOTCHK=1/REBOOTCHK=0/' $LATEFILE
fi
# Get the current values saved in propsconf_late
LATEDEBUGGABLE=$(get_file_value $LATEFILE "ORIGDEBUGGABLE=")
LATEFILEDEBUGGABLE=$(get_file_value $LATEFILE "FILEDEBUGGABLE=")
LATESECURE=$(get_file_value $LATEFILE "ORIGSECURE=")
LATEFILESECURE=$(get_file_value $LATEFILE "FILESECURE=")
LATETYPE=$(get_file_value $LATEFILE "ORIGTYPE=")
LATEFILETYPE=$(get_file_value $LATEFILE "FILETYPE=")
LATETAGS=$(get_file_value $LATEFILE "ORIGTAGS=")
LATEFILETAGS=$(get_file_value $LATEFILE "FILETAGS=")
LATESELINUX=$(get_file_value $LATEFILE "ORIGSELINUX=")
LATEFILESELINUX=$(get_file_value $LATEFILE "FILESELINUX=")
LATEFINGERPRINT=$(get_file_value $LATEFILE "ORIGFINGERPRINT=")
# Get default 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)
# Save default file values in propsconf_late
sed -i "s/FILEDEBUGGABLE=$LATEFILEDEBUGGABLE/FILEDEBUGGABLE=$FILEDEBUGGABLE/" $LATEFILE
sed -i "s/FILESECURE=$LATEFILESECURE/FILESECURE=$FILESECURE/" $LATEFILE
sed -i "s/FILETYPE=$LATEFILETYPE/FILETYPE=$FILETYPE/" $LATEFILE
sed -i "s/FILETAGS=$LATEFILETAGS/FILETAGS=$FILETAGS/" $LATEFILE
sed -i "s/FILESELINUX=$LATEFILESELINUX/FILESELINUX=$FILESELINUX/" $LATEFILE
log_handler "Default file values saved to $LATEFILE."
# Get the default prop values
ORIGDEBUGGABLE=$(resetprop ro.debuggable)
ORIGSECURE=$(resetprop ro.secure)
ORIGTYPE=$(resetprop ro.build.type)
ORIGTAGS=$(resetprop ro.build.tags)
ORIGSELINUX=$(resetprop ro.build.selinux)
ORIGFINGERPRINT=$(resetprop ro.build.fingerprint)
# Save defatul prop values in propsconf_late
sed -i "s/ORIGDEBUGGABLE=$LATEDEBUGGABLE/ORIGDEBUGGABLE=$ORIGDEBUGGABLE/" $LATEFILE
sed -i "s/ORIGSECURE=$LATESECURE/ORIGSECURE=$ORIGSECURE/" $LATEFILE
sed -i "s/ORIGTYPE=$LATETYPE/ORIGTYPE=$ORIGTYPE/" $LATEFILE
sed -i "s/ORIGTAGS=$LATETAGS/ORIGTAGS=$ORIGTAGS/" $LATEFILE
sed -i "s/ORIGSELINUX=$LATESELINUX/ORIGSELINUX=$ORIGSELINUX/" $LATEFILE
sed -i "s@ORIGFINGERPRINT=$LATEFINGERPRINT@ORIGFINGERPRINT=$ORIGFINGERPRINT@" $LATEFILE
log_handler "Current prop values saved to $LATEFILE."
# 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
sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $LATEFILE
log_handler "Fingerprint modification disabled."
else
sed -i 's/FINGERPRINTENB=0/FINGERPRINTENB=1/' $LATEFILE
if [ "$(get_file_value $LATEFILE "FINGERPRINTENB=")" == 1 ]; then
log_handler "Fingerprint modification enabled."
else
log_handler "Fingerprint modification disabled."
fi
fi
# Check if original file values are safe
sed -i 's/FILESAFE=0/FILESAFE=1/' $LATEFILE
for V in $PROPSLIST; do
PROP=$(get_prop_type $V)
FILEPROP=$(echo "FILE$PROP" | tr '[:lower:]' '[:upper:]')
FILEVALUE=$(eval "echo \$$FILEPROP")
log_handler "Checking $FILEPROP=$FILEVALUE"
safe_props $V $FILEVALUE
if [ "$SAFE" == 0 ]; then
log_handler "Prop $V set to triggering value in prop file."
sed -i 's/FILESAFE=1/FILESAFE=0/' $LATEFILE
else
log_handler "Prop $V set to \"safe\" value in prop file."
fi
done
if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then
# Checks if any other modules are using a local copy of build.prop
BUILDMODULE=false
MODID=$(get_file_value $MODDIR/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
sed -i 's/BUILDPROPENB=1/BUILDPROPENB=0/' $LATEFILE
else
sed -i 's/BUILDPROPENB=0/BUILDPROPENB=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 "Build.prop editing enabled."
cp /system/build.prop $MODDIR/system/build.prop
log_handler "Stock build.prop copied from /system."
# Edits the module copy of build.prop
MODULETYPE=$(get_file_value $LATEFILE "MODULETYPE=")
MODULETAGS=$(get_file_value $LATEFILE "MODULETAGS=")
MODULESELINUX=$(get_file_value $LATEFILE "MODULESELINUX=")
log_handler "Editing build.prop."
if [ "$MODULETYPE" ]; then
SEDTYPE=$MODULETYPE
else
SEDTYPE=user
fi
if [ "$(get_file_value $LATEFILE "SETTYPE=")" == "true" ]; then
sed -i "s/ro.build.type=$FILETYPE/ro.build.type=$SEDTYPE/" $MODDIR/system/build.prop && log_handler "ro.build.type"
fi
if [ "$MODULETAGS" ]; then
SEDTAGS=$MODULETAGS
else
SEDTAGS=release-keys
fi
if [ "$(get_file_value $LATEFILE "SETTAGS=")" == "true" ]; then
sed -i "s/ro.build.tags=$FILETAGS/ro.build.tags=$SEDTAGS/" $MODDIR/system/build.prop && log_handler "ro.build.tags"
fi
if [ "$MODULESELINUX" ]; then
SEDSELINUX=$MODULESELINUX
else
SEDSELINUX=0
fi
if [ "$(get_file_value $LATEFILE "SETSELINUX=")" == "true" ]; then
sed -i "s/ro.build.selinux=$FILESELINUX/ro.build.selinux=$SEDSELINUX/" $MODDIR/system/build.prop && log_handler "ro.build.selinux"
fi
else
rm -f $MODDIR/system/build.prop
log_handler "Build.prop editing disabled."
fi
else
rm -f $MODDIR/system/build.prop
log_handler "Prop file editing disabled. All values ok."
fi
log_handler "post-fs-data.sh finished.\n\n===================="

25
common/prints.sh Normal file
View File

@ -0,0 +1,25 @@
#!/system/bin/sh
# MagiskHide Props Config
# By Didgeridoohan @ XDA-Developers
PRINTSFILE=/sdcard/printslist
# Certified fingerprints
PRINTSLIST="
Google Nexus 6=google/shamu/shamu:7.1.1/N8I11B/4171878:user/release-keys
Google Pixel 2 XL=google/taimen/taimen:8.1.0/OPM1.171019.013/4474084:user/release-keys
OnePlus 3T=OnePlus/OnePlus3/OnePlus3T:8.0.0/OPR6.170623.013/12041042:user/release-keys
OnePlus 5T=OnePlus/OnePlus5T/OnePlus5T:7.1.1/NMF26X/12152312:user/release-keys
Samsung S8 Plus=samsung/dream2ltexx/dream2lte:7.0/NRD90M/G955FXXU1AQGB:user/release-keys
Xiaomi Mi6=Xiaomi/sagit/sagit:7.1.1/NMF26X/V8.2.17.0.NCACNEC:user/release-keys
"
if [ -f "$PRINTSFILE" ]; then
FLINE=$(head -1 $PRINTSFILE)
if [ "$FLINE" ]; then
sed -i '1s/^/\n/' $PRINTSFILE
fi
LISTFILE=$(cat $PRINTSFILE)
PRINTSLIST=$PRINTSLIST$LISTFILE
fi

140
common/propsconf_late Normal file
View File

@ -0,0 +1,140 @@
#!/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.
# Script version
SCRIPTV=1
SETTRANSF=1
# Variables
IMGPATH=IMG_PLACEHOLDER
MODPATH=$IMGPATH/MagiskHidePropsConf
FINGERPRINTENB=1
PRINTEDIT=0
BUILDPROPENB=1
FILESAFE=1
BUILDEDIT=0
DEFAULTEDIT=0
PROPCOUNT=0
PROPEDIT=0
REBOOTCHK=0
# 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
# Suicide.
rm $0
else
# Load functions
. $MODPATH/util_functions.sh
log_handler "Running boot script."
if ! [ -f "$MODPATH/disable" ]; then
# ---Original values---
# default.prop
FILEDEBUGGABLE=
FILESECURE=
# build.prop
FILETYPE=
FILETAGS=
FILESELINUX=
# Prop values
ORIGDEBUGGABLE=
ORIGSECURE=
ORIGTYPE=
ORIGTAGS=
ORIGSELINUX=
ORIGFINGERPRINT=
# ---Module values---
MODULEDEBUGGABLE=
MODULESECURE=
MODULETYPE=
MODULETAGS=
MODULESELINUX=
MODULEFINGERPRINT=
# ---Setting/Changing props---
# Set/change MagiskHide sensitive props
if [ "$PROPEDIT" == 1 ]; then
log_handler "Changing sensitive props."
REDEBUGGABLE=false
RESECURE=false
RETYPE=false
RETAGS=false
RESELINUX=false
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
fi
# Set new fingerprint
if [ "$FINGERPRINTENB" == 1 ] && [ "$PRINTEDIT" == 1 ]; then
REFINGERPRINT=false
if [ "$REFINGERPRINT" == "true" ]; then
log_handler "Changing fingerprint."
resetprop -v ro.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
resetprop -v ro.bootimage.build.fingerprint $MODULEFINGERPRINT 2>> $LOGFILE
fi
fi
# Settings for default.prop editing
SETDEBUGGABLE=false
SETSECURE=false
# 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
SEDDEBUGGABLE=$MODULEDEBUGGABLE
else
SEDDEBUGGABLE=0
fi
if [ "$SETDEBUGGABLE" == "true" ]; then
sed -i "s/ro.debuggable=$FILEDEBUGGABLE/ro.debuggable=$SEDDEBUGGABLE/" /default.prop && log_handler "ro.debuggable"
fi
if [ "$MODULESECURE" ]; then
SEDSECURE=$MODULESECURE
else
SEDSECURE=1
fi
if [ "$SETSECURE" == "true" ]; then
sed -i "s/ro.secure=$FILESECURE/ro.secure=$SEDSECURE/" /default.prop && log_handler "ro.secure"
fi
mount -ro remount rootfs /
else
log_handler "Default.prop editing disabled."
fi
# Settings for build.prop editing
SETTYPE=false
SETTAGS=false
SETSELINUX=false
fi
log_handler "Boot script finished.\n\n=================="
fi
else
# Suicide.
rm $0
fi

86
common/util_functions.sh Normal file
View File

@ -0,0 +1,86 @@
#!/system/bin/sh
# MagiskHide Props Config
# By Didgeridoohan @ XDA-Developers
# Variables
LATEFILE=$IMGPATH/.core/service.d/propsconf_late
LOGFILE=/cache/propsconf.log
MAGISKLOC=/data/adb/magisk
BBPATH=$MAGISKLOC/busybox
alias cat="$BBPATH cat"
alias grep="$BBPATH grep"
alias sed="$BBPATH sed"
alias tr="$BBPATH tr"
alias reboot="/system/bin/reboot"
alias resetprop="$MAGISKLOC/magisk resetprop"
# MagiskHide props
PROPSLIST="
ro.debuggable
ro.secure
ro.build.type
ro.build.tags
ro.build.selinux
"
# Safe values
SAFELIST="
ro.debuggable=0
ro.secure=1
ro.build.type=user
ro.build.tags=release-keys
ro.build.selinux=0
"
# Logs
log_handler() {
echo "" >> $LOGFILE
echo -e "$(date +"%m-%d-%Y %H:%M:%S") - $1" >> $LOGFILE
}
# Finding file values
get_file_value() {
cat $1 | grep $2 | sed 's/.*=//'
}
# Find prop type
get_prop_type() {
echo $1 | sed 's/.*\.//'
}
# Separate prop from value
safe_prop_name() {
echo $1 | sed 's/=.*//'
}
safe_prop_value() {
echo $1 | sed 's/.*=//'
}
# Check safe values
safe_props() {
SAFE=""
if [ "$2" ]; then
for P in $SAFELIST; do
if [ "$(safe_prop_name $P)" == "$1" ]; then
if [ "$2" == "$(safe_prop_value $P)" ]; then
SAFE=1
else
SAFE=0
fi
break
fi
done
fi
}
# Updates placeholders
placeholder_update() {
FILEVALUE=$(get_file_value $1 "$2=")
log_handler "Checking for '$3' in '$1'. Current value is '$FILEVALUE'."
case $FILEVALUE in
*PLACEHOLDER*) sed -i "s@$2\=$3@$2\=$4@g" $1
log_handler "Placeholder '$3' updated to '$4' in '$1'."
;;
esac
}

164
config.sh
View File

@ -28,7 +28,7 @@ AUTOMOUNT=true
PROPFILE=false
# Set to true if you need post-fs-data script
POSTFSDATA=false
POSTFSDATA=true
# Set to true if you need late_start service script
LATESTARTSERVICE=false
@ -41,7 +41,7 @@ LATESTARTSERVICE=false
print_modname() {
ui_print "*******************************"
ui_print " Magisk Module Template "
ui_print " MagiskHide Props Config"
ui_print "*******************************"
}
@ -85,6 +85,9 @@ set_permissions() {
# The following is default permissions, DO NOT remove
set_perm_recursive $MODPATH 0 0 0755 0644
# Permissions for the props file
set_perm $MODPATH/system/$BIN/props 0 0 0777
}
##########################################################################################
@ -97,3 +100,160 @@ set_permissions() {
# difficult for you to migrate your modules to newer template versions.
# Make update-binary as clean as possible, try to only do function calls in it.
# Finding file values
get_file_value() {
cat $1 | grep $2 | sed 's/.*=//'
}
# Variables
$BOOTMODE && IMGPATH=/sbin/.core/img || IMGPATH=$MOUNTPATH
UPDATELATEFILE=$INSTALLER/common/propsconf_late
LATEFILE=$IMGPATH/.core/service.d/propsconf_late
UPDATEV=$(get_file_value $UPDATELATEFILE "SCRIPTV=")
SETTRANSF=$(get_file_value $UPDATELATEFILE "SETTRANSF=")
if [ -f "$LATEFILE" ]; then
FILEV=$(get_file_value $LATEFILE "SCRIPTV=")
else
FILEV=0
fi
BBPATH=/data/adb/magisk/busybox
$BOOTMODE && alias grep="$BBPATH grep"
$BOOTMODE && alias sed="$BBPATH sed"
$BOOTMODE && alias tr="$BBPATH tr"
$BOOTMODE && alias ls="$BBPATH ls"
SETTINGSLIST="
FINGERPRINTENB
PRINTEDIT
BUILDPROPENB
FILESAFE
BUILDEDIT
DEFAULTEDIT
PROPCOUNT
PROPEDIT
REBOOTCHK
FILEDEBUGGABLE
FILESECURE
FILETYPE
FILETAGS
FILESELINUX
ORIGDEBUGGABLE
ORIGSECURE
ORIGTYPE
ORIGTAGS
ORIGSELINUX
ORIGFINGERPRINT
MODULEDEBUGGABLE
MODULESECURE
MODULETYPE
MODULETAGS
MODULESELINUX
MODULEFINGERPRINT
"
PROPSLIST="
debuggable
secure
type
tags
selinux
fingerprint
"
USNFLIST="xiaomi-safetynet-fix safetynet-fingerprint-fix"
# Places the boot script in service.d and puts a backup in the module folder
# Places util_functions.sh in the module folder
script_placement() {
ui_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
if [ "$UPDATEV" -gt "$FILEV" ]; then
if [ "$FILEV" == 0 ]; then
ui_print "- Placing settings script"
elif [ "$SETTRANSF" -gt "$FILEV" ]; then
ui_print "- Settings cleared (script updated)"
else
ui_print "- Transfering settings from old script"
# Prop values
for S in $SETTINGSLIST; do
SOLD=$(get_file_value $LATEFILE "$S=")
SNEW=$(get_file_value $UPDATELATEFILE "$S=")
sed -i "s@$S\=$SNEW@$S\=$SOLD@g" $UPDATELATEFILE
done
# Prop and file edits
for P in $PROPSLIST; do
REPROP=$(echo "RE$P" | tr '[:lower:]' '[:upper:]')
POLD=$(get_file_value $LATEFILE "$REPROP\=")
sed -i "s/$REPROP\=false/$REPROP\=$POLD/" $UPDATELATEFILE
done
fi
cp -af $UPDATELATEFILE $LATEFILE
chmod 755 $LATEFILE
else
ui_print "- Module settings preserved"
fi
}
# Updates placeholder
placeholder_update() {
FILEVALUE=$(get_file_value $1 "$2=")
case $FILEVALUE in
*PLACEHOLDER*) ui_print "- Updating placeholders"
sed -i "s@$2\=$3@$2\=\"$4\"@g" $1
;;
esac
}
# Checks if any other module is using a local copy of build.prop
build_prop_check() {
ui_print "- Checking for build.prop conflicts"
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=")
ui_print ""
ui_print "! Another module editing build.prop detected!"
ui_print "! Module - '$NAME'!"
ui_print "! Modification of build.prop disabled!"
ui_print ""
sed -i 's/BUILDPROPENB=1/BUILDPROPENB=0/' $UPDATELATEFILE
break
fi
fi
done
}
# Checks for the Universal SafetyNet Fix module and similar modules editing device fingerprint
usnf_check() {
ui_print "- Checking for fingerprint conflicts"
for USNF in $USNFLIST; do
if [ -d "$IMGPATH/$USNF" ]; then
NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=")
ui_print ""
ui_print "! Module editing fingerprint detected!"
ui_print "! Module - '$NAME'!"
ui_print "! Fingerprint modification disabled!"
ui_print ""
sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $UPDATELATEFILE
break
fi
done
}
# Check for bin/xbin
bin_check() {
if [ -d "/system/xbin" ]; then
BIN=xbin
else
BIN=bin
fi
mv -f $MODPATH/system/binpath $MODPATH/system/$BIN
}
script_install() {
build_prop_check
usnf_check
bin_check
script_placement
placeholder_update $MODPATH/post-fs-data.sh BIN BIN_PLACEHOLDER "$BIN"
placeholder_update $MODPATH/post-fs-data.sh USNFLIST USNF_PLACEHOLDER "$USNFLIST"
}

View File

@ -1,7 +1,7 @@
id=template
name=Template Module
version=v1
id=MagiskHidePropsConf
name=MagiskHide Props Config
version=v1.0.0
versionCode=1
author=topjohnwu
description=A short description
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.
minMagisk=1500

BIN
system/binpath/props Normal file

Binary file not shown.