Git Product home page Git Product logo

captchacracker's Introduction

captcha_cracker

A cracker for sliding captcha of GEETEST, NetEase, Tencent and iQiyi based on OpenCV

img

Overview

Environment

macOS Mojave Version 10.14.1

Requirement

  • Python 3.6.1
  • Selenium 3.11.0
  • cv2 4.0.0
  • PIL 1.1.7
  • Chrome 76.0.3809.100
  • ChromeDriver 76.0.3809.126

Download and Installation

Denpendency Installation

Download ChromeDriver from https://chromedriver.chromium.org/downloads

brew install selenium-server-standalone
sudo pip install PIL
pip3 install virtualenv virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
export WORKON_HOME=$HOME/.virtualenvsexport PROJECT_HOME=$HOME/Develsource /usr/local/bin/virtualenvwrapper.sh
brew install opencv
echo /usr/local/opt/opencv/lib/python3.6/site-packages >> /usr/local/lib/python3.6/site-packages/opencv3.pth

Download

git clone https://github.com/lcyyzy/CaptchaCracker.git

Run

CaptchaCracker
python cracker.py

Implementation

Get Background and Puzzle Piece

In order to prevent being cracked, the background in the sources of the front end is often cut into many small pieces and displayed after re-splicing. The first step is to get the orginal background picture and the puzzle piece.

We can get the moving coordinates of each small background pieces from the elements of the front end and perform the inverse operation to restore the original background.

img img img

We can get the puzzle piece from the sources directly.

img

Get the Contour of Puzzle Piece and the Edge of Background

Extract the contour trajectory of the puzzle piece using cv2.findContours in the opencv and construct it into a two-dimensional matrix (operator).

img

Process the background by cv2.GaussianBlur and the Canny edge detection operator - cv2.Canny to find the edge in the background.

img

Find the Position of Puzzle Piece

Use cross-correlation operation to process the edge of background and the contour operator of the puzzle piece. The position with the largest value is the result.

We mark the upper left corner of the position with a red point to show its correctness.

img

Simulate Human Behavior

The server may check the track of the movement to determine whether it is human behavior or not. We should add some noises into the track and use selenium to simulate the dragging process.

img

captchacracker's People

Contributors

lcyyzy avatar

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.