X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/b2e474ebba5b2bf0cb3048b5999d997bdc2e1632..806815602e4db6c75672279bcf3f128ca66bf9e1:/captcha.py diff --git a/captcha.py b/captcha.py index b2d2a06..effdd36 100644 --- a/captcha.py +++ b/captcha.py @@ -22,6 +22,8 @@ # Further tweaks by Brion Vibber : # 2006-01-26: Add command-line options for the various parameters # 2007-02-19: Add --dirs param for hash subdirectory splits +# Tweaks by Greg Sabino Mullane : +# 2008-01-06: Add regex check to skip words containing other than a-z import random import Image @@ -33,6 +35,7 @@ import math, string, md5 import getopt import os import sys +import re # Does X-axis wobbly copy, sandwiched between two rotates def wobbly_copy(src, wob, col, scale, ang): @@ -119,6 +122,13 @@ def try_pick_word(words, blacklist, verbose): word1 = words[random.randint(0,len(words)-1)] word2 = words[random.randint(0,len(words)-1)] word = word1+word2 + if verbose: + print "word is %s" % word + r = re.compile('[^a-z]'); + if r.search(word): + print "skipping word pair '%s' because it contains non-alphabetic characters" % word + return None + for naughty in blacklist: if naughty in word: if verbose: