From 04da6f240657ef97ece5a31412ed50935ca40f47 Mon Sep 17 00:00:00 2001 From: Howard20181 <40033067+Howard20181@users.noreply.github.com> Date: Mon, 15 Aug 2022 18:51:24 +0800 Subject: [PATCH] Randomize Magisk paths and service names --- scripts/run.sh | 59 +++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index 0809923..c1326bc 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -17,6 +17,10 @@ function YesNoBox { whiptail --title "${o[title]}" --yesno "${o[text]}" 0 0 } +function Gen_Rand_Str { + echo $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w "$1" | head -n 1) +} + echo "Dependencies" sudo apt update && sudo apt -y install setools lzip wine winetricks patchelf whiptail e2fsprogs cp -r ../wine/.cache/* ~/.cache @@ -212,47 +216,52 @@ EOF sudo patchelf --replace-needed libdl.so "../linker/libdl.so" ../_WORK_DIR_/magisk/magiskpolicy || true sudo patchelf --set-interpreter "../linker/linker64" ../_WORK_DIR_/magisk/magiskpolicy || true chmod +x ../_WORK_DIR_/magisk/magiskpolicy - echo '/dev/wsa-magisk(/.*)? u:object_r:magisk_file:s0' | sudo tee -a $MOUNT_DIR/vendor/etc/selinux/vendor_file_contexts + TMP_PATH=$(Gen_Rand_Str 8) + echo "/dev/"$TMP_PATH"(/.*)? u:object_r:magisk_file:s0" | sudo tee -a $MOUNT_DIR/vendor/etc/selinux/vendor_file_contexts echo '/data/adb/magisk(/.*)? u:object_r:magisk_file:s0' | sudo tee -a $MOUNT_DIR/vendor/etc/selinux/vendor_file_contexts sudo ../_WORK_DIR_/magisk/magiskpolicy --load $MOUNT_DIR/vendor/etc/selinux/precompiled_sepolicy --save $MOUNT_DIR/vendor/etc/selinux/precompiled_sepolicy --magisk "allow * magisk_file lnk_file *" + SERVER_NAME1=$(Gen_Rand_Str 12) + SERVER_NAME2=$(Gen_Rand_Str 12) + SERVER_NAME3=$(Gen_Rand_Str 12) + SERVER_NAME4=$(Gen_Rand_Str 12) sudo tee -a $MOUNT_DIR/system/etc/init/hw/init.rc <