Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
*~
*~
.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/vk
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Examples of API requests for different captcha types are available on the [C++ c
- [ClickCaptcha](#clickcaptcha)
- [Rotate](#rotate)
- [Lemin](#lemin)
- [VK Image](#vk-image)
- [Other methods](#other-methods)
- [send / getResult](#send--get_result)
- [balance](#balance)
Expand Down Expand Up @@ -268,6 +269,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
Expand Down
16 changes: 16 additions & 0 deletions api2captcha.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,22 @@ namespace api2captcha
void setUrl(const std::string &s) { set_param("pageurl", s); };
};

//vk captcha
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
Expand Down
9 changes: 6 additions & 3 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 vk

normal: normal.o
$(GPP) ${OPTIM} -Wall -o normal normal.o $(LIB_DIR) $(LIB_FILES)
Expand Down Expand Up @@ -58,11 +58,14 @@ text: text.o
lemin: lemin.o
$(GPP) ${OPTIM} -Wall -o lemin lemin.o $(LIB_DIR) $(LIB_FILES)

vk: vk.o
$(GPP) ${OPTIM} -Wall -o vk vk.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 vk

strip: $(PROG)
strip $(PROG)
Binary file added examples/images/canvas.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/canvas_hint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/grid.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/grid_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/grid_hint.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/normal.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/normal_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/rotate.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/vk.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions examples/vk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <cstdio>
#include <filesystem>
#include <iostream>

#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;
}