Skip to content

How to Integrate CB with a custom Python script?

edited July 2017 in GSA Captcha Breaker
I'm writing a custom script in python and would like to use CB for captcha solving. The captchas are easy and brute force is giving me 90+ success rate.

But I have no clue how to integrate CB with my script.
@s4nt0s advised me this:

If you go into your GSA CB installation directory and go to folder called source, there might be an example there to help you.
But that didn't really help. Calling out @Sven or anyone who can help in this regard. :)


  • SvenSven
    You can take any of the simulated captcha servic apis (preferable one) and exchange their domain with and it will work fine with our tool.

    See here:
  • edited July 2017
    Re: How to integrate GSA Captcha Breaker with Python 

    Thanks @Sven
    Okay, made SOME progress. But I'm getting "unknown" for every request. Here's my code:

    import os
    import requests
    class decaptcher:
        def __init__(self, username, password, product_id=""):
            self.__action_url = ""
            self.__username = username
            self.__password = password
            self.__product_id = product_id
        def solve_image(self, image_path):
        from PIL import Image
        img ='cap.jpg')
        data = {"function": "picture2",
                "username": self.__username,
                "password": self.__password,
                "pict_to": "0",
                "pict_type": "0",
                "pict": open(image_path, "rb").read()}
        request =, data)
        answer = request.content.split("|")[-1]
        return answer
    d = decaptcher("a", "b")
    print d.solve_image('cap.jpg')

    I'm not sure if CB is even receiving the request as nothing shows up in the log (bottom right of CB window).
    I've tried changing the captcha_platform to different things like "Article Script" etc.
  • SvenSven
    you can check if CB gets your request if it appears in the log of it. Replying with Unknown is happening if you it was not able to solve it.

    Also use "captcha_platform" with the same name as you call the captcha type in CB. Thats not required but helps to identify the captcha typebetter.
  • The decapthcher API method didn't work for me. 

    import requests
    session = requests.session()
    r = session.get("")
    files = {"file": open("captcha.jpg", 'rb')}
    r2 ="", files=files)
    answer = r2.content[102:107]
    return answer

    The captcha has 5 letters hence r2.content[102:107].

    It's not a super effective approach but it works.

  • SvenSven
    OK but this works right?
  • Yes, it does for captchas that are 5 characters long. This line can be modified for captchas with different length:
    answer = r2.content[102:107]

Sign In or Register to comment.