Created
July 27, 2024 04:59
-
-
Save UnforeseenOcean/654f0406a78198f26394448fedba61d9 to your computer and use it in GitHub Desktop.
Free space filler file generator with misdirection for data recovery prevention
This file contains 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 characters
# Makes "believable" fake files to confuse common recovery software | |
# Copy the files to target device to overwrite free space after generating | |
# For best results wipe free space with zero fill before copying | |
# --- | |
# Requires you to prepare all headers to be used as "header.ext" such as "header.jpg" and put it inside a subfolder "headers" | |
# Make a subfolder to put the generated files into called "output" | |
# Then adjust the parameters to fit your needs | |
# This script written by Jamie, modified slightly to add more randomness. Tested on MINGW64/Msys64 and Linux | |
LEFTOVER_SIZE=5102993 | |
SMALLEST_CHUNK=1039 | |
BIGGEST_CHUNK=4958 | |
while (( $LEFTOVER_SIZE > 0 )) | |
do | |
SIZE=$(($RANDOM%($BIGGEST_CHUNK-$SMALLEST_CHUNK+1)+$SMALLEST_CHUNK)) | |
NAME_LEN=$(($RANDOM%(32-4+1)+4)) | |
if (( $SIZE >= $LEFTOVER_SIZE )) | |
then | |
SIZE=$(( LEFTOVER_SIZE )) | |
fi | |
TEMP_NAME=($(cat /dev/urandom | tr -cd '0-9a-zA-Z' | head -c $NAME_LEN)) | |
LEFTOVER_SIZE=$(( LEFTOVER_SIZE-SIZE )) | |
echo "creating file $TEMP_NAME.bin" | |
dd if=/dev/random of=output/temp.bin bs=${SIZE}k count=1 | |
HEADER=$(ls headers/ | shuf -n 1) | |
echo "using header: $HEADER" | |
cat ./headers/$HEADER output/temp.bin > output/$TEMP_NAME.${HEADER#*.} | |
rm output/temp.bin | |
done | |
echo "All done, exiting" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment