Skip to content

Instantly share code, notes, and snippets.

@k4lizen
Last active July 12, 2024 14:42
Show Gist options
  • Save k4lizen/5d27816d410013535f808835cc46d7ed to your computer and use it in GitHub Desktop.
Save k4lizen/5d27816d410013535f808835cc46d7ed to your computer and use it in GitHub Desktop.
kernel pwn: Compress initramfs with statically linked exploit
#!/bin/bash
# Compress initramfs with the included statically linked exploit
in=$1
out=$(echo $in | awk '{ print substr( $0, 1, length($0)-2 ) }')
gcc $in -static -o $out || exit 255
mv $out initramfs
pushd . && pushd initramfs
find . -print0 | cpio --null --format=newc -o 2>/dev/null | gzip -9 > ../initramfs.cpio.gz
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment