Skip to content

ykankaya/solving-captchas-code-examples

 
 

Repository files navigation

Solving CAPTCHAs code examples

@ageitgey example of using machine learning to solve CAPTCHAs as described in How to break a CAPTCHA system in 15 minutes with Machine Learning

Installing

I followed https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/ to install OpenCV. Note that we also need h5py which was missing from the requirements.txt file.

pip3 install h5py

Before you get started

To run these scripts, you need the following installed:

  1. Python 3
  2. OpenCV 3 w/ Python extensions
  1. The python libraries listed in requirements.txt
  • Try running "pip3 install -r requirements.txt"

Step 1: Extract single letters from CAPTCHA images

Run:

python3 extract_single_letters_from_captchas.py

The results will be stored in the "extracted_letter_images" folder.

Step 2: Train the neural network to recognize single letters

Run:

python3 train_model.py

This will write out "captcha_model.hdf5" and "model_labels.dat"

Step 3: Use the model to solve CAPTCHAs!

Run:

python3 solve_captchas_with_model.py

[Note rdmp] When running on a Mac make sure you click on the image with the CAPTCHA then press any key to get the next solution. If you have the Terminal window in the foreground nothing will happen when you press a key.

About

Adam Geitgey's example of using machine learning to solve CAPTCHAs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%