Added checks

This commit is contained in:
Friedrich Doku 2023-01-06 12:49:34 -05:00
parent a7015f4ddf
commit 73913ea5af
3 changed files with 28 additions and 10 deletions

View File

@ -1,5 +1,7 @@
### Copyrigh (C) 2023 - 2023 Friedrich Doku <friedrichdoku@gmail.com>
[Unit] [Unit]
Description=My Script Description=https://www.kicksecure.com/wiki/Cold_Boot_Attack_Defense
[Service] [Service]
Type=oneshot Type=oneshot

View File

@ -72,7 +72,7 @@ dmsetup_actual_output: '$dmsetup_actual_output'" > /dev/kmsg
sleep 5 sleep 5
fi fi
kexec -e kexec -e && echo "kexec -e succeeded" || echo "kexec -e failed"
} }
ram_wipe ram_wipe

View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
## Copyrigh (C) 2022 - 2022 ENCRYPTED SUPPORT LP <adrelanos@whonix.org> ## Copyrigh (C) 2022 - 2022 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## Copyrigh (C) 2023 - 2023 Friedrich Doku <friedrichdoku@gmail.com>
## See the file COPYING for copying conditions. ## See the file COPYING for copying conditions.
## modified by Friedrich Doku <friedrichdoku@gmail.com>
set -x set -x
set -e set -e
@ -13,27 +12,44 @@ env
## Lets hope $1 is set to reboot, poweroff or halt by systemd. ## Lets hope $1 is set to reboot, poweroff or halt by systemd.
true "1: $1" true "1: $1"
sudo dbus-monitor --system | initrd=/boot/initrd.img-$(uname -r)
kernel=/boot/vmlinuz-$(uname -r)
if test -e $initrd; then
echo "Initrd File Found"
else
exit 1
echo "Initrd File NOT FOUND"
fi
if test -e $kernel; then
echo "Kernel File Found"
else
exit 1
echo "Kernel File NOT FOUND"
fi
dbus-monitor --system |
while read -r line; do while read -r line; do
if [[ $line =~ .*"poweroff.target".* ]]; then if [[ $line =~ .*"poweroff.target".* ]]; then
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initrd.img-$(uname -r) --reuse-cmdline --append="wiperamexit=yes wiperamaction=poweroff" kexec -l $kernel --initrd=$initrd --reuse-cmdline --append="wiperamexit=yes wiperamaction=poweroff"
break break
fi fi
if [[ $line =~ .*"reboot.target".* ]]; then if [[ $line =~ .*"reboot.target".* ]]; then
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initrd.img-$(uname -r) --reuse-cmdline --append="wiperamexit=yes wiperamaction=reboot" kexec -l $kernel --initrd=$initrd --reuse-cmdline --append="wiperamexit=yes wiperamaction=reboot"
break break
fi fi
if [[ $line =~ .*"halt.target".* ]]; then if [[ $line =~ .*"halt.target".* ]]; then
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initrd.img-$(uname -r) --reuse-cmdline --append="wiperamexit=yes wiperamaction=halt" kexec -l $kernel --initrd=$initrd --reuse-cmdline --append="wiperamexit=yes wiperamaction=halt"
break break
fi fi
if [[ $line =~ .*"kexec.target".* ]]; then if [[ $line =~ .*"kexec.target".* ]]; then
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initrd.img-$(uname -r) --reuse-cmdline --append="wiperamexit=yes wiperamaction=reboot" kexec -l $kernel --initrd=$initrd --reuse-cmdline --append="wiperamexit=yes wiperamaction=reboot"
break break
fi fi
done done
sleep 10