Giter Club home page Giter Club logo

captcha-tools's Introduction

Captcha Tools

Python module to help solve captchas with Capmonster, 2Captcha and Anticaptcha API's!

Go(lang)

To see documentation for the Go implementation, click here

Install

pip3 install captchatools
To update
pip3 install -U captchatools

How to use

Basic usage

import captchatools
solver = captchatools.new_harvester(solving_site="capmonster", api_key="YOUR API KEY", sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", captcha_url="https://www.google.com/recaptcha/api2/demo")
captcha_answer = solver.get_token()

or

from captchatools import new_harvester
solver = new_harvester(solving_site=1, api_key="YOUR API KEY", sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", captcha_url="https://www.google.com/recaptcha/api2/demo")
captcha_answer = solver.get_token()

new_harvester() Parameters:

Parameter Required Type Default Description
api_key true String - The API Key for the captcha solving site
solving_site true String (name of site) or int (site ID) "capmonster" The captcha solving site that will be used. Refer to the site IDs
sitekey true String - Sitekey from the site where captcha is loaded
captcha_url true String - URL where the captcha is located
captcha_type false String "v2" Type of captcha you are solving. Either captcha image, v2, v3,hcaptcha (hcap works aswell) or hcaptchaturbo
invisible_captcha false bool false If the captcha is invisible or not.
This param is only required when solving invisible captchas
min_score false double 0.7 Minimum score for v3 captchas.
This param is only required when solving V3 and it needs a higher / lower score
action false String "verify" Action that is associated with the V3 captcha.
This param is only required when solving V3 captchas
soft_id false int - 2captcha Developer ID.
Developers get 10% of spendings of their software users.

get_token() Parameters:

Field Required Type Description
b64_img false string Base64 encoded captcha image
This param is only required when solving image captchas
proxy false string Proxy to be used to solve captchas.
This will make the captcha be solved from the proxy ip

Format: ip:port:user:pass
proxy_type false string Type of the proxy being used. Options are:
HTTP, HTTPS, SOCKS4, SOCKS5
user_agent false string UserAgent that will be passed to the service and used to solve the captcha
rq_data false string Custom data that is used in some implementations of hCaptcha. Most of the times, you want to set the invisible_captcha param to true.

Examples

Example - V2 Captcha / Basic usage
from captchatools import new_harvester

def main():
    harvester = new_harvester(
        api_key="CHANGE THIS", 
        solving_site="capsolver",
        captcha_type="v2",
        sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
        captcha_url="https://www.google.com/recaptcha/api2/demo"
    )
    answer = harvester.get_token()
Example - V3 Captcha
from captchatools import new_harvester

def main():
    harvester = new_harvester(
    
        api_key="CHANGE THIS", 
        solving_site="capsolver",
        
        captcha_type="v3",
        sitekey="6LcR_okUAAAAAPYrPe-HK_0RULO1aZM15ENyM-Mf",
        captcha_url="https://antcpt.com/score_detector/",
        action="homepage",
        min_score=0.7
    )
    token = harvester.get_token()
Example - Image captcha
from captchatools import new_harvester

def main():
    harvester = new_harvester(
        api_key="CHANGE THIS", 
        solving_site="capsolver",
        captcha_type="image",
    )
    token = harvester.get_token(b64_img="iVBORw0KGgoAAAANSUhEUgAAAUQAAAAxCAYAAACictAAAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGt0lEQVR4nO1di23bMBC9bKBsIG+QbqBOUHcCa4N4A2uDeIIqGzgTRCNkg2qDaIO6EEABgmDxezz+7gEEglbm8emOj38KgMFgMBgMBoPBYDAYDAaDwWAwGAwGg8FgMBgMhjleAKAFgA4ArgDQi79fAaABgCohDq8rDv2KSyueyQE5+IuSV70TG1eR/1E8w7DEOwDcd9KYiK1GBMQkyX+dBgA4IVY2V15L+QcDDkvevUEFGAzyNklzBQ3pr1x5gfi/WfxuhrHxJfK2RSX4X0VePjWC0pbSgaoKF7Ot+UW+OQR8HQkvjMp70bATWjh8+StXXq8IHEaDOG9FAzsa5m8DSlvaGAkLgG2rNnyZJoFIzQurAs8BJkNI4fDpr1x5dYhcThpcbPK11QhKW1q4EBYA2xZGEMoCkZoXZiWeeyoQmXD49leuvDAF8a4x71ysINaEBfBhC6sC1JHwwq7IsQmHb3/lyqvTiK0l6dj5UvApVhBHwgJg22o18ulEa7hMVldirq/blKeOhNf6+UlUtKvgehRlb8TfsgWcJc2/pRSOOrC/cuW1FcRB/NucxxZzHmeNhZdG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bxCiuEMFsTIBLFxDGzZUIUFUV7ZsOcjMf1VAq/nwGI4gwUxMkGsDJ41HepUifYQayQ7Pm5YpvJX7ryeFYtnFGKYrCAeNVZDsVZIKW3prPA9I71kal4/AeAJ8E8ofARadKD2V868niIRw2QF0RaUe+hcbJ0Vw5UnC+HoA/O6i6BvxTzRk6ZAqo5rnZA+muVyHDCkv3Lg1SueP6ySydcGH6Ha5LdNMpGS2aoC28paECuNTyweNs+rhKOJQBDX6UucRunESYSfq3QUQy7Vt3dNKrzPL8iF9FfqvGTDfddkei2aS+oD28paEHVf5qh5CB+TH5YgUgcG9ubuWPyVOi8WRGBB1MHc2v5FEo46Q0GU3chj8jEirMYihL9y4MWCCCyIYBDw345BiD0hHYMgmoihz0WH0P7KgRcLIrAgmgajTQs9IV/b7iqIuld7Yd+HqJoHw/5SHJW/cuHFgggsiKaoRQv7V1NUMC9RxRLEWlzr9Sl6G6YCOVjOibUP7ltc0h/wAwp/5cKrkfB4lEzE+BE6T7b6wLaKRSNe9J/VV+p6sSrbevjmiC+8rPZCvgk+S1r4vAq+qXDK2V+l8GIwGAwGg8FgMBgMBoPBYDAYDAaDwWAwGAwGA/LEf2oS4NVP9R70AAAAAElFTkSuQmCC")
Example - Additional captcha data
from captchatools import new_harvester

def main():
    harvester = new_harvester(
        api_key="CHANGE THIS", 
        solving_site="capsolver",
        captcha_type="v2",
        sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
        captcha_url="https://www.google.com/recaptcha/api2/demo"
    )
    
    token = harvester.get_token(
        proxy="ip:port:user:pass", 
        proxy_type="http", 
        user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
    )

Supported Sites

Site-Specific Support:

Site Site ID Captcha Types Supported Task Types Supported
Capmonster captchatools.CapmonsterSite Image captchas,
Recaptcha V2,
Recaptcha V3,
HCaptcha
ImageToTextTask,
NoCaptchaTask,
NoCaptchaTaskProxyless,
RecaptchaV3TaskProxyless,
HCaptchaTaskProxyless
Anticaptcha captchatools.AnticaptchaSite Image captchas,
Recaptcha V2,
Recaptcha V3,
HCaptcha
ImageToTextTask,
RecaptchaV2Task
RecaptchaV2TaskProxyless,
RecaptchaV3TaskProxyless,
HCaptchaTaskProxyless
2Captcha captchatools.TwoCaptchaSite Image captchas,
Recaptcha V2,
Recaptcha V3,
HCaptcha
-
Capsolver captchatools.CapsolverSite Image captchas,
Recaptcha V2,
Recaptcha V3,
HCaptcha
HcaptchaTurbo
-
CaptchaAI captchatools.CaptchaAISite Image captchas,
Recaptcha V2,
Recaptcha V3,
HCaptcha
-

Recommendations

  1. For 2Captcha, don't run more than 60 tasks per API key.
  2. Handle errors appropriately.
    • If a ErrNoBalance is thrown, tasks should stop. Some sites will temporarily ban IP's if constant requests come in.

Errors

Errors Returned When
ErrNoBalance Balance is below 0 for captcha solving site
ErrWrongAPIKey Incorrect API Key for captcha solving site
ErrWrongSitekey Incorrect sitekey
ErrIncorrectCapType Incorrectly chose a captcha type. When initializing a new harvester. Refer to the captcha types
ErrNoHarvester When the user did not / incorrectly chose a captcha harvester. Refer to the "how to use" guide
Error Handling
from captchatools import new_harvester, exceptions as captchaExceptions,

def main():
    try:
        harvester = new_harvester()
        token = harvester.get_token()
    except captchaExceptions.NoHarvesterException:
        print("I need to set my captcha harvester!")

Changelog

1.4.1

What's new
  1. Added CaptchaAI
  2. Removed internal redundant code
  3. Fix creating a new harvester if pass in the ID

1.3.0

What's new
  1. Get Balance Support
  2. Proxy Support
  3. User Agent Support
  4. Text image captcha support
  5. Better internal handling
  6. Capsolver support
Important Changes
  • It is recommend to use the new_harvester function rather than the old captcha_harvesters

captcha-tools's People

Contributors

matthew17-21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

captcha-tools's Issues

Support for rqdata & rqtoken

Whenever i request a specific discord api url i get following response which includes rqdata and rqtoken as shown below:

        {
            "captcha_key":["Du musst deine App aktualisieren, um diesem Server beizutreten."],
            "captcha_sitekey":"a9b5fb07-92ff-493f-86fe-352a2803b3df",
            "captcha_service":"hcaptcha",
            "captcha_rqdata":"+PIKziyDja04lsUPMZV2v6fyfkEuk72TI/ZKxLth1GzbQ81z532xBuGK5U4GBJZV6ss2ivfpsw3BZTCySJ0hsQacbptBlkhEgeKeBlP6aZZM1zYpZyU9k+BKmbVwtXqBQRggxyA9eun/10j98zOxZAr6sudpBbLL/aPMqCiC",
            "captcha_rqtoken":"IjdVWlVEMWk0NlJtUjJUWGxpUmsrSXN3bUxJbTdTTWJ1SEVuSTE0QjFIanFPbk5IT2xTTGhSb1FDMGRVRVM4RFVjUDZVekE9PXAzMEt1K1Y2c0Zwdm1EcVQi.ZWDKZA.OfU1PsN0Cyk97jiVjDOdt_BJGt4"
        }

Now, if i remember correctly, services like capsolver or anitcaptcha allow you to provide those in the solving request, yet i havn't fund such an option within the captchatools libary. would be great if anyone could help me out.

Regards,
FuckingToasters

Captha Solving using capmonster

Hello, i think i almost got it to work. however i searched a lot but i found no docs telling me what attribute im supposed to use so it actually solve the capthas. I only found how i need to define different variables. but variables alone wont run the module.... here this is the code i made so far. It prints the code out correctly but the issure is, it not solve the captha:

solver = captchatools.captcha_harvesters(solving_site="capmonster", api_key="my key where here", sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", captcha_url="https://www.google.com/recaptcha/api2/demo")
captcha_answer = solver.get_token()
print(captcha_answer)

captha solving

Hello, i tried to use this module for solving capthas but i dont know where i can get the sitekey and the captha_url....
Adittionaly it would be nice, if hcpatha support becomes added.

question

harvester = new_harvester(
api_key="CHANGE THIS",
solving_site="capsolver",
captcha_type="v2",
sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
captcha_url="https://www.google.com/recaptcha/api2/demo"
)
Its just a basic question about rechaptha
if i use this to solve rechaptcha v2, how the service know the task, when i only provide information about the site, and nothing about the current session or something.

funcaptcha support?

hey man, i think one of the most used captchas around is funcaptcha :D

are u planning to integrate funaptcha anytime soon ? i'd love to integrate captchatools to my programs for funcaptcha captchas

Invalid Sitekey error even tho it's correct.

Hello, i used capmonster so far and the invalid Sitekey issue did not happen however capmonster is flagged on my target so i started using 2captcha which then gave me the invalid Sitekey error. I then checked if the Sitekey is correct and it is. Is there any solution for it? Complete errorlog:

File "/usr/local/lib/python3.9/site-packages/captchatools/twocap.py", line 64, in get_id
    raise captchaExceptions.WrongSitekeyException()
captchatools.exceptions.WrongSitekeyException: [captchatools] Incorrect google sitekey

Callback-Function

Hello, i read the article https://2captcha.com/2captcha-api#solving_recaptchav2_new and because the site, where i try to solve the captcha do not have a button that need to be pressed after the captcha is solved, it tells me that i need to call a callbackfunction. However i do not find the name of this function on the Website. Does anyone probably could tell me what the callbackfunction from discord.com/register is? Would be really kind.

installation integration help

hello i have a python tool with pyautogui and it log in a site, then there is the captcha

i dont understand to install this git
i installed the package and import it in the python file
i edded a def with example

import captchatools solver = captchatools.captcha_harvesters(solving_site="capmonster", api_key="YOUR API KEY", sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", captcha_url="https://www.google.com/recaptcha/api2/demo") captcha_answer = solver.get_token()

but what now how i tell the script use the captchatools to solve and go on with the script

soft_id support

You could do soft_id support.
If soft_id isnt set, you can put ur own soft_id in there and you could even do some money...

Google Sitekey

I get the erorr: '[captchatools] Incorrect google sitekey'
even tho i dont use google or anything

Mail.ru Sitekey

Hello, i read the existing issues and the blog how to obtain the sitekey. this worked on google but i can not find the sitekey on mail.ru
I found out that they just show a url that generate the captcha each tme and display it into the frame Mail.ru Captcha Generation Website I then thought that within the URL at r=0.5546017180093742 the sitekey is 0.5546017180093742 but this was not the case as i got this Traceback: captchatools.exceptions.WrongSitekeyException: [captchatools] Incorrect google sitekey

Here the code i have so far:

elif option == "8":
    url="https://e.mail.ru/settings/aliases"

    headers = {
        "accept-encoding": "gzip, deflate, br",
        "accept-language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 OPR/81.0.4196.31",
        "Content-Type": "application/json"

    }
    data = {
        "username": "[email protected]",
        "Login": "[email protected]",
        "password": "secret",
        "Password": "secret",
        "saveauth": "1"
    }

    response = requests.post(url, headers=headers, data=json.dumps(data))
    print(response)
    solver = captcha_harvesters(solving_site=1, api_key="here_was_my_key",
                                sitekey="0.5546017180093742",
                                captcha_url="https://c.mail.ru/c/0?r=0.5546017180093742")
    prnt("Solving the Captcha...")
    captcha_answer = solver.get_token()
    print(captcha_answer)
    ```

Incorrect google sitekey

Hi, when using anticaptcha i always get incorrect google sitekey issue even tho the sitekey is correct. i've looked in devtools network tab to confirm that it's correct and it cam out that it is. this is a url it requested to:

https://hcaptcha.com/checksiteconfig?v=1f7dc62&host=discord.com&sitekey=f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34&sc=1&swa=1

As you can see, the sitekey is f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34 which i use in my phone verifier. It worked fine for some time but now this issue happen and i don't know why -> key haven't changed.

Do you got any solution for that?

Report incorect solves

Hello is there a way to report incorect solves ? For 2cap f.e I would need the specific task_id

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.