Giter Site home page Giter Site logo

ruby-captcha-breaker's Introduction

Ruby Captcha Solver

Ever wondered how to solve a captcha? Do you think Ruby could do it?

These were the questions I set out to answer.

Turns out that Ruby is quite slow, but as so many other interpreted languages, it is bindable to powerful libraries written in C. This means you get to enjoy the simplicity of Ruby and the speed of a compiled language for the tasks that matter.

I've choosen a simple catcha used by NOAA to protect their service from automated requests. I really like this for meteo forecasts (I'm a paraglider pilot), but the god damn captchas are so annoying!

This is the victim and process of breaking it is quite simple:

The captcha

  1. First I fill everything that's white with black - this removes the breaks in the letters we're supposed to read.
  2. Then I turn the image into a binary image (only black and white).
  3. It's then time to erode the image 3 times - Eroding means that the outer black pixels of the letters will become white, since the noise letters are thinner, they'll disappear.
  4. In the end I dilate the image 4 times to make it ready for tessaract to read the caracters - dilating is the opposite of eroding, so the white pixels adjacent to a black pixel become black as well. This just restores the wheight of the font.
  5. Ask tessaract to read the charactes and voi la, we've solved a captcha.

The result of the pre-processing algorithm:

The captcha solved

Easy as pie for tesseract to handle :)

ruby-captcha-breaker's People

Contributors

eidge avatar

Stargazers

duvanherfi avatar John Dough avatar  avatar Khalil Gharbaoui avatar Rizqi Nur Assyaufi avatar jack avatar Stanislav Mekhonoshin avatar EVOKE avatar  avatar  avatar  avatar George N. Kostov avatar Kamil Nicieja avatar Dmitry Zudochkin avatar Yakimelon avatar Ismagnu avatar  avatar Anderson Araujo avatar Gary Lai avatar MOGI Hiromu avatar Marcio Camurati avatar Heru Hang Tryputra avatar Senthil Nayagam avatar Derrick Zhang avatar Roberto Salas avatar Igor Oliveira avatar JD Costa avatar Aria avatar Roberto Dip avatar Braunson Yager avatar

Watchers

Fábio do Carmo Gomes avatar  avatar  avatar

ruby-captcha-breaker's Issues

Need a QuickStart!

How do I input my own captcha and run your code?
I'm not very experienced with Ruby, so a quickstart would be nice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.