Coder Social home page Coder Social logo

captcha-breaker's Introduction

Captcha Breaker

Build with Tensorflow (ConvNets) and Node.js ๐Ÿ’ช๐Ÿ’ช๐Ÿ’ช

E.x: Amazon Captcha (click image below to watch demo video)

Amazon Captcha

Installation

Python packages

$ pip install -r requirements.txt

Node.js packages (Node.js user only)

$ npm i

Usage

1. Create train data

Prepare your training dataset

  • Copy captcha images to data/captcha folder
|_data
      |_captcha
          |_ xss7.jpg
          |_ tvu4.jpg

IMPORTANT: Note each image file is named with it's own solution.

That means that if an image is named A1bD3.jpg, it corresponds to a captcha's whose solution is A1bD3

Build train data for model

Run src/create_train_data.py will save your train data as data/captcha.npz compressed file.

$ python src/create_train_data.py

The compressed data/captcha.npz includes:

  • Train Data ( x_train, y_train ): 80%
  • Test Data ( x_test, y_test ): 20%

2. Train

Run src/train.py to train the model with your own dataset.

$ python src/train.py

Take โ˜• or ๐Ÿต while waiting!

3. Attack

Now, enjoy your war ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ

Python

$ python src/predict --fname YOUR_IMAGE_PATH_or_URL

Sample output:

loading image: data/captcha/captcha_2.jpg
load captcha classifier
predict for 1 char: `X` with probability: 99.956%
predict for 2 char: `I` with probability: 99.909%
predict for 3 char: `N` with probability: 99.556%
predict for 4 char: `C` with probability: 99.853%
predict for 5 char: `H` with probability: 99.949%
predict for 6 char: `A` with probability: 98.889%
Captcha: `XINCHA` with confident: `99.686%`
XINCHA

Node.js

const captchaPredict = require('src/predict')

captchaPredict(YOUR_IMAGE_PATH_or_URL)
  .then(console.log)
  .catch(console.error)

Sample output:

[
  "loading image: data/captcha/captcha_2.jpg",
  "load captcha classifier",
  "predict for 1 char: `X` with probability: 99.956%",
  "predict for 2 char: `I` with probability: 99.909%",
  "predict for 3 char: `N` with probability: 99.556%",
  "predict for 4 char: `C` with probability: 99.853%",
  "predict for 5 char: `H` with probability: 99.949%",
  "predict for 6 char: `A` with probability: 98.889%",
  "Captcha: `XINCHA` with confident: `99.686%`",
  "XINCHA"
]

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.