-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtemu.cpp
More file actions
63 lines (50 loc) · 1.73 KB
/
temu.cpp
File metadata and controls
63 lines (50 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <cstdio>
#include <filesystem>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "curl_http.hpp"
#include "api2captcha.hpp"
#include "b64.hpp"
#include "file_utils.hpp"
using namespace std;
int main(int ac, char **av)
{
if (ac < 2)
{
printf("Usage: ./temu \"API KEY\"\n");
return 0;
}
string current_path = filesystem::current_path().c_str();
string bodyFilePath = current_path + "/assets/temu/body.png";
string part1FilePath = current_path + "/assets/temu/part1.png";
string part2FilePath = current_path + "/assets/temu/part2.png";
string part3FilePath = current_path + "/assets/temu/part3.png";
api2captcha::curl_http_t http;
http.set_verbose(true);
api2captcha::client_t client;
client.set_http_client(&http);
client.set_api_key(av[1]);
string method = "temuimage";
const char *c_strMethod = method.c_str();
api2captcha::temu_t cap(c_strMethod);
const vector<unsigned char> bodyData = api2captcha::FileUtils::readFile(bodyFilePath);
const vector<unsigned char> part1Data = api2captcha::FileUtils::readFile(part1FilePath);
const vector<unsigned char> part2Data = api2captcha::FileUtils::readFile(part2FilePath);
const vector<unsigned char> part3Data = api2captcha::FileUtils::readFile(part3FilePath);
cap.set_body(api2captcha::B64::base64_encode(bodyData));
cap.set_part1(api2captcha::B64::base64_encode(part1Data));
cap.set_part2(api2captcha::B64::base64_encode(part2Data));
cap.set_part3(api2captcha::B64::base64_encode(part3Data));
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;
}