Send Captchas from Python to GSA Captcha Breaker

Hi,

I have read several threads here, but I couldn't find the solution.
I would like to send Captcha Image from my python script to Captcha breaker. I tried the following:

#!/usr/bin/env python
#
# Decaptcher Python API Module
# By Brandon Smith (brandon.smith@studiobebop.net)
#
import requests

class decaptcher:
    def __init__(self, username, password, product_id=""):
        self.__action_url = "http://127.0.0.1:65535"
        self.__username = username
        self.__password = password
        self.__product_id = product_id

    def get_balance(self):
        data = {"function": "balance",
                "username": self.__username,
                "password": self.__password}
        request = requests.post(self.__action_url, data)
        return float(request.content)

    def solve_image(self, image_path):
        from PIL import Image
        img = Image.open('securimage_show.png')
        data = {"function": "picture2",
                "username": self.__username,
                "password": self.__password,
                "pict_to": "0",
                "pict_type": "0",
                "captcha_plattform":"Article Script",
                "pict": open(image_path, "rb").read()}
        request = requests.post(self.__action_url, data)
        answer = request.content.split("|")[-1]
        return answer

d = decaptcher("a", "b")
print d.solve_image('securimage_show.png')


But I always get the answer: "unknown"

Can anybody help, please?

Thanks

Comments

  • SvenSven www.GSA-Online.de
    Is 65535 even a good idea for a port? Well beside that it all should be fine. The Unknown is a result from CB when the image couldn't be decoded. Do you see something in CB log?
  • Don't know if it's a good idea for a port, but with GSA Ser everything works fine :)

    You mean if I see something in the lower part of the window of CB? (or does CB have a log (haven't found one in the install folder). As for the lower part of the window: no I don't see something.

    What image format does CB require?

    Thanks for your help!
  • SvenSven www.GSA-Online.de
    It can handle bmp, gif, png, jpg
  • If I change the file extrension to *jpg, I can see something in Captcha Breaker, but the image is "distorted". Only a few black dots and it says: "engine unknown", but I tried to specify an Engine as you can see in the code above.

    I tested with the image files from CB, so this isn't the mistake.

    Does CB require a special encoding like base64 ore something?

    Thanks
  • SvenSven www.GSA-Online.de
    no, you can send the image as normal multipart in post data.
  • Ok got it, now CB revieves the captcha. Forgot to send the multipart header ;)

    But a little problem remains, how can I tell CB which Engine to use?

    data = {"function": "picture2",
                    "username": self.__username,
                    "password": self.__password,
                    "pict_to": "0",
                    "pict_type": "0",
                    "captcha_plattform":"Article Script"}


    isn't "captcha_platform":"Article Script" correct?
    I also tried "engine":"Article Script", but didn't work either...

    Thanks
  • SvenSven www.GSA-Online.de

    "captcha_platform" is correct.

    "source_url" is another parameter you can use to have the URL in the log.

Sign In or Register to comment.