Skip to content

Instantly share code, notes, and snippets.

@bcoles
Last active February 13, 2016 16:26
Cracks rudimentary CAPTCHA. Requires tesseract.
#!/bin/sh
# decaptcha.sh - Cracks rudimentary CAPTCHA. Requires tesseract.
# ---
image="$1"
output=`mktemp`
charset="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
command -v tesseract >/dev/null 2>&1 || { echo "Tesseract is not installed - (apt-get install tesseract-ocr) - Aborting." >&2; exit 1; }
if [ -z $image ]; then
echo "Usage: ./decaptcha.sh <FILE>"
exit 1
fi
echo "(*) Processing $image..."
echo "tessedit_char_whitelist $charset" | tesseract "$image" "$output" -psm 7 /dev/stdin > /dev/null && cat "$output.txt" && rm "$output.txt"
rm "$output"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment