├── .gitignore ├── README.md ├── aik_mHideGP.sh ├── certified.list ├── concat_mHideGP.sh ├── get_cert_list.sh ├── mHideGP.sh └── prop_mHideGP.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore (MacOS finder) 2 | .DS_Store* 3 | 4 | # ignore out directory 5 | out/* 6 | 7 | # ignore mk and xfiles 8 | mk_* 9 | x_* 10 | xfiles/* 11 | 12 | # ignore backup and zip files. 13 | *.backup 14 | *.zip 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## mHide Get Props 2 | Originally (and still) written to be used with MagiskHide Props Config Magisk module. 3 | 4 | The main purpose of mHideGP is to gather prop values from a stock boot image, stock recovery image, stock prop file or the device itself. 5 | 6 | mHideGP will generate a file named _mhp_Brand_Model_BuildDateTime_ or _mhp_Model_BuildDateTime_ depending on the device. 7 | The _mhp_ file will contain the system build fingerprint, security date and other needed and useful device props. 8 | 9 | The mhp file is formatted to be used as a custom fingerprint list for the MagiskHide Props Config module. 10 | _You will need to rename the mhp file to ```printslist``` 11 | See the MagiskHide Props Config instructions on using a custom fingerprint list._ 12 | [_Custom fingerprints list_](https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf/blob/master/README.md#custom-fingerprints-list) 13 | 14 | If a boot or recovery image is used, you will need to unpack the image file first. 15 | mHideGP relies on the use of _Android Image Kitchen (AIK)_ by osm0sis for unpacking a boot or recovery image. 16 | _If used with a different method to unpack an image file, make sure to make changes in the script file(s) accordingly._ 17 | 18 | Information and download links for Android Image Kitchen and MagiskHide Props Config, can be found on xda-Developers. 19 | [_Android Image Kitchen (AIK)_](https://forum.xda-developers.com/showthread.php?t=2073775) by osm0sis. 20 | [_MagiskHide Props Config_](https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228) by Didgeridoohan. 21 | 22 | --- 23 | 24 | ### Scripts 25 | 26 | **mHideGP** 27 | 28 | This script will create a file with the device properties that are useful to use with MagiskHide Props Config. 29 | It will look for a device prop file to read and generate a file named _mhp_Brand_Model_BuildDateTime_ or _mhp_Model_BuildDateTime_. 30 | If a ramdisk directory exists, it will first check there for a file named _prop.default_ or _default.prop_. 31 | If a ramdisk directory does not exist, or there is no prop file to use, it will then check for a _build.prop_, _prop.default_, _default.prop_ or _getprop.props_ file in the current directory. 32 | 33 | When run on an Android device, it will still check for a device prop file. If no prop file is found, it will generate a _getprop.props_ file from the device it is running on using the _getprop_ command. 34 | 35 | 36 | **concat_mHideGP** 37 | 38 | This script will merge all the _mhp_ files created by mHideGP into a new file named _mHide-printslist-CurrentDate_. 39 | 40 | 41 | **aik_mHideGP** 42 | 43 | This script will use AIK's unpackimg and cleanup scripts along with the mHideGP script. 44 | 45 | It will run AIK's unpackimg script to unpack a boot and/or recovery image, mHideGP script to generate a mhp file, then AIK's cleanup script. 46 | _It will do this for all the image files in the directory._ 47 | 48 | After running mHideGP on the image files, it will then look for additional prop files in the AIK directory. 49 | The prop file(s) need to be named or end with, build.prop, prop.default, default.prop or getprop.props for the script to find them. 50 | 51 | It will also combine all the _mhp_ files generated by the mHideGP script into a new _mHide-printslist-CurrentDate_ file. 52 | 53 | Unlike the concat script, aik_mHideGP will **delete** the _mhp_ files as part of the cleanup portion of the script. 54 | _Backup files generated by the mHideGP script(s) are ignored and not used, merged or deleted._ 55 | 56 | - Requires Android Image Kitchen (AIK) 57 | - Requires the mHideGP script. 58 | - Recommended certified.list file. 59 | 60 | 61 | **prop_mHideGP** 62 | 63 | This script will run the mHideGP script on all prop files in the same directory. 64 | 65 | This script will look for file(s) named or ending in: build.prop default.prop prop.default or getprop.props 66 | Then run the mHideGP script on the prop files found in the current directory. 67 | 68 | It will also combine all the _mhp_ files generated by the mHideGP script into a new _mHide-printslist-CurrentDate_ file. 69 | 70 | Unlike the concat script, prop_mHideGP will **delete** the _mhp_ files as part of the cleanup portion of the script. 71 | _Backup files generated by the mHideGP script(s) are ignored and not used, merged or deleted._ 72 | 73 | - Requires the mHideGP script. 74 | - Recommended certified.list file. 75 | 76 | 77 | **get_cert_list** 78 | 79 | This script will download (curl) the public certified list html file and format it into a new file (_certified.list_) with tab spacing for the four columns. 80 | _Retail Branding_ | _Marketing Name_ | _Device_ | _Model_ 81 | 82 | It is easier and quicker to search a text file than waiting for a website based table to load. 83 | _Especially one that has over 37,000 entries._ 84 | 85 | This script currently keeps a copy of the _HMTL_ file and the corresponding _certified.list_ file as part of the backup. These backups are not necessary but only saved for reference. They are saved to a directory named _xfiles_ in the current directory. 86 | 87 | ### To Do 88 | - Fix and Finish the batch (Windows) port(s). 89 | - Finish the How-To _(Instructions)_ 90 | 91 | ### Recent changes 92 | - Maintenance and Cleanup. 93 | - Prefer _ro.build.fingerprint_ over _ro.bootimage.build.fingerprint_ by default. 94 | - Work around Android 12 (SDK31) and Android 12L (SDK32) sharing the 12 release tag. 95 | 96 | ### How to use 97 | 98 | Copy, clone or download the script(s). 99 | Each script has a header that explains the script and basic instruction. 100 | 101 | - [Instructions](https://github.com/ipdev99/mHideGP/wiki) 102 | 103 | ### Notes 104 | 105 | - Feel free to use, change, improve, adapt. 106 | - Remember to share. 107 | 108 | 109 | ### Credits 110 | - The Android Community and everyone who has helped me learn through the years. 111 | - osm0sis [_Android Image Kitchen (AIK)_](https://forum.xda-developers.com/showthread.php?t=2073775) 112 | - Didgeridoohan [_MagiskHide Props Config_](https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228) 113 | -------------------------------------------------------------------------------- /aik_mHideGP.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Pull prop settings from image files using AIK 4 | # ipdev @ xda-developers 5 | 6 | # Originally (and still) written to grab needed/useful props for use with MagiskHide Props Config module 7 | # by Didgeridoohan @ xda-developers 8 | # https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228 9 | 10 | # To pull props from a boot or recovery image file requires unpacking the image. 11 | # This script relies on Android Image Kitchen (AIK) 12 | # by osm0sis @ xda-developers 13 | # https://forum.xda-developers.com/showthread.php?t=2073775 14 | 15 | # To use. 16 | # Install AIK 17 | # Copy the boot and/or recovery image file(s) into the AIK directory 18 | # Copy aik_mHideGP.sh and mHideGP.sh into the AIK directory 19 | # Copy extra prop files into the AIK directory (optional) (See Update Note below.) 20 | # Run aik_mHideGP.sh 21 | # 22 | # This will run the unpack and mHideGP scripts on all image files in the directory. 23 | # Merge the generated mhp files into mHide-printslist-DATE.sh. 24 | # Remove all the generated mph files. 25 | 26 | # If used with another method, make sure to make changes in the script(s) accordingly. 27 | 28 | # Update Note. 29 | # This script now supports additional prop files. 30 | # It will also look for files ending in: build.prop default.prop prop.default or getprop.props 31 | # in the same (AIK) directory. 32 | # 33 | 34 | # Set variables 35 | 36 | TDIR=$(pwd) 37 | DATE=$(date '+%Y%m%d') 38 | # DATE=$(date '+%Y%m%d_%H%M') 39 | OUT=mHide-printslist-"$DATE".sh 40 | SCRIPT=aik_mHideGP.sh 41 | 42 | 43 | # Set functions 44 | 45 | add_notes() { 46 | echo "\"" >> $OUT 47 | echo "######" >> $OUT 48 | echo "## The above \" was added to close custom printslist list early." >> $OUT 49 | echo "## Just to clean it up a little. Lines below will not display on screen." >> $OUT 50 | echo "## Due to updates in Magisk and/or mHide module." >> $OUT 51 | echo "## The rest of the file is now block commented to hide/clean it up further." >> $OUT 52 | echo "######" >> $OUT 53 | } 54 | 55 | backup() { 56 | if [ -f "$OUT" ]; then 57 | FLTM=$(date -r "$OUT" '+%H%M') 58 | BACKUPFILE=$(printf "$OUT" | sed 's/.sh/.'"$FLTM"'/g') 59 | mv "$OUT" "$BACKUPFILE" 60 | fi 61 | } 62 | 63 | check_files() { 64 | echo "" 65 | if [ ! -f mHideGP.sh ]; then 66 | echo " Missing mHideGP script." 67 | echo "" 68 | exit 1; 69 | elif [ ! -f cleanup.sh ]; then 70 | echo " Missing AIK cleanup script." 71 | echo "" 72 | exit 1; 73 | elif [ ! -f unpackimg.sh ]; then 74 | echo " Missing AIK unpackimg script." 75 | echo "" 76 | exit 1; 77 | fi 78 | } 79 | 80 | concat_mhp_files() { 81 | # Add mHide fingerprint from the mhp files(s) to $OUT file. 82 | for mPrint in mhp_*.sh; do 83 | cat $mPrint | sed '1!d' >> "$OUT"; 84 | done; 85 | 86 | # Add a few notes to $OUT file. 87 | add_notes 88 | 89 | # Add all the rest of the device props from the mhp file(s) to the $OUT file. 90 | for dProps in mhp_*.sh; do 91 | cat $dProps | sed '/#/!d' | sed '/##/d' >> "$OUT"; 92 | done; 93 | } 94 | 95 | exit_0() { 96 | if [ $ANDROID = "TRUE" ]; then 97 | return 0; exit 0; 98 | else 99 | exit 0; 100 | fi 101 | } 102 | 103 | exit_1() { 104 | if [ $ANDROID = "TRUE" ]; then 105 | return 1; exit 1; 106 | else 107 | exit 1; 108 | fi 109 | } 110 | 111 | rename_prop_files() { 112 | if [ -f build.prop ]; then 113 | FLDT=$(date -r build.prop '+%Y%m%d') 114 | mv build.prop "$FLDT"_build.prop 115 | fi 116 | 117 | if [ -f prop.default ]; then 118 | FLDT=$(date -r prop.default '+%Y%m%d') 119 | mv prop.default "$FLDT"_prop.default 120 | fi 121 | 122 | if [ -f default.prop ]; then 123 | FLDT=$(date -r default.prop '+%Y%m%d') 124 | mv default.prop "$FLDT"_default.prop 125 | fi 126 | 127 | if [ -f getprop.props ]; then 128 | FLDT=$(date -r getprop.props '+%Y%m%d') 129 | mv getprop.props "$FLDT"_getprop.props 130 | fi 131 | } 132 | 133 | set_target_directory() { 134 | if [ ! -f "$SCRIPT" ]; then 135 | TDIR=$(lsof 2>/dev/null | grep -o '[^ ]*$' | grep -m1 "$SCRIPT" | sed 's/\/'"$SCRIPT"'//g'); 136 | cd $TDIR; 137 | fi 138 | } 139 | 140 | # Determine if running on an Android device or MacOS/Linux. 141 | if [ -f /system/bin/sh ] || [ -f /system/bin/toybox ] || [ -f /system/bin/toolbox ]; then 142 | # Android device 143 | ANDROID=TRUE 144 | else 145 | # MacOS/Linux 146 | ANDROID=FALSE 147 | fi 148 | 149 | # Reset and move to the target directory if needed. 150 | set_target_directory 151 | 152 | # Check for required files. 153 | check_files 154 | 155 | # Rename additional prop files if needed. 156 | rename_prop_files 157 | 158 | # Start clean 159 | "$TDIR"/cleanup.sh > /dev/null 160 | 161 | # # Extra echo just to clean up screen output. 162 | # echo "" 163 | 164 | # Unpack and run mHideGP on all image files in the current directory. 165 | if [ $ANDROID = "TRUE" ]; then 166 | # echo "-- Image Files. --"; echo ""; 167 | for image in *.img; do 168 | { 169 | echo "$image" 170 | "$TDIR"/unpackimg.sh "$image" > /dev/null 171 | if [ -f ramdisk/prop.default ] || [ -f ramdisk/default.prop ]; then 172 | sh "$TDIR"/mHideGP.sh > /dev/null 173 | elif [ ! -d ramdisk ]; then 174 | echo " No ramdisk directory found. " 175 | else 176 | echo " No prop file found. " 177 | fi; 178 | "$TDIR"/cleanup.sh > /dev/null 179 | } 180 | done 181 | fi 182 | 183 | if [ $ANDROID = "FALSE" ]; then 184 | # echo "-- Image Files. --"; echo ""; 185 | for image in *.img; do 186 | { 187 | echo "$image" 188 | "$TDIR"/unpackimg.sh "$image" > /dev/null 2>&1 189 | if [ -f ramdisk/prop.default ] || [ -f ramdisk/default.prop ]; then 190 | "$TDIR"/mHideGP.sh > /dev/null 191 | elif [ ! -d ramdisk ]; then 192 | echo " No ramdisk directory found. " 193 | else 194 | echo " No prop file found. " 195 | fi; 196 | "$TDIR"/cleanup.sh > /dev/null 197 | } 198 | done 199 | fi 200 | 201 | # Run mHideGP on additional prop files in the current directory. 202 | AdditionalPropFile=('build.prop' 'default.prop' 'prop.default' 'getprop.props') 203 | 204 | if [ $ANDROID = "TRUE" ]; then 205 | # echo ""; echo "-- Additional Prop Files. --"; echo ""; 206 | for pfile in "${AdditionalPropFile[@]}"; do 207 | { 208 | for propfile in *"$pfile"; do 209 | { 210 | if [ -f "$propfile" ]; then 211 | echo "$propfile" 212 | mv "$propfile" "$pfile" 213 | sh "$TDIR"/mHideGP.sh > /dev/null 214 | if [ -f "$pfile" ]; then 215 | mv "$pfile" "$propfile" 216 | fi; 217 | fi; 218 | } 219 | done; 220 | } 221 | done; 222 | fi; 223 | 224 | if [ $ANDROID = "FALSE" ]; then 225 | # echo ""; echo "-- Additional Prop Files. --"; echo ""; 226 | for pfile in "${AdditionalPropFile[@]}"; do 227 | { 228 | for propfile in *"$pfile"; do 229 | { 230 | if [ -f "$propfile" ]; then 231 | echo "$propfile" 232 | mv "$propfile" "$pfile" 233 | "$TDIR"/mHideGP.sh > /dev/null 234 | if [ -f "$pfile" ]; then 235 | mv "$pfile" "$propfile" 236 | fi; 237 | fi; 238 | } 239 | done; 240 | } 241 | done; 242 | fi; 243 | 244 | # Backup if needed 245 | backup 246 | 247 | # Concatenate (Merge multiple files into a new file.) 248 | ## The output file is written in order of the mhp file name(s). 249 | ## The mHideGP script will hopefully name them in the correct order. 250 | 251 | [[ -n $(find -maxdepth 1 -name 'mhp_*.sh') ]] && concat_mhp_files; 252 | 253 | # Cleanup 254 | # (Not sure if I like the echo clutter. Removed for now.) 255 | ## echo ""; echo "Removing the separate mhp file(s)."; 256 | for file in mhp_*.sh; do 257 | { 258 | ## echo $file 259 | rm $file 2>/dev/null 260 | } 261 | done 262 | 263 | # Note backup 264 | if [ -f "$BACKUPFILE" ]; then 265 | echo ""; echo "Your previous "$OUT" file was renamed to "$BACKUPFILE""; 266 | fi 267 | 268 | # Correct permissions if needed 269 | for file in mhc_*; do 270 | chmod 0664 $file 2>/dev/null 271 | done; 272 | for file in mhp_*; do 273 | chmod 0664 $file 2>/dev/null 274 | done; 275 | for file in mHide-*; do 276 | chmod 0664 $file 2>/dev/null 277 | done; 278 | for file in *.img; do 279 | chmod 0664 $file 2>/dev/null 280 | done; 281 | 282 | # Finish script 283 | if [ -f "$OUT" ]; then 284 | echo ""; echo "New mHide-printslist file saved as "$OUT""; 285 | fi; 286 | 287 | echo ""; echo "Done."; echo ""; 288 | # 289 | exit_0; 290 | -------------------------------------------------------------------------------- /concat_mHideGP.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Merge multiple mhp files into a new file. 4 | # ipdev @ xda-developers 5 | 6 | # Originally (and still) written for use with MagiskHidePropsConfig module 7 | # by Didgeridoohan @ xda-developers 8 | # https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228 9 | 10 | # This script is written to be used in conjunction with the mHideGP script to 11 | # combine multiple output mhp files into a new file. (mHide-printslist-YYYYMMDD.sh) 12 | 13 | # If you use a different method to collect prop files 14 | # Make sure to adjust this script accordingly. 15 | 16 | # Set variables 17 | TDIR=$(pwd) 18 | DATE=$(date '+%Y%m%d') 19 | # DATE=$(date '+%Y%m%d_%H%M') 20 | OUT=mHide-printslist-"$DATE".sh 21 | SCRIPT=concat_mHideGP.sh 22 | 23 | # Set functions 24 | 25 | add_notes() { 26 | echo "\"" >> $OUT 27 | echo "######" >> $OUT 28 | echo "## The above \" was added to close custom printslist list early." >> $OUT 29 | echo "## Just to clean it up a little. Lines below will not display on screen." >> $OUT 30 | echo "## Due to updates in Magisk and/or mHide module." >> $OUT 31 | echo "## The rest of the file is now block commented to hide/clean it up further." >> $OUT 32 | echo "######" >> $OUT 33 | # echo "#" >> $OUT 34 | } 35 | 36 | backup() { 37 | if [ -f "$OUT" ]; then 38 | FLTM=$(date -r "$OUT" '+%H%M') 39 | BACKUPFILE=$(printf "$OUT" | sed 's/.sh/.'"$FLTM"'/g') 40 | mv "$OUT" "$BACKUPFILE" 41 | fi 42 | } 43 | 44 | exit_0() { 45 | if [ $ANDROID = "TRUE" ]; then 46 | return 0; 47 | else 48 | exit 0; 49 | fi 50 | } 51 | 52 | exit_1() { 53 | if [ $ANDROID = "TRUE" ]; then 54 | return 1; 55 | else 56 | exit 1; 57 | fi 58 | } 59 | 60 | set_target_directory() { 61 | if [ ! -f "$SCRIPT" ]; then 62 | TDIR=$(lsof 2>/dev/null | grep -o '[^ ]*$' | grep -m1 "$SCRIPT" | sed 's/\/'"$SCRIPT"'//g'); 63 | cd $TDIR; 64 | fi 65 | } 66 | 67 | # Determine if running on an Android device or MacOS/Linux. 68 | if [ -f /system/bin/sh ] || [ -f /system/bin/toybox ] || [ -f /system/bin/toolbox ]; then 69 | # Android device 70 | ANDROID=TRUE 71 | else 72 | # MacOS/Linux 73 | ANDROID=FALSE 74 | fi 75 | 76 | # Reset and move to the target directory if needed. 77 | set_target_directory 78 | 79 | # Backup if needed 80 | backup 81 | 82 | ## No sort order logic. 83 | ## The output file is written in order of the mhp file name. 84 | ## The mHideGP script hopefully will name them in the correct order. 85 | 86 | # Add mHide fingerprint from the mhp files(s) to $OUT file. 87 | for mPrint in mhp_*.sh; do 88 | cat $mPrint | sed '1!d' >> "$OUT" 89 | done 90 | 91 | # Add a few notes to $OUT file. 92 | add_notes 93 | 94 | # Add all the rest of the device props from the mhp file(s) to the $OUT file. 95 | for dProps in mhp_*.sh; do 96 | cat $dProps | sed '/#/!d' | sed '/##/d' >> "$OUT" 97 | done 98 | 99 | # Cleanup 100 | 101 | # Note backup 102 | if [ -f "$BACKUPFILE" ]; then 103 | echo ""; echo "Your previous "$OUT" file was renamed to "$BACKUPFILE""; echo ""; 104 | fi 105 | 106 | # Correct permissions if needed 107 | for file in mhc_*; do 108 | chmod 0664 $file 2>/dev/null 109 | done; 110 | for file in mhp_*; do 111 | chmod 0664 $file 2>/dev/null 112 | done; 113 | for file in mHide-*; do 114 | chmod 0664 $file 2>/dev/null 115 | done; 116 | for file in *.img; do 117 | chmod 0664 $file 2>/dev/null 118 | done; 119 | 120 | # Finish script 121 | echo "New mHide-printslist file saved as "$OUT"" 122 | echo ""; echo "Done."; echo ""; 123 | # 124 | exit_0; 125 | -------------------------------------------------------------------------------- /get_cert_list.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Pull (curl) and convert google's public certified device list into a usable file. 4 | # ipdev @ xda-developers 5 | 6 | # Tested on Linux (fedora 32) and MacOS (v10.13.6) 7 | 8 | # Set variables 9 | 10 | TDIR=$(pwd) 11 | DATE=$(date '+%Y%m%d') 12 | # DATE=$(date '+%Y%m%d_%H%M') 13 | RAW="$DATE"_supported_devices.html 14 | OUT="$DATE"_certified.list 15 | TARGET=certified.list 16 | 17 | 18 | # Set functions 19 | 20 | backup() { 21 | if [ -f "$TARGET" ]; then 22 | FLTM=$(date -r "$TARGET" '+%H%M') 23 | FLDT=$(date -r "$TARGET" '+%Y%m%d') 24 | BACKUPFILE=$(printf "$TARGET" | sed 's/^/'"$FLDT"'_/g; s/.list/_list.'"$FLTM"'/g') 25 | mv "$TARGET" "$BACKUPFILE" 26 | fi 27 | } 28 | 29 | # Remove space(s) and tabs at the beginning of line and in-between html tags 30 | sed2() { 31 | sed ' 32 | s/^[ \t]*//g 33 | s/> * and Replace html tags and to < and to > 38 | sed3() { 39 | sed ' 40 | s///g 41 | s///g 42 | s/<\/th>///>/g 45 | ' 46 | } 47 | 48 | # Tab and newline are done with translate (tr '<' '\t' | tr '>' '\n') 49 | # # Replace html tag with new line 50 | # sed4() { 51 | # sed ' 52 | # s/<\/tr>/\n/g 53 | # ' 54 | # } 55 | 56 | # Remove '<' at end of line and remove empty lines. 57 | sed5() { 58 | sed ' 59 | s/<$//g 60 | /^$/d 61 | ' 62 | } 63 | 64 | # Replace html special characters 65 | sed6() { 66 | sed ' 67 | s/\&/\&/g 68 | s/\"/\"/g 69 | s/\'/'\''/g 70 | ' 71 | } 72 | 73 | # Check and make xfiles directory if needed 74 | if [ ! -d xfiles ]; then 75 | mkdir xfiles 76 | fi; 77 | 78 | # Backup if needed 79 | FLDT=$(date -r "$TARGET" '+%Y%m%d') 80 | if [ -f "$TARGET" ]; then 81 | if [ ! -f xfiles/"$FLDT"_certified.list ]; then 82 | backup 83 | fi; 84 | fi; 85 | 86 | # Pull public certified device list. 87 | curl https://storage.googleapis.com/play_public/supported_devices.html -o "$RAW" 88 | 89 | # Convert html table to a usable list. tr --delete, sed '\n' and sed '\t' did not work on MacOS. 90 | grep -B4 '' $RAW | sed '/--/d' | tr -d '\n' | sed2 | sed3 | tr '>' '\n' | sed5 | tr '<' '\t' | sed6 | tee $OUT 91 | 92 | # Copy to target 93 | cp $OUT $TARGET 94 | 95 | # Move files to xfiles 96 | mv "$RAW" xfiles/ 97 | mv "$OUT" xfiles/ 98 | 99 | # # Correct permissions 100 | # chmod 0644 "$OUT" 101 | 102 | # Check for backup. 103 | if [ -f "$BACKUPFILE" ]; then 104 | echo ""; echo "Your previous "$TARGET" file was renamed to "$BACKUPFILE""; echo ""; 105 | mv "$BACKUPFILE" xfiles/ 106 | # chmod 0644 "$BACKUPFILE" 107 | fi 108 | 109 | # Finish script 110 | echo ""; echo "New Certified list file saved as "$TARGET""; 111 | echo ""; echo "Done."; echo ""; 112 | # 113 | exit 0; 114 | -------------------------------------------------------------------------------- /mHideGP.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Pull prop settings from device/image files 4 | # ipdev @ xda-developers 5 | 6 | # Originally (and still) written to grab needed/useful props for use with MagiskHidePropsConfig module 7 | # by Didgeridoohan @ xda-developers 8 | # https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228 9 | 10 | # To pull props from a boot or recovery image file requires unpacking the image. 11 | # This script relies on Android Image Kitchen (AIK) 12 | # by osm0sis @ xda-developers 13 | # https://forum.xda-developers.com/showthread.php?t=2073775 14 | 15 | # To use a boot or recovery image file. (Android, Linux and MacOS) 16 | # Install AIK 17 | # Copy the boot or recovery image files into the AIK directory 18 | # Copy mHideGP.sh into the AIK directory 19 | # Unpack a boot/recovery image 20 | # Run mHideGP.sh 21 | # Run the cleanup script 22 | # 23 | # If used with another method, make sure to make changes in the script accordingly. 24 | 25 | # To use on a stock device. (Android) 26 | # Note: This will generate a getprops.prop file along with the mhp file. 27 | # Copy this script to the device. 28 | # Run from adb shell (or a terminal app) using the sh command. 29 | # sh mHideGP.sh 30 | # Run from a file manager that is able to execute a script file. 31 | # Note: May or may not work depending on file manager.. 32 | 33 | # To use with a prop file. (Android, Linux and MacOS) 34 | # Copy this script and a build.prop, default.prop, prop.default or getprop.props 35 | # file into the same directory. 36 | # Run mHideGP.sh 37 | # 38 | 39 | # Set main variables 40 | 41 | DATE=$(date '+%Y%m%d') 42 | # DATE=$(date '+%Y%m%d_%H%M') 43 | TDIR=$(pwd) 44 | SCRIPT=mHideGP.sh 45 | 46 | # Set main functions 47 | 48 | set_target_directory() { 49 | if [ ! -f "$SCRIPT" ]; then 50 | TDIR=$(lsof 2>/dev/null | grep -o '[^ ]*$' | grep -m1 "$SCRIPT" | sed 's/\/'"$SCRIPT"'//g'); 51 | cd $TDIR; 52 | fi 53 | } 54 | 55 | exit_0() { 56 | if [[ ! -z $ANDROID ]]; then 57 | return 0; exit 0; 58 | else 59 | exit 0; 60 | fi 61 | } 62 | 63 | # exit_1() { 64 | # if [[ ! -z $ANDROID ]]; then 65 | # return 1; exit 1; 66 | # else 67 | # exit 1; 68 | # fi 69 | # } 70 | 71 | # Set additional functions 72 | 73 | check_for_sdk() { 74 | if [ "$SDK" = "" ]; then 75 | echo " " 76 | echo " No SDK level found. " 77 | echo " You may need to use a recovery.img instead. " >&2 78 | echo " " 79 | fi 80 | } 81 | 82 | backup() { 83 | if [ -f "$MHGP" ]; then 84 | FLTM=$(date -r "$MHGP" '+%H%M') 85 | BACKUPFILE=$(printf "$MHGP" | sed 's/.sh/.'"$FLTM"'/g') 86 | mv "$MHGP" "$BACKUPFILE" 87 | fi 88 | } 89 | 90 | set_prop_file() { 91 | prop_file=ABORT 92 | 93 | if [ -f ramdisk/prop.default ]; then 94 | prop_file=ramdisk/prop.default 95 | elif [ -f ramdisk/default.prop ]; then 96 | prop_file=ramdisk/default.prop 97 | elif [ -f build.prop ]; then 98 | prop_file=build.prop 99 | elif [ -f prop.default ]; then 100 | prop_file=prop.default 101 | elif [ -f default.prop ]; then 102 | prop_file=default.prop 103 | elif [ -f getprop.props ]; then 104 | prop_file=getprop.props 105 | elif [ "$ANDROID" = "TRUE" ]; then 106 | getprop | sed 's/\]: \[/=/g; s/\[//g; s/\]//g' > getprop.props 107 | if [ -f getprop.props ]; then 108 | prop_file=getprop.props 109 | fi; 110 | fi; 111 | } 112 | 113 | check_prop_file() { 114 | if [ "$prop_file" = "ABORT" ]; then 115 | echo " " 116 | echo " No prop file found. " >&2 117 | echo " Aborting ... " 118 | echo " " 119 | exit 1; 120 | fi 121 | } 122 | 123 | ignore_prop_file() { 124 | if [ ! "$BRAND" ]; then 125 | echo " " 126 | echo " Device Brand was not found. " >&2 127 | echo " This prop file is ignored. " >&2 128 | echo " Aborting ... " 129 | echo " " 130 | exit 1; 131 | fi; 132 | 133 | if [ ! "$MODL" ]; then 134 | echo " " 135 | echo " Device Model was not found. " >&2 136 | echo " This prop file is ignored. " >&2 137 | echo " Aborting ... " 138 | echo " " 139 | exit 1; 140 | fi; 141 | } 142 | 143 | rename_prop_files() { 144 | if [ -f build.prop ]; then 145 | # echo "" 146 | mv build.prop "$APFN"-build.prop 147 | echo " build.prop file has been renamed to "$APFN"-build.prop" 148 | echo " Keep it or delete it as you wish.." 149 | fi 150 | 151 | if [ -f prop.default ]; then 152 | # echo "" 153 | mv prop.default "$APFN"-prop.default 154 | echo " prop.default file has been renamed as "$APFN"-prop.default" 155 | echo " Keep it or delete it as you wish.." 156 | fi 157 | 158 | if [ -f default.prop ]; then 159 | # echo "" 160 | mv default.prop "$APFN"-default.prop 161 | echo " default.prop file has been renamed as "$APFN"-default.prop" 162 | echo " Keep it or delete it as you wish.." 163 | fi 164 | 165 | if [ -f getprop.props ]; then 166 | # echo "" 167 | mv getprop.props "$APFN"-getprop.props 168 | echo " getprop.props file has been renamed as "$APFN"-getprop.props" 169 | echo " Keep it or delete it as you wish.." 170 | fi 171 | } 172 | 173 | get_prop_info() { 174 | grep ro.oxygen.version $prop_file 175 | # grep ro.build.date $prop_file 176 | grep ro.bootimage.build.fingerprint $prop_file 177 | grep ro.build.description $prop_file 178 | grep ro.build.fingerprint $prop_file 179 | grep ro.build.version.oplusrom $prop_file 180 | grep ro.build.version.release $prop_file 181 | grep ro.build.version.sdk $prop_file 182 | grep ro.display.series $prop_file 183 | grep ro.product.device $prop_file 184 | grep ro.product.brand $prop_file 185 | grep ro.product.manufacturer $prop_file 186 | grep ro.product.model $prop_file 187 | grep ro.product.name $prop_file 188 | grep ro.system.build.fingerprint $prop_file 189 | grep ro.product.system $prop_file 190 | grep ro.build.product $prop_file 191 | # grep ro.build.version.incremental $prop_file 192 | grep ro.vendor.build.fingerprint $prop_file 193 | grep ro.vendor.build.security_patch $prop_file 194 | # grep ro.vendor.build $prop_file 195 | grep ro.product.vendor $prop_file 196 | grep ro.odm.build.fingerprint $prop_file 197 | grep ro.product.odm $prop_file 198 | grep ro.product.build.fingerprint $prop_file 199 | grep ro.product.product $prop_file 200 | grep ro.boot.hardware.sku $prop_file 201 | } 202 | 203 | get_prop_secure() { 204 | grep ro.oem_unlock_supported $prop_file 205 | grep ro.adb.secure $prop_file 206 | grep ro.debuggable $prop_file 207 | grep ro.secure $prop_file 208 | grep ro.build.tags $prop_file 209 | grep ro.build.type $prop_file 210 | grep ro.system.build.tags $prop_file 211 | grep ro.system.build.type $prop_file 212 | grep ro.vendor.build.tags $prop_file 213 | grep ro.vendor.build.type $prop_file 214 | grep ro.odm.build.tags $prop_file 215 | grep ro.odm.build.type $prop_file 216 | grep ro.product.build.tags $prop_file 217 | grep ro.product.build.type $prop_file 218 | } 219 | 220 | # get_prop_device() { 221 | # # grep PROP $prop_file 222 | # } 223 | 224 | add_notes() { 225 | echo "\"" >> $MHGP 226 | echo "######" >> $MHGP 227 | echo "## The above \" was added to close custom printslist list early." >> $MHGP 228 | echo "## Just to clean it up a little. Lines below will not display on screen." >> $MHGP 229 | echo "## Due to updates in Magisk and/or mHide module." >> $MHGP 230 | echo "## The rest of the file is now block commented to hide/clean it up further." >> $MHGP 231 | echo "######" >> $MHGP 232 | echo "#" >> $MHGP 233 | echo "#" >> $MHGP 234 | } 235 | 236 | add_device_title() { 237 | if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then 238 | echo "# "$MODL" [Build Date - "$BDATE"]" >> $MHGP 239 | elif [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then 240 | if grep -q ro.display.series $prop_file; then 241 | echo "# "$OPDSPLY" ["$OPMDL"] [Build Date - "$BDATE"]" >> $MHGP 242 | else 243 | echo "# "$DEVICE" ["$OPMDL"] [Build Date - "$BDATE"]" >> $MHGP 244 | fi; 245 | elif [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then 246 | echo "# "$MODL" [Build Date - "$BDATE"]" >> $MHGP 247 | elif [ "$BRAND" = "SAMSUNG" ] || [ "$BRAND" = "samsung" ]; then 248 | echo "# Samsung "$MODL" [Build Date - "$BDATE"]" >> $MHGP 249 | 250 | else 251 | echo "# "$BRAND" "$MODL" [Build Date - "$BDATE"]" >> $MHGP 252 | fi; 253 | } 254 | 255 | 256 | # Determine if running on an Android device. 257 | [ -f /system/bin/sh ] || [ -f /system/bin/toybox ] || [ -f /system/bin/toolbox ] && ANDROID=TRUE; 258 | 259 | # Reset and move to the target directory if needed. 260 | set_target_directory 261 | 262 | # Set prop file to use. 263 | set_prop_file 264 | 265 | # Make sure prop file set. 266 | check_prop_file 267 | 268 | # Set variables 269 | SDATE=$(grep -m1 ro.build.version.security_patch= $prop_file | cut -f2 -d '='); 270 | # aOS=$(grep -m1 ro.build.version.release= $prop_file | cut -f2 -d '='); 271 | SDK=$(grep -m1 ro.build.version.sdk= $prop_file | cut -f2 -d '='); 272 | BUTC=$(grep -m1 ro.build.date.utc= $prop_file | cut -f2 -d '='); 273 | # Add sed to remove double space in some build dates. 274 | BDATE=$(grep -m1 ro.build.date= $prop_file | sed 's/ / /g' | cut -f2,3,6 -d ' '); 275 | 276 | # Work around SDK31 and SDK32 sharing the 12 release tag. 277 | if [ "$SDK" = "32" ]; then 278 | aOS=12L; 279 | else 280 | aOS=$(grep -m1 ro.build.version.release= $prop_file | cut -f2 -d '='); 281 | fi 282 | 283 | # Set variable names to variables. (Depends on the device and/or API/SDK/NDK version.) 284 | 285 | # if grep -q ro.product.name= $prop_file; then 286 | # NAME=$(grep -m1 ro.product.name= $prop_file | cut -f2 -d '='); 287 | # else 288 | # NAME=$(grep -m1 ro.product.vendor.name= $prop_file | cut -f2 -d '='); 289 | # fi 290 | 291 | if grep -q ro.build.fingerprint= $prop_file; then 292 | BPRINT=$(grep -m1 ro.build.fingerprint= $prop_file | cut -f2 -d '='); 293 | elif grep -q ro.bootimage.build.fingerprint= $prop_file; then 294 | BPRINT=$(grep -m1 ro.bootimage.build.fingerprint= $prop_file | cut -f2 -d '='); 295 | else 296 | BPRINT=$(grep -m1 ro.system.build.fingerprint= $prop_file | cut -f2 -d '='); 297 | fi 298 | 299 | if grep -q ro.product.model= $prop_file; then 300 | MODL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '='); 301 | elif grep -q ro.product.vendor.model= $prop_file; then 302 | MODL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '='); 303 | else 304 | MODL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '='); 305 | fi 306 | 307 | if grep -q ro.product.manufacturer= $prop_file; then 308 | MANF=$(grep -m1 ro.product.manufacturer= $prop_file | cut -f2 -d '='); 309 | elif grep -q ro.product.vendor.manufacturer= $prop_file; then 310 | MANF=$(grep -m1 ro.product.vendor.manufacturer= $prop_file | cut -f2 -d '='); 311 | else 312 | MANF=$(grep -m1 ro.product.system.manufacturer= $prop_file | cut -f2 -d '='); 313 | fi 314 | 315 | if grep -q ro.product.brand= $prop_file; then 316 | BRAND=$(grep -m1 ro.product.brand= $prop_file | cut -f2 -d '='); 317 | elif grep -q ro.product.system.brand= $prop_file; then 318 | BRAND=$(grep -m1 ro.product.system.brand= $prop_file | cut -f2 -d '='); 319 | else 320 | BRAND=$(grep -m1 ro.product.vendor.brand= $prop_file | cut -f2 -d '='); 321 | fi 322 | 323 | if grep -q ro.product.device= $prop_file; then 324 | DEVICE=$(grep -m1 ro.product.device= $prop_file | cut -f2 -d '='); 325 | elif grep -q ro.product.product.device= $prop_file; then 326 | DEVICE=$(grep -m1 ro.product.product.device= $prop_file | cut -f2 -d '='); 327 | elif grep -q ro.product.system.device= $prop_file; then 328 | DEVICE=$(grep -m1 ro.product.system.device= $prop_file | cut -f2 -d '='); 329 | elif grep -q ro.product.vendor.device= $prop_file; then 330 | DEVICE=$(grep -m1 ro.product.vendor.device= $prop_file | cut -f2 -d '='); 331 | else 332 | DEVICE=$(grep -m1 ro.build.product= $prop_file | cut -f2 -d '='); 333 | fi 334 | 335 | if grep -q ro.display.series= $prop_file; then 336 | DSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '='); 337 | fi 338 | 339 | # Set DMDL (Device Model) currently only used for Poco and Redmi. 340 | if grep -q ro.product.model= $prop_file; then 341 | DMDL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' '); 342 | elif grep -q ro.product.vendor.model= $prop_file; then 343 | DMDL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' '); 344 | else 345 | DMDL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | cut -f1 -d' '); 346 | fi 347 | 348 | # Check and ignore if certain values can not be determined. 349 | ## Still need to work on this. 350 | ## Maybe set main MHGP values (and/or MHGP file name values) to unknown when not found so an alternative MHGP file can still be generated? 351 | ignore_prop_file 352 | 353 | # Brand/Device specific 354 | 355 | if [ $BRAND = "OnePlus" ] || [ $BRAND = "oneplus" ]; then 356 | if grep -q ro.display.series= $prop_file; then 357 | OPDSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '='); 358 | fi; 359 | 360 | if grep -q ro.product.model= $prop_file; then 361 | OPMDL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " "); 362 | elif grep -q ro.product.system.model= $prop_file; then 363 | OPMDL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " "); 364 | else 365 | OPMDL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | cut -f2 -d " "); 366 | fi; 367 | fi; 368 | 369 | # Set variables for use in naming the $MHGP file. 370 | # Remove spaces and change all to lowercase so the mhp_ file(s) should list in the correct order 371 | # when using the concat script. 372 | 373 | if grep -q ro.product.device= $prop_file; then 374 | LDEVICE=$(grep -m1 ro.product.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 375 | elif grep -q ro.product.system.device= $prop_file; then 376 | LDEVICE=$(grep -m1 ro.product.system.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 377 | elif grep -q ro.product.vendor.device= $prop_file; then 378 | LDEVICE=$(grep -m1 ro.product.vendor.device= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 379 | else 380 | LDEVICE=$(grep -m1 ro.build.product= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 381 | fi 382 | 383 | # if grep -q ro.product.name $prop_file; then 384 | # LNAM=$(grep -m1 ro.product.name= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 385 | # else 386 | # LNAM=$(grep -m1 ro.product.vendor.name= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 387 | # fi 388 | 389 | if grep -q ro.product.model= $prop_file; then 390 | LMODL=$(grep -m1 ro.product.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]); 391 | elif grep -q ro.product.vendor.model= $prop_file; then 392 | LMODL=$(grep -m1 ro.product.vendor.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]); 393 | else 394 | LMODL=$(grep -m1 ro.product.system.model= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]); 395 | fi 396 | 397 | if grep -q ro.product.brand= $prop_file; then 398 | LBRND=$(grep -m1 ro.product.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 399 | elif grep -q ro.product.system.brand= $prop_file; then 400 | LBRND=$(grep -m1 ro.product.system.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 401 | else 402 | LBRND=$(grep -m1 ro.product.vendor.brand= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 403 | fi 404 | 405 | if grep -q ro.display.series= $prop_file; then 406 | LDSPLY=$(grep -m1 ro.display.series= $prop_file | cut -f2 -d '=' | sed 's/ /_/g' | tr [:upper:] [:lower:]); 407 | fi 408 | 409 | if grep -q ro.product.manufacture= $prop_file; then 410 | LMAN=$(grep -m1 ro.product.manufacture= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 411 | elif grep -q ro.product.vendor.manufacturer= $prop_file; then 412 | LMAN=$(grep -m1 ro.product.vendor.manufacturer= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 413 | else 414 | LMAN=$(grep -m1 ro.product.system.manufacturer= $prop_file | cut -f2 -d '=' | tr [:upper:] [:lower:]); 415 | fi 416 | 417 | # Set MHGP file name. 418 | 419 | # Generic 420 | MHGP="$TDIR"/mhp_"$LBRND"_"$LMODL"_"$BUTC".sh 421 | 422 | # Google 423 | if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then 424 | MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh 425 | fi; 426 | 427 | # OnePlus 428 | if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then 429 | MHGP="$TDIR"/mhp_"$LDEVICE"_"$BUTC".sh 430 | fi; 431 | 432 | # Poco 433 | if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then 434 | MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh 435 | fi; 436 | 437 | # Redmi 438 | if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then 439 | MHGP="$TDIR"/mhp_"$LMODL"_"$BUTC".sh 440 | fi; 441 | 442 | # Set name to use for additional prop files in the current directory. 443 | 444 | # Generic 445 | APFN="$LBRND"_"$LMODL"_"$BUTC" 446 | 447 | # Google 448 | if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then 449 | APFN="$LMODL"_"$BUTC" 450 | fi; 451 | 452 | # OnePlus 453 | if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then 454 | APFN="$LDEVICE"_"$BUTC" 455 | fi; 456 | 457 | # Poco 458 | if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then 459 | APFN="$LMODL"_"$BUTC" 460 | fi; 461 | 462 | # Redmi 463 | if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then 464 | APFN="$LMODL"_"$BUTC" 465 | fi; 466 | 467 | # Set MagiskHide Props Config fingerprint. 468 | 469 | # Generic 470 | MPRINT="$BRAND"" ""$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 471 | 472 | # Essential 473 | if [ "$BRAND" = "Essential" ] || [ "$BRAND" = "essential" ]; then 474 | MPRINT=Essential" ""$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 475 | fi; 476 | 477 | # Google 478 | if [ "$BRAND" = "Google" ] || [ "$BRAND" = "google" ]; then 479 | MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 480 | fi; 481 | 482 | # OnePlus 483 | if [ "$BRAND" = "OnePlus" ] || [ "$BRAND" = "oneplus" ]; then 484 | if grep -q ro.display.series $prop_file; then 485 | MPRINT="$DSPLY"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 486 | else 487 | MPRINT="$DEVICE"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 488 | fi; 489 | fi; 490 | 491 | # LG 492 | if [ "$BRAND" = "lge" ] || [ "$BRAND" = "LGE" ]; then 493 | MPRINT=LG" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 494 | fi; 495 | 496 | # Poco 497 | if [ "$DMDL" = "POCO" ] || [ "$DMDL" = "poco" ]; then 498 | MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 499 | fi; 500 | 501 | # Redmi 502 | if [ "$DMDL" = "Redmi" ] || [ "$DMDL" = "redmi" ]; then 503 | MPRINT="$MODL"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 504 | fi; 505 | 506 | # Samsung 507 | if [ "$BRAND" = "SAMSUNG" ] || [ "$BRAND" = "samsung" ]; then 508 | MPRINT=Samsung" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 509 | fi; 510 | 511 | # Experimental -- Not sure if I will keep this or integrate it better 512 | # Set MagiskHide Props Config fingerprint from certified.list 513 | 514 | if [ -f certified.list ]; then 515 | if grep -q "$DEVICE" certified.list; then 516 | CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f1); 517 | CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2); 518 | CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2 | cut -f1 -d' '); 519 | fi; 520 | 521 | if [ $BRAND = "Xiaomi" ] || [ $BRAND = "xiaomi" ]; then 522 | CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f1); 523 | CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f2); 524 | CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | grep Xiaomi | tr -d '\n' | cut -f2 | cut -f1 -d' '); 525 | if [ "$CERTBRAND" = "" ]; then 526 | CERTBRAND=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f1); 527 | CERTNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2); 528 | CERTMRKNAME=$(grep "$MODL" certified.list | grep "$DEVICE" | tr -d '\n' | cut -f2 | cut -f1 -d' '); 529 | fi; 530 | fi; 531 | 532 | if [ "$CERTBRAND" = "Google" ] || [ "$CERTBRAND" = "POCO" ] || [ "$CERTBRAND" = "Redmi" ]; then 533 | MPRINT="$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 534 | elif [ "$CERTMRKNAME" = "Nexus" ] || [ "$CERTMRKNAME" = "POCO" ] || [ "$CERTMRKNAME" = "Redmi" ]; then 535 | MPRINT="$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 536 | elif [ "$CERTBRAND" = "LGE" ] || [ "$CERTBRAND" = "LGU+" ]; then 537 | MPRINT=LG" ""$CERTNAME"" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 538 | elif [ "$CERTBRAND" = "OnePlus" ]; then 539 | MPRINT="$CERTNAME"" "\["$OPMDL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 540 | elif [ "$CERTBRAND" = "Samsung" ]; then 541 | MPRINT="$CERTBRAND"" ""$CERTNAME"" "\["$MODL"\]" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 542 | else 543 | MPRINT="$CERTBRAND"" ""$CERTNAME"" "\("$aOS"\):"$MANF":"$MODL"="$BPRINT"__"$SDATE" 544 | fi; 545 | fi; 546 | 547 | # Check for SDK version. 548 | check_for_sdk 549 | 550 | ## Still need to improve note about using recovery.img instead of boot.img on older devices 551 | ## and/or newer devices that do not contain a ramdisk in the boot image. 552 | ## Newer devices that include a vendor_boot.img, recovery is in the vendor_boot image. 553 | 554 | ###### Finally here we go... 555 | 556 | # Backup if needed. 557 | backup 558 | 559 | # Add mHide fingerprint to $MHGP file. 560 | # echo $MPRINT | tee -a $MHGP 561 | echo $MPRINT | sed 's/__$//g' | tee -a $MHGP 562 | 563 | # Add a few notes to $MHGP file. 564 | add_notes 565 | 566 | # Extra echo just to clean up screen output. 567 | echo "" 568 | 569 | # Add a title line to the props file. 570 | add_device_title 571 | 572 | # Experimental -- Not sure if I will keep this or integrate it better 573 | # Needs more cleanup due to shared variations in the certified list 574 | # Retail Branding Marketing Name Device Model 575 | 576 | # Add tag from certified list 577 | if [ -f certified.list ]; then 578 | if grep -q "$DEVICE" certified.list; then 579 | echo "#" | tee -a $MHGP 580 | echo "# Device is on certified list" | tee -a $MHGP 581 | grep "$MODL" certified.list | grep "$DEVICE" | tr '\t' '>' | sed 's/>/ /g; s/^/# /g' | tee -a $MHGP 582 | echo "#" | tee -a $MHGP 583 | fi; 584 | fi; 585 | 586 | # grep fingerprint and security date | sed command to add beginning comment [# ] | tee -a to add it to $MHGP 587 | if grep -q ro.build.fingerprint $prop_file; then 588 | grep ro.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP 589 | elif grep -q ro.bootimage.build.fingerprint $prop_file; then 590 | grep ro.bootimage.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP 591 | else 592 | grep ro.system.build.fingerprint $prop_file | sed 's/^/# /g' | tee -a $MHGP 593 | fi; 594 | 595 | grep ro.build.version.security_patch $prop_file | sed 's/^/# /g' | tee -a $MHGP 596 | 597 | echo "#" | tee -a $MHGP 598 | # 599 | echo "" 600 | 601 | # Add beginning comment [# ] and remove the obsolete note line(s) in the $MHGP file 602 | get_prop_info | sed 's/^/# /g' | sed '/obsolete/d' | tee -a $MHGP 603 | echo "#" | tee -a $MHGP 604 | # get_prop_secure | sed 's/^/# /g' | tee -a $MHGP 605 | # echo "#" | tee -a $MHGP 606 | 607 | # Add note about prop file used to $MHGP 608 | echo "# # Pulled from "$prop_file"" >> $MHGP 609 | # echo "#" >> $MHGP 610 | 611 | # Cleanup 612 | 613 | # Rename additional prop files if needed. 614 | if [ -f build.prop ] || [ -f default.prop ] || [ -f prop.default ] || [ -f getprop.props ]; then 615 | echo ""; echo " If an additional prop file is found or used, it will be renamed."; 616 | rename_prop_files 617 | fi 618 | 619 | # Note backup 620 | if [ -f "$BACKUPFILE" ]; then 621 | echo ""; echo " Your previous "$MHGP" file was renamed to "$BACKUPFILE""; # echo ""; 622 | fi 623 | 624 | # Correct permissions if needed 625 | if [[ -z $ANDROID ]]; then 626 | chmod 0664 "$MHGP" 627 | if [ -f "$BACKUPFILE" ]; then 628 | chmod 0664 "$BACKUPFILE" 629 | fi; 630 | fi; 631 | 632 | # Finish script 633 | echo ""; echo " Done."; echo ""; 634 | echo " New mHideGP prop file saved as "$MHGP""; echo ""; 635 | # 636 | exit_0; 637 | -------------------------------------------------------------------------------- /prop_mHideGP.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Pull prop settings from factory prop files 4 | # ipdev @ xda-developers 5 | 6 | # Originally (and still) written to grab needed/useful props for use with MagiskHide Props Config module 7 | # by Didgeridoohan @ xda-developers 8 | # https://forum.xda-developers.com/apps/magisk/module-magiskhide-props-config-t3789228 9 | 10 | # This script will run the mHideGP script on all prop files in the same directory 11 | # It will look for file(s) named or ending in: build.prop default.prop prop.default or getprop.props 12 | # Merge the generated mhp files into mHide-printslist-DATE.sh. 13 | # Remove all the generated mph files. 14 | 15 | # To use. 16 | # Copy prop_mHideGP.sh and mHideGP.sh into a directory 17 | # Copy device prop files into the same directory 18 | # Run prop_mHideGP.sh 19 | # 20 | 21 | # Set variables 22 | 23 | TDIR=$(pwd) 24 | DATE=$(date '+%Y%m%d') 25 | # DATE=$(date '+%Y%m%d_%H%M') 26 | OUT=mHide-printslist-"$DATE".sh 27 | SCRIPT=prop_mHideGP.sh 28 | 29 | # Set functions 30 | 31 | add_notes() { 32 | echo "\"" >> $OUT 33 | echo "######" >> $OUT 34 | echo "## The above \" was added to close custom printslist list early." >> $OUT 35 | echo "## Just to clean it up a little. Lines below will not display on screen." >> $OUT 36 | echo "## Due to updates in Magisk and/or mHide module." >> $OUT 37 | echo "## The rest of the file is now block commented to hide/clean it up further." >> $OUT 38 | echo "######" >> $OUT 39 | } 40 | 41 | backup() { 42 | if [ -f "$OUT" ]; then 43 | FLTM=$(date -r "$OUT" '+%H%M') 44 | BACKUPFILE=$(printf "$OUT" | sed 's/.sh/.'"$FLTM"'/g') 45 | mv "$OUT" "$BACKUPFILE" 46 | fi 47 | } 48 | 49 | check_files() { 50 | echo "" 51 | if [ ! -f mHideGP.sh ]; then 52 | echo " Missing mHideGP script." 53 | echo "" 54 | exit 1; 55 | fi 56 | } 57 | 58 | exit_0() { 59 | if [ $ANDROID = "TRUE" ]; then 60 | return 0; exit 0; 61 | else 62 | exit 0; 63 | fi 64 | } 65 | 66 | exit_1() { 67 | if [ $ANDROID = "TRUE" ]; then 68 | return 1; exit 1; 69 | else 70 | exit 1; 71 | fi 72 | } 73 | 74 | rename_prop_files() { 75 | if [ -f build.prop ]; then 76 | FLDT=$(date -r build.prop '+%Y%m%d') 77 | mv build.prop "$FLDT"_build.prop 78 | fi 79 | 80 | if [ -f prop.default ]; then 81 | FLDT=$(date -r prop.default '+%Y%m%d') 82 | mv prop.default "$FLDT"_prop.default 83 | fi 84 | 85 | if [ -f default.prop ]; then 86 | FLDT=$(date -r default.prop '+%Y%m%d') 87 | mv default.prop "$FLDT"_default.prop 88 | fi 89 | 90 | if [ -f getprop.props ]; then 91 | FLDT=$(date -r getprop.props '+%Y%m%d') 92 | mv getprop.props "$FLDT"_getprop.props 93 | fi 94 | } 95 | 96 | set_target_directory() { 97 | if [ ! -f "$SCRIPT" ]; then 98 | TDIR=$(lsof 2>/dev/null | grep -o '[^ ]*$' | grep -m1 "$SCRIPT" | sed 's/\/'"$SCRIPT"'//g'); 99 | cd $TDIR; 100 | fi 101 | } 102 | 103 | # Determine if running on an Android device or MacOS/Linux. 104 | if [ -f /system/bin/sh ] || [ -f /system/bin/toybox ] || [ -f /system/bin/toolbox ]; then 105 | # Android device 106 | ANDROID=TRUE 107 | else 108 | # MacOS/Linux 109 | ANDROID=FALSE 110 | fi 111 | 112 | # Reset and move to the target directory if needed. 113 | set_target_directory 114 | 115 | # Check for required files. 116 | check_files 117 | 118 | # Rename additional prop files if needed. 119 | rename_prop_files 120 | 121 | # Run mHideGP on additional prop files in the current directory. 122 | AdditionalPropFile=('build.prop' 'default.prop' 'prop.default' 'getprop.props') 123 | 124 | if [ $ANDROID = "TRUE" ]; then 125 | echo "" 126 | for pfile in "${AdditionalPropFile[@]}"; do 127 | { 128 | for propfile in *"$pfile"; do 129 | { 130 | if [ -f "$propfile" ]; then 131 | echo "$propfile" 132 | mv "$propfile" "$pfile" 133 | sh "$TDIR"/mHideGP.sh > /dev/null 134 | if [ -f "$pfile" ]; then 135 | mv "$pfile" "$propfile" 136 | fi; 137 | fi; 138 | } 139 | done; 140 | } 141 | done; 142 | fi; 143 | 144 | if [ $ANDROID = "FALSE" ]; then 145 | echo "" 146 | for pfile in "${AdditionalPropFile[@]}"; do 147 | { 148 | for propfile in *"$pfile"; do 149 | { 150 | if [ -f "$propfile" ]; then 151 | echo "$propfile" 152 | mv "$propfile" "$pfile" 153 | "$TDIR"/mHideGP.sh > /dev/null 154 | if [ -f "$pfile" ]; then 155 | mv "$pfile" "$propfile" 156 | fi; 157 | fi; 158 | } 159 | done; 160 | } 161 | done; 162 | fi; 163 | 164 | # Backup if needed 165 | backup 166 | 167 | # Concatenate (Merge multiple files into a new file.) 168 | ## The output file is written in order of the mhp file name(s). 169 | ## The mHideGP script will hopefully name them in the correct order. 170 | 171 | # Add mHide fingerprint from the mhp files(s) to $OUT file. 172 | for mPrint in mhp_*.sh; do 173 | cat $mPrint | sed '1!d' >> "$OUT" 174 | done 175 | 176 | # Add a few notes to $OUT file. 177 | add_notes 178 | 179 | # Add all the rest of the device props from the mhp file(s) to the $OUT file. 180 | for dProps in mhp_*.sh; do 181 | cat $dProps | sed '/#/!d' | sed '/##/d' >> "$OUT" 182 | done 183 | 184 | # Cleanup 185 | # (Not sure if I like the echo clutter. Removed for now.) 186 | ## echo ""; echo "Removing the separate mhp file(s)."; 187 | for file in mhp_*.sh; do 188 | { 189 | ## echo $file 190 | rm $file 191 | } 192 | done 193 | 194 | # Note backup 195 | if [ -f "$BACKUPFILE" ]; then 196 | echo ""; echo "Your previous "$OUT" file was renamed to "$BACKUPFILE""; 197 | fi 198 | 199 | # Correct permissions if needed 200 | for file in mhc_*; do 201 | chmod 0664 $file 2>/dev/null 202 | done; 203 | for file in mhp_*; do 204 | chmod 0664 $file 2>/dev/null 205 | done; 206 | for file in mHide-*; do 207 | chmod 0664 $file 2>/dev/null 208 | done; 209 | for file in *.img; do 210 | chmod 0664 $file 2>/dev/null 211 | done; 212 | 213 | # Finish script 214 | echo ""; echo "New mHide-printslist file saved as "$OUT"" 215 | echo ""; echo "Done."; echo ""; 216 | # 217 | exit_0; 218 | --------------------------------------------------------------------------------