Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
crack recaptcha

#Crack reCAPTCHA

Dependencies

pip install pillow
brew install libpng
brew install libjpeg
pip install PIL --allow-external PIL --allow-unverified PIL

After that, let's try with an example

from PIL import Image
im = Image.open('image.jpeg') # jpeg or png
im = im.convert('L')
  1. Clean Noise.
def clean(im):
    im = im.convert('L')
    im = im.point(lambda x:255 if x>128 or x==0 else x)
    im = im.point(lambda x:0 if x<255 else 255)
    return im
  1. Splits into char images
#Divide by Columns
w, h = im.size
data = im.load()
jcolors = [sum(255-data[i,j] for j in range(h)) for i in range(w)]
print jcolors
  1. decode char images into chars
    def im2array(im):
        return [ int(x!='\xff') for x in im.tobytes() ]
    

References

Decoder JPEG not available error

Can't install PIL after Mac OS X 10.9

Python Image Library fails with message “decoder JPEG not available PIL”

decoding-weibo-captcha-in-python slides recommended

python captcha decoder library

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.