#!/bin/bash # Usage: ./make_kali-usb-stick_persistent [ kali.iso ] # or # bash make_kali-usb-stick_persistent [ kali.iso ] # Description: Writes a kali.iso to an usb stick (optional) and # adds persistence to it step by step. # Author: Patrick Neumann (patrick@neumannsland.de) # Platform: Kali Linux (tested: 2022.2) or # Debian GNU/Linux (tested: 9.5) # Version: 1.03 # Date: 22.06.2022 # Link: https://git.neumannsland.de/casualscripter/shell-scripting # License: GPL3 # Warranty: This program is distributed WITHOUT ANY WARRANTY # check for root if [[ 0 -ne "$( /usr/bin/id --user )" ]] ; then printf "you need to be root - EXIT!\n" exit 2 fi # usage function usage () { printf "Usage:\n" printf " $0 [ /dev/null ; then printf "There is already a persistence on the choosen usb stick - EXIT!\n" exit 5 fi # add 3rd partition to the end of the usb stick fdisk "${USBSTICK}" <<< $( printf "n\np\n\n\n\nw" ) # format 3rd partition with ext3 and label "persistence" mkfs.ext3 -L persistence "${USBSTICK}"3 # place "config" in filesystem of 3rd partition mkdir -p /mnt/persistence mount "${USBSTICK}"3 /mnt/persistence echo "/ union" > /mnt/persistence/persistence.conf umount "${USBSTICK}"3 rmdir /mnt/persistence exit 0