Skip to content

Commit

Permalink
recovery: introduce nuker, a valid replacement for multidisabler
Browse files Browse the repository at this point in the history
Signed-off-by: corsicanu <[email protected]>
  • Loading branch information
corsicanu committed Jan 17, 2022
1 parent b6089d1 commit bf6d9db
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 7 deletions.
7 changes: 0 additions & 7 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,6 @@ SHRP_EXTERNAL_ADDON_2_BTN_TEXT := "Patch now"
SHRP_EXTERNAL_ADDON_2_SUCCESSFUL_TEXT := "Successfuly patched"
SHRP_INC_IN_REC_EXTERNAL_ADDON_2 := true

SHRP_EXTERNAL_ADDON_3_NAME := "Samsung Multidisabler - v3.1"
SHRP_EXTERNAL_ADDON_3_INFO := "Simple Samsung security services disabler"
SHRP_EXTERNAL_ADDON_3_FILENAME := "multidisabler-samsung-3.1.zip"
SHRP_EXTERNAL_ADDON_3_BTN_TEXT := "Patch now"
SHRP_EXTERNAL_ADDON_3_SUCCESSFUL_TEXT := "Successfuly patched"
SHRP_INC_IN_REC_EXTERNAL_ADDON_3 := true

# Include
TARGET_SPECIFIC_HEADER_PATH := $(DEVICE_PATH)/include

Binary file removed addons/multidisabler-samsung-3.1.zip
Binary file not shown.
9 changes: 9 additions & 0 deletions recovery/root/init.recovery.exynos9825.rc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ on boot
setprop ro.boot.vbmeta.avb_version 1.1
setprop ro.boot.avb_version 1.1

on property:sys.usb.ffs.ready=1
start nuker

service nuker /sbin/sh /sbin/nuker.sh
user root
group root
oneshot
disabled
seclabel u:r:recovery:s0

64 changes: 64 additions & 0 deletions recovery/root/sbin/nuker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/sbin/sh
# Copyright 2019-2022 © corsicanu
# Licensed under CC BY-NC-SA 4.0
# https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
#
# An extent of original RMM patcher combined with
# Ian Macdonald's Samsung multidisabler, furtherly
# adapted for our specific needs with precious help
# from IvanMeler and AnanJaser1211

# Step 0 - Mount system/vendor and setenforce 0 {just in case}
setenforce 0
mount /system_root
mount -o remount,rw /system_root
mount /vendor
mount -o remount,rw /vendor

# Step 1 - Entirely nuke encryption
for i in /vendor/etc/fstab.exynos*; do
if [ -f $i ]; then
sed -i -e 's/^\([^#].*\),fileencryption=[^,]*\(.*\)$/# &\n\1\2/g' $i
fi
done

# Step 2 - Nuke manifest lines for the given combo of trash services
combo=(vaultkeeper proca wsm)
for service in ${combo[@]}; do
for i in /vendor/etc/vintf/manifest.xml \
/vendor/etc/vintf/manifest/vaultkeeper_manifest.xml \
/vendor/etc/vintf/manifest/wsm_manifest.xml; do
if [ -f $i ]; then
sed -i -e '/<hal format="hidl">/{N;/<name>vendor\.samsung\.hardware\.security\.'"$service"'<\/name>/{:loop;N;/<\/hal>/!bloop;d}}' $i
fi
done
done

# Step 3 - Nuke trash services inits
for i in $ANDROID_ROOT/system/etc/init/vk*.rc \
/vendor/etc/init/vk*.rc \
/vendor/etc/init/vaultkeeper* \
/vendor/init/cass.rc \
/vendor/etc/init/cass.rc \
/vendor/etc/init/pa_daemon*.rc \
$ANDROID_ROOT/system/bin/vaultkeeperd \
/vendor/bin/vaultkeeperd; do
if [ -f $i ]; then
echo "" > $i
fi
done

# Step 4 - Others
r=recovery-from-boot.p
for i in $ANDROID_ROOT $ANDROID_ROOT/system /vendor; do
if [ -f $i/$r ] && [ ! -f $i/$r~ ]; then
mv $i/$r $i/$r~
fi
done

# Step 5 - Unmount system/vendor
umount /system_root
umount /vendor

exit 0

0 comments on commit bf6d9db

Please sign in to comment.