1761206468

This commit is contained in:
2025-10-23 02:01:08 -06:00
parent 219e53b3d8
commit b48028b96b
7 changed files with 0 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
as -o poweroff_aarch64.o poweroff_aarch64.s
ld -o poweroff_aarch64 poweroff_aarch64.o
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
set -e
nasm -f elf64 -o poweroff_x86_64.o poweroff_x86_64.asm
ld -o poweroff_x86_64 poweroff_x86_64.o and linkx86_64.snasm -f elf64 -o poweroff_x86_64.o poweroff_x86_64.asm
View File
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# todo: find them and parse them
# set -e
debug=2 # 1 to enable any other to disable
if [[ $debug == 1 ]]; then
output_log=output.log
error_log=error.log
elif [[ $debug=2 ]]; then
output_log=-
error_log=-
else
output_log=/dev/null
error_log=/dev/null
fi
lsblk --list | awk '{printf "%s%s\n", "/dev/",$1}' | tail -n +2 | \
while read device; do
if [ -f $device ]; then
isLuks=$(cryptsetup isLuks $device)
echo $isLuks
if [[ $isLuks == 0 ]]; then
# nuke the luks headers
nice -20 cryptsetup erase -q $device 1>>$output_log 2>>$error_log || cryptsetup erase -q --disable-lock $device 1>>$output_log 2>>$error_log
fi
fi
done
# immediate halt power
nice -20 poweroff -ff 1>>$output_log 2>>$error_log || shutdown -P now 1>>$output_log 2>>$error_log
+28
View File
@@ -0,0 +1,28 @@
.global _start
.text
_start:
// Arguments are passed in registers x0 through x7 for AArch64.
// sys_reboot magic constants
mov x0, #0xfee1dead
mov x1, #0x28121969
// The Linux constant LINUX_REBOOT_CMD_HALT
mov x2, #0xcdef0123
// The fourth argument (x3) is optional, so set it to 0.
mov x3, #0
// The syscall number for sys_reboot on AArch64 is 169.
// The syscall number is placed in the X8 register.
mov x8, #169
// Execute the syscall.
svc #0
// This code should not be reached.
// If it is, exit with a status code.
// sys_exit is syscall number 93 on AArch64.
mov x8, #93
mov x0, #1
svc #0
+31
View File
@@ -0,0 +1,31 @@
section .text
global _start
_start:
; The sys_reboot system call has the number 169.
mov rax, 169
; Argument 1: RDI
; Linux REBOOT_MAGIC1 constant
mov rdi, 0xfee1dead
; Argument 2: RSI
; Linux REBOOT_MAGIC2 constant
mov rsi, 0x28121969
; Argument 3: RDX
; LINUX_REBOOT_CMD_HALT constant
mov rdx, 0xcdef0123
; Argument 4: R10
; Zero out the optional fourth argument.
xor r10, r10
; Call the syscall.
syscall
; The program should not reach here.
; Exit with an error code as a fallback.
mov rax, 60
mov rdi, 1
syscall
+16
View File
@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char *argv[]) {
// Drop privileges before running the command
setuid(getuid());
// Pass all arguments to the target command
execvp(argv[1], &argv[1]);
// This is only reached if execvp fails
perror("execvp");
return 1;
}