Skip to content

Commit 27c6220

Browse files
v3.0.0-v42
1 parent 416ddbc commit 27c6220

File tree

10 files changed

+1675
-747
lines changed

10 files changed

+1675
-747
lines changed

README.md

Lines changed: 63 additions & 10 deletions
Large diffs are not rendered by default.

common/post-fs-data.sh

Lines changed: 127 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@ MODPATH=${0%/*}
77
# More info in the main Magisk thread
88

99
# MagiskHide Props Config
10-
# By Didgeridoohan @ XDA Developers
10+
# Copyright (c) 2018-2019 Didgeridoohan @ XDA Developers
11+
# Licence: MIT
12+
13+
# Load functions
14+
. $MODPATH/util_functions.sh
1115

1216
# Variables
1317
IMGPATH=$(dirname "$MODPATH")
1418
COREPATH=$(dirname "$IMGPATH")
15-
POSTLOGFILE=$CACHELOC/propsconf_postfile.log
16-
POSTDEL=0
1719

18-
# Load functions
19-
. $MODPATH/util_functions.sh
20+
# Start logging
21+
log_start
2022

21-
if [ ! -f "$POSTCHKFILE" ]; then
22-
touch $POSTCHKFILE
23-
fi
23+
# Clears out the script check file
24+
rm -f $RUNFILE
25+
touch $RUNFILE
2426

25-
# Check for boot scripts and restore backup if deleted, or if the resetfile is present
26-
if [ ! -f "$POSTFILE" ]; then
27-
# Start logging
28-
log_start
29-
log_handler "post-fs-data boot script not found."
30-
log_handler "Restoring post-fs-data boot script (${POSTFILE})."
31-
cp -af $MODPATH/propsconf_post $POSTFILE >> $LOGFILE 2>&1
32-
chmod -v 755 $POSTFILE >> $LOGFILE 2>&1
33-
placeholder_update $POSTFILE COREPATH CORE_PLACEHOLDER "$COREPATH"
34-
placeholder_update $POSTFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
35-
# Deleting settings script to force a restore
36-
rm -f $LATEFILE
37-
POSTDEL=1
27+
# Clears out the script control file
28+
touch $POSTCHKFILE
29+
30+
# Checks the reboot and print update variables in propsconf_late
31+
if [ "$REBOOTCHK" == 1 ]; then
32+
replace_fn REBOOTCHK 1 0 $LATEFILE
33+
fi
34+
if [ "$PRINTCHK" == 1 ]; then
35+
replace_fn PRINTCHK 1 0 $LATEFILE
3836
fi
37+
38+
# Check for the boot script and restore backup if deleted, or if the resetfile is present
3939
if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then
4040
if [ -f "$RESETFILE" ]; then
4141
RSTTXT="Resetting"
@@ -47,20 +47,118 @@ if [ ! -f "$LATEFILE" ] || [ -f "$RESETFILE" ]; then
4747
log_handler "$RSTTXT late_start service boot script (${LATEFILE})."
4848
cp -af $MODPATH/propsconf_late $LATEFILE >> $LOGFILE 2>&1
4949
chmod -v 755 $LATEFILE >> $LOGFILE 2>&1
50-
placeholder_update $LATEFILE POSTFILE POST_PLACEHOLDER "$POSTFILE"
5150
placeholder_update $LATEFILE COREPATH CORE_PLACEHOLDER "$COREPATH"
5251
placeholder_update $LATEFILE CACHELOC CACHE_PLACEHOLDER "$CACHELOC"
5352
fi
5453

55-
# Checking if the post-fs-data boot script ran during boot
56-
if [ -f "$POSTLOGFILE" ] || [ "$POSTDEL" == 1 ]; then
57-
if [ "$(cat $POSTLOGFILE | grep "Module no longer installed.")" ] || [ "$POSTDEL" == 1 ]; then
58-
log_handler "post-fs-data boot script did not run. Attempting a re-run."
59-
. $POSTFILE
54+
# Checks for the Universal SafetyNet Fix module and similar modules editing the device fingerprint
55+
PRINTMODULE=false
56+
for USNF in $USNFLIST; do
57+
if [ -d "$IMGPATH/$USNF" ]; then
58+
NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=")
59+
log_handler "'$NAME' installed (modifies the device fingerprint)."
60+
PRINTMODULE=true
61+
fi
62+
done
63+
if [ "$PRINTMODULE" == "true" ]; then
64+
replace_fn FINGERPRINTENB 1 0 $LATEFILE
65+
replace_fn PRINTMODULE 0 1 $LATEFILE
66+
log_handler "Fingerprint modification disabled."
67+
else
68+
replace_fn FINGERPRINTENB 0 1 $LATEFILE
69+
replace_fn PRINTMODULE 1 0 $LATEFILE
70+
fi
71+
72+
# Get default values
73+
log_handler "Checking device default values."
74+
curr_values
75+
# Get the current original values saved in propsconf_late
76+
log_handler "Loading currently saved values."
77+
. $LATEFILE
78+
79+
# Save default file values in propsconf_late
80+
for ITEM in $VALPROPSLIST; do
81+
TMPPROP=$(get_prop_type $ITEM | tr '[:lower:]' '[:upper:]')
82+
ORIGPROP="ORIG${TMPPROP}"
83+
ORIGTMP="$(eval "echo \$$ORIGPROP")"
84+
CURRPROP="CURR${TMPPROP}"
85+
CURRTMP="$(eval "echo \$$CURRPROP")"
86+
replace_fn $ORIGPROP "\"$ORIGTMP\"" "\"$CURRTMP\"" $LATEFILE
87+
done
88+
log_handler "Default values saved to $LATEFILE."
89+
90+
# Check if default file values are safe
91+
orig_safe
92+
# Loading the new values
93+
. $LATEFILE
94+
95+
# Checks for configuration file
96+
config_file
97+
98+
# Edits prop values if set for post-fs-data
99+
echo -e "\n--------------------" >> $LOGFILE 2>&1
100+
log_handler "Editing prop values in post-fs-data mode."
101+
if [ "$OPTIONLATE" == 0 ]; then
102+
# ---Setting/Changing fingerprint---
103+
print_edit
104+
# ---Setting device simulation props---
105+
dev_sim_edit
106+
# ---Setting custom props---
107+
custom_edit "CUSTOMPROPS"
108+
fi
109+
# Deleting props
110+
prop_del
111+
# Edit custom props set for post-fs-data
112+
custom_edit "CUSTOMPROPSPOST"
113+
echo -e "\n--------------------" >> $LOGFILE 2>&1
114+
115+
# Edits build.prop
116+
if [ "$FILESAFE" == 0 ]; then
117+
log_handler "Checking for conflicting build.prop modules."
118+
# Checks if any other modules are using a local copy of build.prop
119+
BUILDMODULE=false
120+
MODID=$(get_file_value $MODPATH/module.prop "id=")
121+
for D in $(ls $IMGPATH); do
122+
if [ $D != "$MODID" ]; then
123+
if [ -f "$IMGPATH/$D/system/build.prop" ] || [ "$D" == "safetypatcher" ]; then
124+
NAME=$(get_file_value $IMGPATH/$D/module.prop "name=")
125+
log_handler "Conflicting build.prop editing in module '$NAME'."
126+
BUILDMODULE=true
127+
fi
128+
fi
129+
done
130+
if [ "$BUILDMODULE" == "true" ]; then
131+
replace_fn BUILDPROPENB 1 0 $LATEFILE
132+
else
133+
replace_fn BUILDPROPENB 0 1 $LATEFILE
134+
fi
135+
136+
# Copies the stock build.prop to the module. Only if set in propsconf_late.
137+
if [ "$BUILDPROPENB" == 1 ] && [ "$BUILDEDIT" == 1 ]; then
138+
log_handler "Stock build.prop copied to module."
139+
cp -af $MIRRORLOC/build.prop $MODPATH/system/build.prop >> $LOGFILE 2>&1
140+
141+
# Edits the module copy of build.prop
142+
log_handler "Editing build.prop."
143+
# ro.build props
144+
change_prop_file "build"
145+
# Fingerprint
146+
if [ "$MODULEFINGERPRINT" ] && [ "$SETFINGERPRINT" == "true" ] && [ "$FINGERPRINTENB" == 1 ]; then
147+
PRINTSTMP="$(grep "$ORIGFINGERPRINT" $MIRRORLOC/build.prop)"
148+
for ITEM in $PRINTSTMP; do
149+
replace_fn $(get_eq_left "$ITEM") $(get_eq_right "$ITEM") $(echo $MODULEFINGERPRINT | sed 's|\_\_.*||') $MODPATH/system/build.prop && log_handler "$(get_eq_left "$ITEM")=$(echo $MODULEFINGERPRINT | sed 's|\_\_.*||')"
150+
done
151+
fi
152+
else
153+
rm -f $MODPATH/system/build.prop
154+
log_handler "Build.prop editing disabled."
60155
fi
156+
else
157+
rm -f $MODPATH/system/build.prop
158+
log_handler "Prop file editing disabled. All values ok."
61159
fi
62160

63-
log_handler "post-fs-data.sh module script finished.\n\n===================="
161+
log_script_chk "post-fs-data.sh module script finished.\n\n===================="
64162

65163
# Deletes the post-fs-data control file
66-
rm -f $POSTCHKFILE
164+
rm -f $POSTCHKFILE

common/prints.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/system/bin/sh
22

33
# MagiskHide Props Config
4-
# By Didgeridoohan @ XDA Developers
4+
# Copyright (c) 2018-2019 Didgeridoohan @ XDA Developers
5+
# Licence: MIT
56

67
PRINTSV=42
7-
PRINTSTRANSF=250
8+
PRINTSTRANSF=260
89

910
# Certified fingerprints
1011
PRINTSLIST="

common/propsconf_conf

Lines changed: 64 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,96 @@
11
#!/system/bin/sh
22

33
# MagiskHide Props Config
4-
# By Didgeridoohan @ XDA Developers
4+
# Copyright (c) 2018-2019 Didgeridoohan @ XDA Developers
5+
# Licence: MIT
56

6-
CONFFINGERPRINT=""
7+
# Required module version
8+
CONFTRANSF=300
79

10+
# Device fingerprint
11+
CONFFINGERPRINT=""
12+
CONFVENDPRINT=false
13+
14+
# Device simulation
15+
CONFDEVSIM=false
16+
CONFBRAND=true
17+
CONFNAME=true
18+
CONFDEVICE=true
19+
CONFRELEASE=true
20+
CONFID=true
21+
CONFINCREMENTAL=true
22+
CONFDESCRIPTION=true
23+
24+
# Edit prop files
825
CONFPROPFILES=false
926

27+
# MagiskHide sensitive props
1028
CONFDEBUGGABLE=""
1129
CONFSECURE=""
1230
CONFTYPE=""
1331
CONFTAGS=""
1432
CONFSELINUX=""
1533

34+
# Set custom props
1635
CONFPROPS=""
1736
CONFPROPSPOST=""
1837
CONFPROPSLATE=""
1938
PROPOPTION=replace
2039

40+
# Delete props
2141
CONFDELPROPS=""
2242
DELPROPOPTION=replace
2343

44+
# Module settings
2445
CONFLATE=false
25-
CONFCOLOUR=enabled
26-
CONFWEB=enabled
46+
CONFCOLOUR=true
47+
CONFWEB=true
2748

2849
# =================================================================
2950
# ========================== Instructions =========================
3051
# =================================================================
3152
# Set the above variables to the desired prop/configuration values.
3253

54+
# If any variables are left unset, that particular prop/configuration
55+
# will be cleared and the device/Magisk default values will be used.
56+
# If you want to keep any current module settings (for those that
57+
# aren't true/false options), add "preserve" to the variable.
58+
# Example:
59+
# CONFFINGERPRINT=preserve
60+
61+
# When placed in /cache or the root of your internal storage, the module will load these
62+
# values during boot and the configuration file will be deleted. Keep a backup of the
63+
# file if you want to reuse it at a later time (clean ROM flash, etc).
64+
65+
# For more information, see the documentation:
66+
# https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md
67+
# and the support thread @ XDA Developers:
68+
# https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228
69+
70+
# =================================================================
71+
# =========================== Variables ===========================
72+
# =================================================================
3373
# CONFFINGERPRINT should be set to the fingerprint of a ROM that passes
3474
# the ctsProfile check. See the prints.sh file for usable prints,
3575
# or the documentation for information on how to find one.
3676
# Note that Android builds after March 16 2018 often also need to match the Android
37-
# security patch date. Use the CONFPROPS setting to set ro.build.version.security_patch
38-
# to the matching date (example: 2018-10-05).
77+
# security patch date. Add the date to the end of the fingerprint, preceeded by
78+
# two underscores (example: __2018-10-05), or use the CONFPROPS setting
79+
# to set ro.build.version.security_patch to the matching date (example: 2018-10-05).
80+
#
81+
# Changing CONFVENDPRINT to 'true' will enable using the stock vendor
82+
# fingerprint for Treble GSI ROMs (so only us this if you're on a Treble GSI ROM).
83+
# NOTE! Keep in mind that there is no need to enter a fingerprint in
84+
# CONFFINGERPRINT when enabling this option, or setting a security patch date.
85+
86+
# CONFDEVSIM and the following CONFBRAND, CONFNAME, CONFDEVICE, CONFRELEASE
87+
# CONFID, CONFINCREMENTAL and CONFDESCRIPTION are used to set a number
88+
# of props to simulate a certain deviced based on the fingerprint used.
89+
# CONFDESCRIPTION will automatically be applied if a fingerprint is set
90+
# by the module, but the other props will only be set if CONFDEVSIM is
91+
# set to true, and the default setting for all props are that they will be
92+
# set by the module. If you want to change this, change "true" to "false"
93+
# for the applicable variables.
3994

4095
# CONFPROPFILES should be set to "true" if you want to mask the file
4196
# values in build.prop and default.prop. For better root hiding.
@@ -65,7 +120,7 @@ CONFWEB=enabled
65120
# With PROPOPTION you can decide if the current custom prop list should
66121
# be replaced, added to or preserved. Add the corresponding words "replace",
67122
# "add", or "preserve". The default option is to replace the list.
68-
# This option supersedes the preserve option described below, but only
123+
# This option supersedes the preserve option described above, but only
69124
# for the CONFPROPS variables.
70125

71126
# CONFDELPROPS is a list of props you want to remove from your system.
@@ -82,7 +137,7 @@ CONFWEB=enabled
82137
# With DELPROPOPTION you can decide if the current custom prop list should
83138
# be replaced, added to or preserved. Add the corresponding words "replace",
84139
# "add", or "preserve". The default option is to replace the list.
85-
# This option supersedes the preserve option described below, but only
140+
# This option supersedes the preserve option described above, but only
86141
# for the CONFDELPROPS variable.
87142

88143
# CONFLATE is by default set to "false". This loads the boot script during the
@@ -91,19 +146,4 @@ CONFWEB=enabled
91146
# useful if the module's boot script seems to be causing issues during boot.
92147
#
93148
# CONFCOLOUR and CONFWEB are the options for colour and automatic fingerprints
94-
# list update. See the module documentation for more details. Set to "enabled" or "disabled".
95-
96-
# If any variables are left unset, that particular prop/configuration
97-
# will be cleared and the device/MagiskHide default values will be used.
98-
# If you want to keep any current module settings, add "preserve" to the variable.
99-
# Example:
100-
# CONFFINGERPRINT=preserve
101-
102-
# When placed in /cache or the root of your internal storage, the module will load these
103-
# values during boot and the configuration file will be deleted. Keep a backup of the
104-
# file if you want to reuse it at a later time (clean ROM flash, etc).
105-
106-
# For more information, see the documentation:
107-
# https://github.com/Magisk-Modules-Repo/MagiskHide-Props-Config/blob/master/README.md
108-
# and the support thread @ XDA Developers:
109-
# https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228
149+
# list update. See the module documentation for more details. Set to "true" or "false".

0 commit comments

Comments
 (0)