Skip to content

Instantly share code, notes, and snippets.

@Grissess
Last active August 13, 2016 09:37
Show Gist options
  • Save Grissess/f60b726e90f6743671668a9baaa23ed2 to your computer and use it in GitHub Desktop.
Save Grissess/f60b726e90f6743671668a9baaa23ed2 to your computer and use it in GitHub Desktop.
#!/bin/bash
# I sincerely recommend this is backed by ramfs/tmpfs, otherwise you will
# probably hit your disk rather hard--which is bad for SSDs :)
# Same goes for any file you redirect stdout to.
WORKDIR="${1:-/tmp/work}"
mkdir -p "$WORKDIR" || exit 1
if [ ! -r ciphers.txt ]; then
STREAM_CIPHERS="rc4 rc4-40"
for fbm in cfb cfb1 cfb8 ofb; do
for cipher in aes camellia; do
for ksize in 128 192 256; do
STREAM_CIPHERS="$STREAM_CIPHERS ${cipher}-${ksize}-${fbm}"
done
done
for cipher in bf cast cast5 des des3 des-ede des-ede3 idea seed rc2 rc2-40 rc2-64 rc5; do
STREAM_CIPHERS="$STREAM_CIPHERS ${cipher}-${fbm}"
done
done
echo "$STREAM_CIPHERS" | sed -e "s/ /\n/g" > ciphers.txt
fi
for kw in $(cat passphrases.txt); do
#for sc in $STREAM_CIPHERS; do
# openssl $sc -d -in ciphertext.txt -k "$kw" 2>/dev/null
#done
rm "$WORKDIR"/*
xargs -a ciphers.txt -n 1 -P 0 -I {} openssl {} -d -in ciphertext.txt -k "$kw" -out "$WORKDIR/{}" 2>/dev/null
cat "$WORKDIR"/*
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment