vHackXT-MoneyBot icon indicating copy to clipboard operation
vHackXT-MoneyBot copied to clipboard

Captcha

Open Lord-Evil opened this issue 7 years ago • 2 comments

Btw, instead of using complex image recognition algos there's simpler way I've discoverd, Python method:

import base64
from PIL import Image
import io
def readPort(base64str):
    tablePort={75:"0",36:"1",48:"2",56:"3",55:"4",58:"5",47:"6",44:"7",62:"8",69:"9"}
    pic=base64.b64decode(base64str)
    i=Image.open(io.BytesIO(pic))
    digits=list()
    digit=0
    for x in range(0,i.width):
        row=0
        for y in range(0,i.height):
            p=i.getpixel((x,y))
            if(p==1):
                digit+=p
                row=1
        if(not row):
            if(digit):digits.append(digit)
            digit=0
    try:
        captcha=""
        for d in digits:
            captcha+=tablePort[d]   
        return int(captcha)
    except:
        return digits

Each digit has always the same amount of pixels excluding some noise pixels with values >1

Lord-Evil avatar Jul 13 '17 03:07 Lord-Evil

Cool, thanks for the suggestion. The image recognition I use is Tesseract OCR, and its loaded on my VPS. It takes less a very short amount of time to process such a small image, and also doesn't use up many resources on my vps, but it would still be good to not have it rely on my server staying online.

MrSonicMaster avatar Jul 13 '17 06:07 MrSonicMaster

I never had much experience with image recognition software and the one I've tried to use at fist didn't do a good job solving this "captcha", so it just hit me that chars might have the same amount of pixels if noises are removed :-D

Lord-Evil avatar Jul 14 '17 10:07 Lord-Evil