From 3c0e04f34366c97981b4f7b7b2f12fef38920cf0 Mon Sep 17 00:00:00 2001 From: victorkowalski Date: Fri, 7 Nov 2025 09:05:11 +0300 Subject: [PATCH 1/2] new vkcaptcha --- .gitignore | 25 +++++++++++++++++++++- api2captcha.hpp | 15 ++++++++++++++ examples/Makefile | 12 ++++++++--- examples/vkcaptcha.cpp | 44 +++++++++++++++++++++++++++++++++++++++ examples/vkimage.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 4 deletions(-) create mode 100644 examples/vkcaptcha.cpp create mode 100644 examples/vkimage.cpp diff --git a/.gitignore b/.gitignore index e4e5f6c..5e17b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,24 @@ -*~ \ No newline at end of file +*~ +.codelite +.idea +.vscode + +*.mk +*.project +*.workspace + +Makefile + +*.d +*.o +canvas +lemin +text +/examples/capy +/examples/coordinates +/examples/funcaptcha +/examples/geetest +/examples/grid +/examples/normal +/examples/vkcaptcha +/examples/vkimage diff --git a/api2captcha.hpp b/api2captcha.hpp index 1d15bd1..3ca21b0 100644 --- a/api2captcha.hpp +++ b/api2captcha.hpp @@ -358,6 +358,21 @@ namespace api2captcha void setUrl(const std::string &s) { set_param("pageurl", s); }; }; + class vk_t : public captcha_t + { + public: + vk_t(const std::string &method) + { + set_param("method", method); + } + + void set_file(const std::string &path) { captcha_t::set_file("file", path); } + void set_base64(const std::string &base64) { set_param("body", base64); } + void set_steps(const std::string &steps) { set_param("steps", steps); } + void set_redirect_uri(const std::string &redirect_uri) { set_param("redirect_uri", redirect_uri); } + void set_user_agent(const std::string &user_agent) { set_param("userAgent", user_agent); } + }; + class client_t { class impl_t diff --git a/examples/Makefile b/examples/Makefile index e645529..ce12e88 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -15,9 +15,9 @@ OPTIM = -O3 -g GPP = g++ -CC_OPT = $(OPTIM) -std=c++11 -Wall -pipe $(INC_DIR) +CC_OPT = $(OPTIM) -std=c++17 -Wall -pipe $(INC_DIR) -all: normal canvas capy coordinates funcaptcha geetest grid hcaptcha keycaptcha recaptcha rotate text +all: normal canvas capy coordinates funcaptcha geetest grid hcaptcha keycaptcha recaptcha rotate text vkimage vkcaptcha normal: normal.o $(GPP) ${OPTIM} -Wall -o normal normal.o $(LIB_DIR) $(LIB_FILES) @@ -58,11 +58,17 @@ text: text.o lemin: lemin.o $(GPP) ${OPTIM} -Wall -o lemin lemin.o $(LIB_DIR) $(LIB_FILES) +vkimage: vkimage.o + $(GPP) ${OPTIM} -Wall -o vkimage vkimage.o $(LIB_DIR) $(LIB_FILES) + +vkcaptcha: vkcaptcha.o + $(GPP) ${OPTIM} -Wall -o vkcaptcha vkcaptcha.o $(LIB_DIR) $(LIB_FILES) + .cpp.o: $(GPP) $(CC_OPT) $(DEFINES) -o $@ -c $< clean: - rm -rf core *~ *.o normal canvas capy coordinates funcaptcha geetest grid hcaptcha keycaptcha recaptcha rotate text lemin + rm -rf core *~ *.o normal canvas capy coordinates funcaptcha geetest grid hcaptcha keycaptcha recaptcha rotate text lemin vkimage vkcaptcha strip: $(PROG) strip $(PROG) diff --git a/examples/vkcaptcha.cpp b/examples/vkcaptcha.cpp new file mode 100644 index 0000000..c5a8edb --- /dev/null +++ b/examples/vkcaptcha.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./vk \"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]); + + + std::string method = "vkcaptcha"; + const char *c_strMethod = method.c_str(); + + api2captcha::vk_t cap (c_strMethod); + cap.set_redirect_uri("https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1"); + cap.set_user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"); + cap.set_proxy("http", "1.2.3.4"); + 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/vkimage.cpp b/examples/vkimage.cpp new file mode 100644 index 0000000..8f8a97b --- /dev/null +++ b/examples/vkimage.cpp @@ -0,0 +1,47 @@ +#include +#include +#include + +#include "curl_http.hpp" +#include "api2captcha.hpp" + +using namespace std; + +int main (int ac, char ** av) +{ + if (ac < 2) + { + printf ("Usage: ./vk \"API KEY\"\n"); + return 0; + } + + string current_path = filesystem::current_path().c_str(); + string image = current_path + "/images/vk.jpg"; + + api2captcha::curl_http_t http; + http.set_verbose (true); + + api2captcha::client_t client; + client.set_http_client (&http); + client.set_api_key (av[1]); + + + std::string method = "vkimage"; + const char *c_strMethod = method.c_str(); + + api2captcha::vk_t cap (c_strMethod); + cap.set_file (image); + cap.set_steps ("[5,12,22,24,21,23,10,7,2,8,19,18,8,24,21,22,11,14,16,5,18,20,4,21,12,6,0,0,11,12,8,20,19,3,14,8,9,13,16,24,18,3,2,23,8,12,6,1,11,0,20,15,19,22,17,24,8,0,12,5,19,14,11,6,7,14,23,24,23,20,4,20,6,12,4,17,4,18,6,20,17,5,23,7,10,2,8,9,5,4,17,24,11,14,4,10,12,22,21,2]"); + + 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; +} From ec5ac45a1b091f3af35e4295225d9ba4cbbc677d Mon Sep 17 00:00:00 2001 From: victorkowalski Date: Fri, 7 Nov 2025 17:19:15 +0300 Subject: [PATCH 2/2] readme upd --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 3a0f264..88ba0cf 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ Examples of API requests for different captcha types are available on the [C++ c - [ClickCaptcha](#clickcaptcha) - [Rotate](#rotate) - [Lemin](#lemin) + - [VK Captcha](#vk-captcha) + - [VK Image](#vk-image) - [Other methods](#other-methods) - [send / getResult](#send--get_result) - [balance](#balance) @@ -268,6 +270,31 @@ lemin.setUrl ("https://2captcha.com/demo/lemin"); lemin.setApiServer("api.leminnow.com"); ``` +### VK Image +Use this method to solve vk captcha and obtain a token to bypass the protection. + +```c++ +std::string method = "vkimage"; +const char *c_strMethod = method.c_str(); + +api2captcha::vk_t cap (c_strMethod); +cap.set_file (image); +cap.set_steps ("[5,12,22,24,21,23,10,7,2,8,19,18,8,24,21,22,11,14,16,5,18,20,4,21,12,6,0,0,11,12,8,20,19,3,14,8,9,13,16,24,18,3,2,23,8,12,6,1,11,0,20,15,19,22,17,24,8,0,12,5,19,14,11,6,7,14,23,24,23,20,4,20,6,12,4,17,4,18,6,20,17,5,23,7,10,2,8,9,5,4,17,24,11,14,4,10,12,22,21,2]"); +``` + +### VK Captcha +Use this method to solve vk captcha and obtain a token to bypass the protection. + +```c++ +std::string method = "vkcaptcha"; +const char *c_strMethod = method.c_str(); + +api2captcha::vk_t cap (c_strMethod); +cap.set_redirect_uri("https://id.vk.com/not_robot_captcha?domain=vk.com&session_token=eyJ....HGsc5B4LyvjA&variant=popup&blank=1"); +cap.set_user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"); +cap.set_proxy("http", "1.2.3.4"); +``` + ## Other methods ### send / get_result