diff --git a/README.md b/README.md index 578a1bc..7b755e0 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ Examples of API requests for different captcha types are available on the [C++ c - [GeeTest v4](#geetest-v4) - [Amazon WAF](#amazon-waf) - [Altchacaptcha](#altchacaptcha) + - [Atbcaptcha](#atbcaptcha) + - [Mtcaptcha](#mtcaptcha) + - [Friendlycaptcha](#friendlycaptcha) + - [Tencent](#tencent) + - [Datadome](#datadome) - [Other methods](#other-methods) - [send / getResult](#send--get_result) - [balance](#balance) @@ -416,6 +421,60 @@ Use this method to solve Altchacaptcha and obtain a token to bypass the protecti cap.set_page_url ("https://site.com/"); ``` +### Atbcaptcha +Use this method to solve Atbcaptcha and obtain a token to bypass the protection. + +```c++ + api2captcha::captcha_t cap; + cap.set_param("method", "atb_captcha"); + cap.set_param("app_id", "af23e041b22d000a11e22a230fa7777c"); + cap.set_param("api_server", "https://cap.aisecurius.com"); + cap.set_param("pageurl", "https://mysite.com/page/with/atbcaptcha"); +``` + +### Mtcaptcha +Use this method to solve Mtcaptcha and obtain a token to bypass the protection. + +```c++ + api2captcha::captcha_t cap; + cap.set_param("method", "mt_captcha"); + cap.set_param("sitekey", "MTPublic-KzqLY1cKH"); + cap.set_param("pageurl", "https://2captcha.com/demo/mtcaptcha"); +``` + +### Friendlycaptcha +Use this method to solve Friendlycaptcha and obtain a token to bypass the protection. + +```c++ + api2captcha::captcha_t cap; + cap.set_param("method", "friendly_captcha"); + cap.set_param("sitekey", "FCMST5VUMCBOCGQ9"); + cap.set_param("pageurl", "https://mysite.com/page/with/FriendlyCaptcha"); +``` + +### Tencent +Use this method to solve Tencent and obtain a token to bypass the protection. + +```c++ + api2captcha::captcha_t cap; + cap.set_param("method", "tencent"); + cap.set_param("app_id", "2092215077"); + cap.set_param("pageurl", "https://mysite.com/page/with/tencent"); +``` + +### Datadome +Use this method to solve Datadome and obtain a token to bypass the protection. + +```c++ + api2captcha::captcha_t cap; + cap.set_param("method", "datadome"); + cap.set_param("captcha_url", "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA..."); + cap.set_param("pageurl", "https://example.com/"); + cap.set_param("userAgent", "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.3"); + cap.set_param("proxytype", "HTTPS"); + cap.set_param("proxy", "login:password@IP_address:PORT"); +``` + ## Other methods ### send / get_result diff --git a/api2captcha.hpp b/api2captcha.hpp index 7825780..81aea5f 100644 --- a/api2captcha.hpp +++ b/api2captcha.hpp @@ -60,6 +60,11 @@ namespace api2captcha files_t files_; protected: + public: + captcha_t() {}; + // make polymorphic + virtual ~captcha_t() {} + void set_param(const std::string &name, const std::string &value) { params_[name] = value; @@ -70,19 +75,13 @@ namespace api2captcha files_[name] = value; } - captcha_t() {}; - - public: - // make polymorphic - virtual ~captcha_t() {} - const std::string &id() const { return id_; } const std::string &code() const { return code_; } void set_id(const std::string &s) { id_ = s; } void set_code(const std::string &s) { code_ = s; } - void set_user_agent(const std::string &s) + void set_user_agent(const std::string &s) { params_["userAgent"] = s; }; @@ -198,7 +197,7 @@ namespace api2captcha void set_challenge_script(const std::string &challenge_script) { set_param("challenge_script", challenge_script); }; void set_captcha_script(const std::string &captcha_script) { set_param("captcha_script", captcha_script); }; - void set_header_acao(const int header_acao) { set_param("header_acao", std::to_string(header_acao)); } + void set_header_acao(const int header_acao) { set_param("header_acao", std::to_string(header_acao)); } }; class geetest_v4_t : public captcha_t @@ -211,7 +210,7 @@ namespace api2captcha void set_captcha_id(const std::string &captcha_id) { set_param("captcha_id", captcha_id); }; void set_risk_type(const std::string &risk_type) { set_param("risk_type", risk_type); }; - void set_header_acao(const int header_acao) { set_param("header_acao", std::to_string(header_acao)); } + void set_header_acao(const int header_acao) { set_param("header_acao", std::to_string(header_acao)); } void set_pingback(const std::string &pingback) { set_param("pingback", pingback); }; void set_pageurl(const std::string &pageurl) { set_param("pageurl", pageurl); }; }; @@ -399,7 +398,8 @@ namespace api2captcha class prosopo_t : public captcha_t { public: - prosopo_t(){ + prosopo_t() + { set_param("method", "prosopo"); } @@ -410,7 +410,8 @@ namespace api2captcha class captchafox_t : public captcha_t { public: - captchafox_t(){ + captchafox_t() + { set_param("method", "captchafox"); } @@ -453,7 +454,8 @@ namespace api2captcha class yandex_t : public captcha_t { public: - yandex_t(){ + yandex_t() + { set_param("method", "yandex"); } @@ -464,7 +466,8 @@ namespace api2captcha class turnstile_t : public captcha_t { public: - turnstile_t(){ + turnstile_t() + { set_param("method", "turnstile"); } @@ -472,7 +475,6 @@ namespace api2captcha void set_url(const std::string &s) { set_param("pageurl", s); }; }; - class vk_t : public captcha_t { public: @@ -491,7 +493,8 @@ namespace api2captcha class altchacaptcha_t : public captcha_t { public: - altchacaptcha_t(){ + altchacaptcha_t() + { set_param("method", "altcha"); } @@ -509,7 +512,7 @@ namespace api2captcha std::string api_key_; int soft_id_ = 4586; std::string callback_; - int default_timeout_ = 120; // sec + int default_timeout_ = 120; // sec int recaptcha_timeout_ = 600; // sec int polling_interval_ = 10; // sec bool last_captcha_has_callback_ = false; diff --git a/examples/Makefile b/examples/Makefile index f2774ed..bdee87c 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -18,7 +18,8 @@ GPP = g++ CC_OPT = $(OPTIM) -std=c++17 -Wall -pipe $(INC_DIR) all: normal canvas capy coordinates funcaptcha geetest grid keycaptcha recaptcha \ - rotate text vkimage vkcaptcha temu yandex turnstile geetest_v4 amazonwaf + rotate text vkimage vkcaptcha temu yandex turnstile geetest_v4 amazonwaf \ + atbcaptcha mtcaptcha friendlycaptcha tencent datadome normal: normal.o $(GPP) ${OPTIM} -Wall -o normal normal.o $(LIB_DIR) $(LIB_FILES) @@ -78,7 +79,22 @@ geetest_v4: geetest_v4.o $(GPP) ${OPTIM} -Wall -o geetest_v4 geetest_v4.o $(LIB_DIR) $(LIB_FILES) amazonwaf: amazonwaf.o - $(GPP) ${OPTIM} -Wall -o amazonwaf amazonwaf.o $(LIB_DIR) $(LIB_FILES) + $(GPP) ${OPTIM} -Wall -o amazonwaf amazonwaf.o $(LIB_DIR) $(LIB_FILES) + +atbcaptcha: atbcaptcha.o + $(GPP) ${OPTIM} -Wall -o atbcaptcha atbcaptcha.o $(LIB_DIR) $(LIB_FILES) + +mtcaptcha: mtcaptcha.o + $(GPP) ${OPTIM} -Wall -o mtcaptcha mtcaptcha.o $(LIB_DIR) $(LIB_FILES) + +friendlycaptcha: friendlycaptcha.o + $(GPP) ${OPTIM} -Wall -o friendlycaptcha friendlycaptcha.o $(LIB_DIR) $(LIB_FILES) + +tencent: tencent.o + $(GPP) ${OPTIM} -Wall -o tencent tencent.o $(LIB_DIR) $(LIB_FILES) + +datadome: datadome.o + $(GPP) ${OPTIM} -Wall -o datadome datadome.o $(LIB_DIR) $(LIB_FILES) .cpp.o: $(GPP) $(CC_OPT) $(DEFINES) -o $@ -c $< @@ -86,7 +102,7 @@ amazonwaf: amazonwaf.o clean: rm -rf core *~ *.o normal canvas capy coordinates funcaptcha geetest grid hcaptcha \ keycaptcha recaptcha rotate text lemin vkimage vkcaptcha temu yandex turnstile geetest_v4 \ - amazonwaf + amazonwaf atbcaptcha mtcaptcha friendlycaptcha tencent datadome strip: $(PROG) strip $(PROG) diff --git a/examples/atbcaptcha.cpp b/examples/atbcaptcha.cpp new file mode 100644 index 0000000..6d6f44b --- /dev/null +++ b/examples/atbcaptcha.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./atbcaptcha \"API KEY\"\n"); + return 0; + } + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + api2captcha::captcha_t cap; + cap.set_param("method", "atb_captcha"); + cap.set_param("app_id", "af23e041b22d000a11e22a230fa7777c"); + cap.set_param("api_server", "https://cap.aisecurius.com"); + cap.set_param("pageurl", "https://mysite.com/page/with/atbcaptcha"); + + try + { + client.solve (cap); + printf ("code '%s'\n", cap.code ().c_str ()); + } + catch (std::exception & e) + { + fprintf (stderr, "Failed: %s\n", e.what ()); + } + + return 0; +} diff --git a/examples/datadome.cpp b/examples/datadome.cpp new file mode 100644 index 0000000..9587e99 --- /dev/null +++ b/examples/datadome.cpp @@ -0,0 +1,46 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./datadome \"API KEY\"\n"); + return 0; + } + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + api2captcha::captcha_t cap; + + cap.set_param("method", "datadome"); + cap.set_param("captcha_url", "https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAA..."); + cap.set_param("pageurl", "https://example.com/"); + cap.set_param("userAgent", "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.3"); + cap.set_param("proxytype", "HTTPS"); + cap.set_param("proxy", "login:password@IP_address:PORT"); + + + try + { + client.solve (cap); + printf ("code '%s'\n", cap.code ().c_str ()); + } + catch (std::exception & e) + { + fprintf (stderr, "Failed: %s\n", e.what ()); + } + + return 0; +} diff --git a/examples/friendlycaptcha.cpp b/examples/friendlycaptcha.cpp new file mode 100644 index 0000000..89accff --- /dev/null +++ b/examples/friendlycaptcha.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./friendlycaptcha \"API KEY\"\n"); + return 0; + } + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + api2captcha::captcha_t cap; + cap.set_param("method", "friendly_captcha"); + cap.set_param("sitekey", "FCMST5VUMCBOCGQ9"); + cap.set_param("pageurl", "https://mysite.com/page/with/FriendlyCaptcha"); + + try + { + client.solve (cap); + printf ("code '%s'\n", cap.code ().c_str ()); + } + catch (std::exception & e) + { + fprintf (stderr, "Failed: %s\n", e.what ()); + } + + return 0; +} diff --git a/examples/mtcaptcha.cpp b/examples/mtcaptcha.cpp new file mode 100644 index 0000000..2860368 --- /dev/null +++ b/examples/mtcaptcha.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./mtcaptcha \"API KEY\"\n"); + return 0; + } + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + api2captcha::captcha_t cap; + cap.set_param("method", "mt_captcha"); + cap.set_param("sitekey", "MTPublic-KzqLY1cKH"); + cap.set_param("pageurl", "https://2captcha.com/demo/mtcaptcha"); + + try + { + client.solve (cap); + printf ("code '%s'\n", cap.code ().c_str ()); + } + catch (std::exception & e) + { + fprintf (stderr, "Failed: %s\n", e.what ()); + } + + return 0; +} diff --git a/examples/tencent.cpp b/examples/tencent.cpp new file mode 100644 index 0000000..8adbc48 --- /dev/null +++ b/examples/tencent.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./tencent \"API KEY\"\n"); + return 0; + } + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + api2captcha::captcha_t cap; + cap.set_param("method", "tencent"); + cap.set_param("app_id", "2092215077"); + cap.set_param("pageurl", "https://mysite.com/page/with/tencent"); + + try + { + client.solve (cap); + printf ("code '%s'\n", cap.code ().c_str ()); + } + catch (std::exception & e) + { + fprintf (stderr, "Failed: %s\n", e.what ()); + } + + return 0; +}