Skip to content

Commit 34307ed

Browse files
Add files via upload
1 parent 50249f6 commit 34307ed

File tree

9 files changed

+1841
-12
lines changed

9 files changed

+1841
-12
lines changed

META-INF/com/google/android/update-binary

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ $POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
136136
# service mode scripts
137137
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
138138

139+
# Module boot script placement and backup, etc
140+
script_install
141+
139142
ui_print "- Setting permissions"
140143
set_permissions
141144

README.md

Lines changed: 77 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,81 @@
1-
# Magisk Module Template
1+
# MagiskHide Props Config
2+
## By Didgeridoohan @ XDA Developers
23

3-
This `README.md` will be shown in Magisk Manager. Place any information / changelog / notes you like.
44

5-
**Please update `README.md` if you want to submit your module to the online repo!**
5+
## Installation
6+
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.
7+
Any previous versions are kept in the first post of the [module support thread](https://forum.xda-developers.com/apps/magisk/ ).
68

7-
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).
89

9-
For more information about modules and repos, please check the [official documentations](https://github.com/topjohnwu/Magisk/blob/master/docs/modules.md)
10+
## Use
11+
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)).
12+
```
13+
su
14+
props
15+
```
16+
You can also run the command with options. Use -h or --help for details.
17+
18+
19+
## Spoofing device's fingerprint
20+
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.
21+
22+
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).
23+
24+
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.
25+
26+
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.
27+
28+
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.
29+
30+
### Finding a certified fingerprint
31+
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.
32+
```
33+
getprop ro.build.fingerprint
34+
```
35+
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.
36+
37+
### Custom fingerprints list
38+
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>`.
39+
Here's an example:
40+
```
41+
Google Nexus 6=google/shamu/shamu:7.1.1/N8I11B/4171878:user/release-keys
42+
```
43+
44+
45+
## Editing build.prop and default.prop
46+
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.
47+
48+
49+
## Set/reset MagiskHide Sensitive props
50+
By default, if MagiskHide detects certain sensitive prop values they will be changed to known safe values. These are currently:
51+
- ro.debuggable (set to "0" by MagiskHide - sensitive value is "1")
52+
- ro.secure (set to "1" by MagiskHide - sensitive value is "0")
53+
- ro.build.type (set to "user" by MagiskHide - sensitive value is "userdebug")
54+
- ro.build.tags (set to "release-keys" by MagiskHide - sensitive value is "test-keys")
55+
- ro.build.selinux (set to "0" by MagiskHide - sensitive value is "1")
56+
57+
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.
58+
59+
You can also use this module to set these props to your preferred value with MagiskHide disabled.
60+
61+
62+
## Miscellaneous
63+
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)...
64+
65+
66+
## Support, etc
67+
If you're having issues, questions or suggestions, visit the [module support thread](https://forum.xda-developers.com/apps/magisk/ ) @XDA.
68+
69+
70+
## Source
71+
[GitHub](https://github.com/Didgeridoohan/MagiskHide-Props-Config)
72+
73+
74+
## Credits
75+
@topjohnwu @ XDA Developers, for Magisk
76+
@Zackptg5 and @veez21 @ XDA Developers, for inspiration
77+
78+
79+
## Changelog
80+
### v1.0.0
81+
- Initial release. Compatible with Magisk v15+.

common/post-fs-data.sh

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,194 @@ MODDIR=${0%/*}
55

66
# This script will be executed in post-fs-data mode
77
# More info in the main Magisk thread
8+
9+
# MagiskHide Props Config
10+
# By Didgeridoohan @ XDA-Developers
11+
12+
# Variables
13+
IMGPATH=$(dirname "$MODDIR")
14+
LASTLOGFILE=/cache/propsconf_last.log
15+
BIN=BIN_PLACEHOLDER
16+
USNFLIST=USNF_PLACEHOLDER
17+
18+
# Load functions
19+
. $MODDIR/util_functions.sh
20+
21+
MODVERSION=$(get_file_value $MODDIR/module.prop "version=")
22+
23+
# Saves the previous log (if available) and creates a new one
24+
if [ -f "$LOGFILE" ]; then
25+
mv -f $LOGFILE $LASTLOGFILE
26+
fi
27+
touch $LOGFILE
28+
echo "***************************************************" >> $LOGFILE
29+
echo "******** MagiskHide Props Config $MODVERSION ********" >> $LOGFILE
30+
echo "**************** By Didgeridoohan ***************" >> $LOGFILE
31+
echo "***************************************************" >> $LOGFILE
32+
log_handler "Log start."
33+
34+
# Check for boot scripts, restore backup if deleted
35+
if [ ! -f "$LATEFILE" ]; then
36+
cp -af $MODDIR/propsconf_late $LATEFILE
37+
chmod 755 $LATEFILE
38+
log_handler "Boot script restored."
39+
fi
40+
41+
# Update placeholders in util_functions.sh
42+
# Image path
43+
placeholder_update $LATEFILE IMGPATH IMG_PLACEHOLDER $IMGPATH
44+
placeholder_update $MODDIR/system/$BIN/props IMGPATH IMG_PLACEHOLDER $IMGPATH
45+
# Module version
46+
placeholder_update $MODDIR/system/$BIN/props MODVERSION VER_PLACEHOLDER $MODVERSION
47+
48+
# Check the reboot variable
49+
if [ "$(get_file_value $LATEFILE "REBOOTCHK=")" == 1 ]; then
50+
sed -i 's/REBOOTCHK=1/REBOOTCHK=0/' $LATEFILE
51+
fi
52+
53+
# Get the current values saved in propsconf_late
54+
LATEDEBUGGABLE=$(get_file_value $LATEFILE "ORIGDEBUGGABLE=")
55+
LATEFILEDEBUGGABLE=$(get_file_value $LATEFILE "FILEDEBUGGABLE=")
56+
LATESECURE=$(get_file_value $LATEFILE "ORIGSECURE=")
57+
LATEFILESECURE=$(get_file_value $LATEFILE "FILESECURE=")
58+
LATETYPE=$(get_file_value $LATEFILE "ORIGTYPE=")
59+
LATEFILETYPE=$(get_file_value $LATEFILE "FILETYPE=")
60+
LATETAGS=$(get_file_value $LATEFILE "ORIGTAGS=")
61+
LATEFILETAGS=$(get_file_value $LATEFILE "FILETAGS=")
62+
LATESELINUX=$(get_file_value $LATEFILE "ORIGSELINUX=")
63+
LATEFILESELINUX=$(get_file_value $LATEFILE "FILESELINUX=")
64+
LATEFINGERPRINT=$(get_file_value $LATEFILE "ORIGFINGERPRINT=")
65+
66+
# Get default file values
67+
FILEDEBUGGABLE=$(get_file_value /default.prop ro.debuggable)
68+
FILESECURE=$(get_file_value /default.prop ro.secure)
69+
FILETYPE=$(get_file_value /system/build.prop ro.build.type)
70+
FILETAGS=$(get_file_value /system/build.prop ro.build.tags)
71+
FILESELINUX=$(get_file_value /system/build.prop ro.build.selinux)
72+
73+
# Save default file values in propsconf_late
74+
sed -i "s/FILEDEBUGGABLE=$LATEFILEDEBUGGABLE/FILEDEBUGGABLE=$FILEDEBUGGABLE/" $LATEFILE
75+
sed -i "s/FILESECURE=$LATEFILESECURE/FILESECURE=$FILESECURE/" $LATEFILE
76+
sed -i "s/FILETYPE=$LATEFILETYPE/FILETYPE=$FILETYPE/" $LATEFILE
77+
sed -i "s/FILETAGS=$LATEFILETAGS/FILETAGS=$FILETAGS/" $LATEFILE
78+
sed -i "s/FILESELINUX=$LATEFILESELINUX/FILESELINUX=$FILESELINUX/" $LATEFILE
79+
log_handler "Default file values saved to $LATEFILE."
80+
81+
# Get the default prop values
82+
ORIGDEBUGGABLE=$(resetprop ro.debuggable)
83+
ORIGSECURE=$(resetprop ro.secure)
84+
ORIGTYPE=$(resetprop ro.build.type)
85+
ORIGTAGS=$(resetprop ro.build.tags)
86+
ORIGSELINUX=$(resetprop ro.build.selinux)
87+
ORIGFINGERPRINT=$(resetprop ro.build.fingerprint)
88+
89+
# Save defatul prop values in propsconf_late
90+
sed -i "s/ORIGDEBUGGABLE=$LATEDEBUGGABLE/ORIGDEBUGGABLE=$ORIGDEBUGGABLE/" $LATEFILE
91+
sed -i "s/ORIGSECURE=$LATESECURE/ORIGSECURE=$ORIGSECURE/" $LATEFILE
92+
sed -i "s/ORIGTYPE=$LATETYPE/ORIGTYPE=$ORIGTYPE/" $LATEFILE
93+
sed -i "s/ORIGTAGS=$LATETAGS/ORIGTAGS=$ORIGTAGS/" $LATEFILE
94+
sed -i "s/ORIGSELINUX=$LATESELINUX/ORIGSELINUX=$ORIGSELINUX/" $LATEFILE
95+
sed -i "s@ORIGFINGERPRINT=$LATEFINGERPRINT@ORIGFINGERPRINT=$ORIGFINGERPRINT@" $LATEFILE
96+
log_handler "Current prop values saved to $LATEFILE."
97+
98+
# Checks for the Universal SafetyNet Fix module and similar modules editing the device fingerprint
99+
PRINTMODULE=false
100+
for USNF in $USNFLIST; do
101+
if [ -d "$IMGPATH/$USNF" ]; then
102+
NAME=$(get_file_value $IMGPATH/$USNF/module.prop "name=")
103+
log_handler "'$NAME' installed (modifies the device fingerprint)."
104+
PRINTMODULE=true
105+
fi
106+
done
107+
if [ "$PRINTMODULE" == "true" ]; then
108+
sed -i 's/FINGERPRINTENB=1/FINGERPRINTENB=0/' $LATEFILE
109+
log_handler "Fingerprint modification disabled."
110+
else
111+
sed -i 's/FINGERPRINTENB=0/FINGERPRINTENB=1/' $LATEFILE
112+
if [ "$(get_file_value $LATEFILE "FINGERPRINTENB=")" == 1 ]; then
113+
log_handler "Fingerprint modification enabled."
114+
else
115+
log_handler "Fingerprint modification disabled."
116+
fi
117+
fi
118+
119+
# Check if original file values are safe
120+
sed -i 's/FILESAFE=0/FILESAFE=1/' $LATEFILE
121+
for V in $PROPSLIST; do
122+
PROP=$(get_prop_type $V)
123+
FILEPROP=$(echo "FILE$PROP" | tr '[:lower:]' '[:upper:]')
124+
FILEVALUE=$(eval "echo \$$FILEPROP")
125+
log_handler "Checking $FILEPROP=$FILEVALUE"
126+
safe_props $V $FILEVALUE
127+
if [ "$SAFE" == 0 ]; then
128+
log_handler "Prop $V set to triggering value in prop file."
129+
sed -i 's/FILESAFE=1/FILESAFE=0/' $LATEFILE
130+
else
131+
log_handler "Prop $V set to \"safe\" value in prop file."
132+
fi
133+
done
134+
135+
if [ "$(get_file_value $LATEFILE "FILESAFE=")" == 0 ]; then
136+
# Checks if any other modules are using a local copy of build.prop
137+
BUILDMODULE=false
138+
MODID=$(get_file_value $MODDIR/module.prop "id=")
139+
for D in $(ls $IMGPATH); do
140+
if [ $D != "$MODID" ]; then
141+
if [ -f "$IMGPATH/$D/system/build.prop" ]; then
142+
NAME=$(get_file_value $IMGPATH/$D/module.prop "name=")
143+
log_handler "Conflicting build.prop editing in module '$NAME'."
144+
BUILDMODULE=true
145+
fi
146+
fi
147+
done
148+
if [ "$BUILDMODULE" == "true" ]; then
149+
sed -i 's/BUILDPROPENB=1/BUILDPROPENB=0/' $LATEFILE
150+
else
151+
sed -i 's/BUILDPROPENB=0/BUILDPROPENB=1/' $LATEFILE
152+
fi
153+
154+
# Copies the stock build.prop to the module. Only if set in propsconf_late.
155+
if [ "$(get_file_value $LATEFILE "BUILDPROPENB=")" == 1 ] && [ "$(get_file_value $LATEFILE "BUILDEDIT=")" == 1 ]; then
156+
log_handler "Build.prop editing enabled."
157+
cp /system/build.prop $MODDIR/system/build.prop
158+
log_handler "Stock build.prop copied from /system."
159+
160+
# Edits the module copy of build.prop
161+
MODULETYPE=$(get_file_value $LATEFILE "MODULETYPE=")
162+
MODULETAGS=$(get_file_value $LATEFILE "MODULETAGS=")
163+
MODULESELINUX=$(get_file_value $LATEFILE "MODULESELINUX=")
164+
log_handler "Editing build.prop."
165+
if [ "$MODULETYPE" ]; then
166+
SEDTYPE=$MODULETYPE
167+
else
168+
SEDTYPE=user
169+
fi
170+
if [ "$(get_file_value $LATEFILE "SETTYPE=")" == "true" ]; then
171+
sed -i "s/ro.build.type=$FILETYPE/ro.build.type=$SEDTYPE/" $MODDIR/system/build.prop && log_handler "ro.build.type"
172+
fi
173+
if [ "$MODULETAGS" ]; then
174+
SEDTAGS=$MODULETAGS
175+
else
176+
SEDTAGS=release-keys
177+
fi
178+
if [ "$(get_file_value $LATEFILE "SETTAGS=")" == "true" ]; then
179+
sed -i "s/ro.build.tags=$FILETAGS/ro.build.tags=$SEDTAGS/" $MODDIR/system/build.prop && log_handler "ro.build.tags"
180+
fi
181+
if [ "$MODULESELINUX" ]; then
182+
SEDSELINUX=$MODULESELINUX
183+
else
184+
SEDSELINUX=0
185+
fi
186+
if [ "$(get_file_value $LATEFILE "SETSELINUX=")" == "true" ]; then
187+
sed -i "s/ro.build.selinux=$FILESELINUX/ro.build.selinux=$SEDSELINUX/" $MODDIR/system/build.prop && log_handler "ro.build.selinux"
188+
fi
189+
else
190+
rm -f $MODDIR/system/build.prop
191+
log_handler "Build.prop editing disabled."
192+
fi
193+
else
194+
rm -f $MODDIR/system/build.prop
195+
log_handler "Prop file editing disabled. All values ok."
196+
fi
197+
198+
log_handler "post-fs-data.sh finished.\n\n===================="

common/prints.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/system/bin/sh
2+
3+
# MagiskHide Props Config
4+
# By Didgeridoohan @ XDA-Developers
5+
6+
PRINTSFILE=/sdcard/printslist
7+
8+
# Certified fingerprints
9+
PRINTSLIST="
10+
Google Nexus 6=google/shamu/shamu:7.1.1/N8I11B/4171878:user/release-keys
11+
Google Pixel 2 XL=google/taimen/taimen:8.1.0/OPM1.171019.013/4474084:user/release-keys
12+
OnePlus 3T=OnePlus/OnePlus3/OnePlus3T:8.0.0/OPR6.170623.013/12041042:user/release-keys
13+
OnePlus 5T=OnePlus/OnePlus5T/OnePlus5T:7.1.1/NMF26X/12152312:user/release-keys
14+
Samsung S8 Plus=samsung/dream2ltexx/dream2lte:7.0/NRD90M/G955FXXU1AQGB:user/release-keys
15+
Xiaomi Mi6=Xiaomi/sagit/sagit:7.1.1/NMF26X/V8.2.17.0.NCACNEC:user/release-keys
16+
"
17+
18+
if [ -f "$PRINTSFILE" ]; then
19+
FLINE=$(head -1 $PRINTSFILE)
20+
if [ "$FLINE" ]; then
21+
sed -i '1s/^/\n/' $PRINTSFILE
22+
fi
23+
LISTFILE=$(cat $PRINTSFILE)
24+
PRINTSLIST=$PRINTSLIST$LISTFILE
25+
fi

0 commit comments

Comments
 (0)