Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()
@ItsRohan0165
Copy link

ItsRohan0165 commented Aug 24, 2020

how do i decode such captcha?? can you help!!!
5832

@Jonakss
Copy link

Jonakss commented Sep 16, 2020

Hi
how can i do it ?

image
image
image
image

Have you progress with this. I doing it right now.

@niraj-lal-rahi
Copy link

niraj-lal-rahi commented Sep 27, 2020

screenshot

Trying to resolve above captcha code, any help?

Tried Code below

captcha_text = image_to_string(Image.open('screenshot.png'))
print( captcha_text)

@rlsblogse
Copy link

rlsblogse commented Oct 23, 2020

hello,
how do we solve this to TEXT

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRFmJiY////AAAAaGhowMDA5OTk9PT0NjY26ES/zwAAB69JREFUeNrs3ct22zYARVHQePD//7iS3GQ5qZOKkmySuPsMOmhXBza2QQCWibIouuJbAIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAAAOBbAIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgA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AASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAOhV/SPAAJk9UICWCrftAAAAAElFTkSuQmCC

@raylison100
Copy link

raylison100 commented Nov 3, 2020

Olá, alguma sugestão de texto cruzado por várias linhas curvas com o mesmo peso?

download-3
download-4
download-6
download-7
download-2
download-5

Have you made any progress? I have this same captcha.

@omar1024
Copy link

omar1024 commented Jan 21, 2021

Please paste your requirements.txt.
I have installed

sudo apt-get install libopencv-dev python-opencv
pip install cv2

But I still get an error saying

ImportError: No module named cv2

use
pip install opencv-python
to install cv2

@tradigrada1
Copy link

tradigrada1 commented Jan 22, 2021

@haltcompiler
Copy link

haltcompiler commented Feb 9, 2021

hello,
how do we solve this to TEXT

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRFmJiY////AAAAaGhowMDA5OTk9PT0NjY26ES/zwAAB69JREFUeNrs3ct22zYARVHQePD//7iS3GQ5qZOKkmySuPsMOmhXBza2QQCWibIouuJbAIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAAAOBbAIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAA/62/7VAHAAAAjlEDAAAAAAAgFUDZA8AAIBuAGQAAAA5SBQAAAIIBrAAAYBcQDODNDBANYACQDaADAAAAwQAaAADYBeQCGGaA8BmgAAAAAMEAKgAAAACAXUDqLmA1A2TPAG8AAABA8CMAgGwAHYBsAPucBNsF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2dr6liivio1eAZz73qizAmjt677rW18S5nXxu+zT1q8isPkNUQWAfTbq65dc2rj9RaEdgN1Oakrff/zPfW/cyQFcHsCvfRI88KLgAsCeAK5Pgv4yA+2BCyP6AGBXAO8Gdln/uzn0IABuV0U+beCxS6PcHXwMALd54JkjuUevjXN7+GEAvK8J+7cO/8kvjp0PwPud0VsRPHF1bAfgaAA23h492jM3iNcBwCEB/FDwVwajt/Lk9fFtAeC4AH48Eq4QWu993Oqj99ZKqU+O/RQTQAKAr+z0EwAAz00ACwDRADoA0QBm+DgVAI+3DgCiAbQFgGQAc3yeFoDoBwAA0TsAANIXAACELwAACD4CBCD6d0AAPLcBACAZwDrP8AOQPv4AJD//AXho/AFIBlDmGn4Atp7/zTb+AGxa/rVlASAXQB0LAMEAJvzxByD8xx+A5Kf/uQH09Vs3f8sCwOHmgNXePxrAU3/UvWX4+7IAcMzGw691uPvZP/nwn/5dwWN85TRQA96kfPovcSy9rH74cwG87wlKffXotzEWAM40E7SXTQTX0V9Smuopd0FQnx/8viQ12TJn3N7789jLX9aa9JM/KYD3ncGldmFwt4Pr0AeO/awAflkd3l4HdbFQ11s/h3xdL//u8l9a66EjnwHg97nh47NiXP8Zn0ujABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAQCAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAOhV/SPAAJk9UICWCrftAAAAAElFTkSuQmCC

try this in python3

import base64
data = "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAMAAADDpiTIAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJl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cwG87wlKffXotzEWAM40E7SXTQTX0V9Smuopd0FQnx/8viQ12TJn3N7789jLX9aa9JM/KYD3ncGldmFwt4Pr0AeO/awAflkd3l4HdbFQ11s/h3xdL//u8l9a66EjnwHg97nh47NiXP8Zn0ujABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAQCAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAOhV/SPAAJk9UICWCrftAAAAAElFTkSuQmCC"
imgdata = base64.b64decode(data)
filename = 'some_image.jpg'
with open(filename, 'wb') as f:
f.write(imgdata)

@lol-1-afk
Copy link

lol-1-afk commented Apr 27, 2021

image
this?

@anhtuan0030
Copy link

anhtuan0030 commented Aug 14, 2021

@forum2k9 I solved the first one with convert and Tesseract:

$ convert ofdbmf.jpg -colorspace Gray -blur 0 -level 0,60% ofdbmf-1.jpg
$ tesseract -psm 8 ofdbmf-1.jpg -
OFDBMF

I posted the details at https://mathieularose.com/decoding-captchas

Olá, alguma sugestão de texto cruzado por várias linhas curvas com o mesmo peso?
download-3
download-4
download-6
download-7
download-2
download-5

Have you made any progress? I have this same captcha.

Hello sir, do you resolve this? can you share with us pls?

@forum2k9 can you help us too?

Thanks!

@neodouglas
Copy link

neodouglas commented Nov 29, 2021

how i can solve that?
007444
002952
002963
004058
004967
005589

@AlexanderMortimer
Copy link

AlexanderMortimer commented Dec 6, 2021

it is not working for my captcha @jtanori
1

@DiMiTriFrog
Copy link

DiMiTriFrog commented May 13, 2022

it is not working for my captcha @jtanori
1

Any solutions nowadays?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment