Gocaptcha - An API wrapper for popular captcha solvers such as AntiCaptcha and 2Captcha in Golang

gocaptcha

An API wrapper for popular captcha solvers such as AntiCaptcha and 2Captcha in Golang

Installation

Run the following command in your project folder: go get github.com/justhyped/gocaptcha

Support

Type 2Captcha AntiCaptcha CapMonster Cloud
RecaptchaV2
RecaptchaV3
Image Recaptcha
HCaptcha

Software like XEVil and CapMonster are also supported, but it gets a little trickier. Such software runs on a local ip:port so you must specify that with CustomServiceUrl (don't include the protocol as it defaults to http)

If you intend to use XEVil or CapMonster with this program you should check which API it supports (Either 2Captcha or AntiCaptcha). Don't forget to add firewall rules and host the captcha software on a public port when using XEVil or CapMonster between different machines.

Usage

RecaptchaV2

    payload := gocaptcha.RecaptchaV2Payload{
	EndpointUrl:   "https://www.google.com/recaptcha/api2/demo",
        EndpointKey:   "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
        ServiceApiKey: "key",
        ServiceName:   "2Captcha",
	}
	
    captcha, err := gocaptcha.SolveRecaptchaV2(&payload)
    
    // use captcha.ReportGoodRecaptcha() or captcha.ReportBadCaptcha() to help the provider improve their services.

These are all supported variables to use in RecaptchaV2Payload:

    	// This is the endpoint that has Recaptcha Protection
EndpointUrl string

// This is the Recaptcha Key
// Can be found on the Endpoint URL page
EndpointKey string

// The API key for your captcha service
ServiceApiKey string

// The name of the captcha service
// Can be AntiCaptcha, 2Captcha or CapMonster Cloud
ServiceName string

// Enable if endpoint has invisible Recaptcha V2
IsInvisibleCaptcha bool

// Set this in case you're using a custom solver like CapMonster (not cloud)
CustomServiceUrl string

// The time to wait before starting to poll result
InitialWaitTime int

// The time to wait between polling results
PollInterval int

// Max amount of poll attempts
MaxRetries int

RecaptchaV3

    payload := gocaptcha.RecaptchaV3Payload{
EndpointUrl:   "https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php",
EndpointKey:   "6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696",
ServiceApiKey: "key",
ServiceName:   "2Captcha",
Action:        "examples/v3scores",
}

captcha, err := gocaptcha.SolveRecaptchaV3(&payload)

// use captcha.ReportGoodRecaptcha() or captcha.ReportBadCaptcha() to help the provider improve their services.

These are all supported variables to use in RecaptchaV3Payload:

// This is the endpoint that has Recaptcha Protection
EndpointUrl string

// This is the Recaptcha Key
// Can be found on the Endpoint URL page
EndpointKey string

// The API key for your captcha service
ServiceApiKey string

// The name of the captcha service
// Can be AntiCaptcha, 2Captcha or CapMonster Cloud
ServiceName string

// The action name of the recaptcha, you can find it in source code of site
Action string

// Set this in case you're using a custom solver like CapMonster (not cloud)
CustomServiceUrl string

// Set to true if it's V3 Enterprise
IsEnterprise bool

// Defaults to 0.3, accepted values are 0.3, 0.6, 0.9
MinScore float32

// The time to wait before starting to poll result
InitialWaitTime int

// The time to wait between polling results
PollInterval int

// Max amount of poll attempts
MaxRetries int

HCaptcha

    payload := gocaptcha.HCaptchaPayload{
        EndpointUrl:   "https://www.hcaptcha.com/",
        EndpointKey:   "00000000-0000-0000-0000-000000000000",
        ServiceApiKey: "key",
        ServiceName:   "2Captcha",
    }

    captcha, err := gocaptcha.SolveHCaptcha(&payload)

    // use captcha.ReportGoodRecaptcha() or captcha.ReportBadCaptcha() to help the provider improve their services.

These are all supported variables to use in HCaptchaPayload:

// This is the endpoint that has Recaptcha Protection
EndpointUrl string

// This is the HCaptcha Key
// Can be found on the Endpoint URL page
EndpointKey string

// The API key for your captcha service
ServiceApiKey string

// The name of the captcha service
// Can be AntiCaptcha, 2Captcha or CapMonster Cloud
ServiceName string

// Set this in case you're using a custom solver like CapMonster (not cloud)
CustomServiceUrl string

// The time to wait before starting to poll result
InitialWaitTime int

// The time to wait between polling results
PollInterval int

// Max amount of poll attempts
MaxRetries int

Image Captcha

payload := gocaptcha.ImageCaptchaPayload{
    ServiceApiKey: "key", // your api key
    ServiceName:   "2Captcha", // the provider, can be 2Captcha, AntiCaptcha or Capmonster Cloud
    Base64String:  imageBase64, // the image converted to a base64 string
}

captcha, err := gocaptcha.SolveImageCaptcha(&payload)

// don't mind the naming, this also works for image captcha's.
// use captcha.ReportGoodRecaptcha() or captcha.ReportBadCaptcha() to help the provider improve their services.

These are all supported variables to use in ImageCaptchaPayload:

    // This is the base64 that represents the image captcha
	Base64String string

	// The API key for your captcha service
	ServiceApiKey string

	// The name of the captcha service
	// Can be AntiCaptcha, 2Captcha or CapMonster Cloud
	ServiceName string

	// Set this in case you're using a custom solver like CapMonster (not cloud)
	CustomServiceUrl string

	// Set to true if captcha is case sensitive
	CaseSensitive bool

	// Set this if the human solver needs additional information
	// about how to solve the captcha
	InstructionsForSolver string

	// The time to wait before starting to poll result
	InitialWaitTime int

	// The time to wait between polling results
	PollInterval int

	// Max amount of poll attempts
	MaxRetries int

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Similar Resources

A small, fast, reliable pastemyst API wrapper written in Golang

A small, fast, reliable pastemyst API wrapper written in Golang. Official pastemyst API docs found here.

Dec 12, 2022

SpamProtection-Go is an Official golang wrapper for Intellivoid SpamProtection API

SpamProtection-Go is an Official golang wrapper for Intellivoid SpamProtection API

SpamProtection-Go is an Official golang wrapper for Intellivoid SpamProtection API, which is fast, secure and requires no additional packages to be installed.

Feb 26, 2022

Unofficial Anilist.co GraphQL API wrapper for GoLang.

anilistWrapGo Unofficial Anilist.co GraphQL API wrapper for GoLang. Examples All examples are present as tests in test directory. Below are a few snip

Dec 20, 2022

Pterodactyl API wrapper written in Golang

WARNING That repository isn't available for production environment. Many endpoints aren't yet implemented. Be careful if you are using that module. pt

Oct 4, 2022

A Wrapper of the Piston API in Golang

Go-Piston! This is a Go wrapper for working with the Piston API. It supports both the endpoints, namely runtimes and execute, mentioned here. 💻 Insta

Aug 28, 2022

Golang wrapper for the FiveM natives API

Golang wrapper for the FiveM natives API

Dec 2, 2022

Golang API wrapper of OkEX

A complete golang wrapper for Okex V5 API. Pretty simple and easy to use. For more info about Okex V5 API read here.

Nov 15, 2022

Golang wrapper for the Sylviorus antispam API for telegram

Syl-Go Golang wrapper for the Sylviorus antispam API for telegram package test

Jan 2, 2022

A complete and simple wrapper for the Hypixel API

Gopixel A simple and complete1 wrapper for the hypixel API Key features Full API coverage1 Autocomplete for fields Near complete structs MIT license I

Apr 26, 2022
Comments
  • Integrate capsolver

    Integrate capsolver

    Hey, it's possible that you integrate capsolver.com, they have the cheapest and fastest captcha solution of the whole market. They can solve hcaptcha, recaptcha, amazon waf captcha, turnstile, kasada, akamai, funcaptcha, datadome captcha, geetest etc... Also you can check their documentation here: https://docs.capsolver.com/

lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin to AWS Lambda and Amazon API Gateway.

aws-lambda-go-api-proxy makes it easy to run Golang APIs written with frameworks such as Gin with AWS Lambda and Amazon API Gateway.

Jan 6, 2023
A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

Mar 5, 2022
The wazuh-integratord is a daemon that allows Wazuh to connect to external APIs and alerting tools such as Slack, VirusTotal and PagerDuty.

The wazuh-integratord is a daemon that allows Wazuh to connect to external APIs and alerting tools such as Slack, VirusTotal and PagerDuty.

Apr 22, 2022
starenv allows populating environmental variables from variety of sources, such as AWS Parameter Store, GPG encrypted files and more, with extreme ease.

starenv (*env) allows populating environmental variables from variety of sources, such as AWS Parameter Store, GPG encrypted files and more, with extr

Nov 25, 2022
The NVD API is an unofficial Go wrapper around the NVD API.

NVD API The NVD API is an unofficial Go wrapper around the NVD API. Supports: CVE CPE How to use The following shows how to basically use the wrapper

Jan 7, 2023
A Wrapper Client for Google Spreadsheet API (Sheets API)

Senmai A Wrapper Client for Google Spreadsheet API (Sheets API) PREPARATION Service Account and Key File Create a service account on Google Cloud Plat

Nov 5, 2021
It's so many regular expression forms are difficult to understand, such as perl, python, grep awk

Introduction Jamie Zawinski: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. It

Mar 31, 2022
Simple golang airtable API wrapper

Golang Airtable API A simple #golang package to access the Airtable API. Table of contents Golang Airtable API Table of contents Installation Basic us

Jan 5, 2023
This is a Golang wrapper for working with TMDb API. It aims to support version 3.
This is a Golang wrapper for working with TMDb API. It aims to support version 3.

This is a Golang wrapper for working with TMDb API. It aims to support version 3. An API Key is required. To register for one, head over to themoviedb

Dec 27, 2022
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)
⚡️ SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang)

Gosip - SharePoint authentication, HTTP client & fluent API wrapper for Go (Golang) Main features Unattended authentication using different strategies

Jan 2, 2023