Created
May 28, 2024 20:20
-
-
Save ridingintraffic/45d9855959dd3d5bc342a6184bc1686b to your computer and use it in GitHub Desktop.
bad ideas
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 characters
#!/usr/bin/env bash | |
# crypto lock your own files with no way of recovering them but leaves the encrypted file behind. | |
# to give you 'hope' | |
# the file is sequentially encrypted 10 times with a different 100 length hexcode every time | |
# the original file is then overwritten 20 times | |
help() { | |
echo "$0:" | |
echo " usage:" | |
echo " $0 /path/to/the/file/to-make-go-away.txt" | |
echo " $0 " | |
exit 0 | |
} | |
_crypt() { | |
file=$1 | |
openssl aes-256-cbc -a -salt -in ${file} -out ${file}.enc -k $(openssl rand -hex 100) | |
for i in {1..10} | |
do | |
openssl aes-256-cbc -a -salt -in ${file}.enc -out ${file}.enc2 -k $(openssl rand -hex 100) | |
mv ${file}.enc2 ${file}.enc | |
done | |
for i in {1..20} | |
do | |
filestats=( $( ls -Lon "${file}" ) ) # to get size | |
dd if=/dev/urandom of=${file} bs=${filestats[3]} count=1 &>/dev/null | |
done | |
rm ${file} | |
echo "its dead jim" | |
} | |
if [ "$1" == "-h" ] || [ "$1" == "--help" ] || [ "$1" == "help" ]; then | |
help | |
exit 0 | |
fi | |
find . -type f -name $1| while read file; do _crypt "$file"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment