Created
July 3, 2023 10:25
-
-
Save sen0rxol0/af3cf9c8acbbfd234c0fac760d796c45 to your computer and use it in GitHub Desktop.
Revisions
-
sen0rxol0 created this gist
Jul 3, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ /* compile with: xcrun -sdk iphoneos clang -arch arm64 -Wall -o ./mountfs ./mountfs.c */ #include <stdio.h> #include <sys/wait.h> #include <spawn.h> #include <unistd.h> /* if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s3) == 'Preboot' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s3 /mnt6 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s4) == 'Preboot' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s4 /mnt6 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s5) == 'Preboot' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s5 /mnt6 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s6) == 'Preboot' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s6 /mnt6 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s7) == 'Preboot' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s7 /mnt6 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s3) == 'xART' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s3 /mnt7 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s4) == 'xART' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s4 /mnt7 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s5) == 'xART' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s5 /mnt7 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s6) == 'xART' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s6 /mnt7 \n\ fi \n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s7) == 'xART' ]]; then \n\ /sbin/mount_apfs /dev/disk0s1s7 /mnt7 \n\ fi \n\ */ #define SHELL_SCRIPT "\ /sbin/mount_apfs /dev/disk0s1s1 /mnt1\n\ for n in {3..7}\n\ do\n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s$n) == 'Preboot' ]];then\n\ /sbin/mount_apfs /dev/disk0s1s$n /mnt6\n\ fi\n\ done\n\ for n in {3..7}\n\ do\n\ if [[ $(/System/Library/Filesystems/apfs.fs/apfs.util -p /dev/disk0s1s$n) == 'xART' ]];then\n\ /sbin/mount_apfs /dev/disk0s1s$n /mnt7\n\ fi\n\ done\n\ /usr/libexec/seputil --gigalocker-init 1> /dev/null\n\ if [[ -e /mnt6/active ]];then\n\ /usr/libexec/seputil --load /mnt6/$(cat /mnt6/active)/usr/standalone/firmware/sep-firmware.img4\n\ else\n\ /usr/libexec/seputil --load /mnt1/usr/standalone/firmware/sep-firmware.img4\n\ fi\n\ /sbin/mount_apfs /dev/disk0s1s2 /mnt2\n\ echo\n" extern char **environ; int main() { char *mountfs[] = {"/bin/bash", "-c", SHELL_SCRIPT, NULL}; pid_t child; posix_spawn(&child, mountfs[0], NULL, NULL, mountfs, environ); waitpid(child, NULL, 0); sleep(2); return 0; }