-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathMain.cpp
More file actions
249 lines (215 loc) · 5.71 KB
/
Copy pathMain.cpp
File metadata and controls
249 lines (215 loc) · 5.71 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#include <winsock2.h>
#include <windows.h>
#include <Overlay/Overlay.h>
#include <Common/Data.h>
#include <Utils/Utils.h>
#include <Hack/Hack.h>
#include <Common/Offset.h>
#include <thread>
#include <DMALibrary/Memory/Memory.h>
#include <cstdint>
#include <Common/Config.h>
#include <Auth/Auth.h>
#include <Utils/MachineCodeGenerator.h>
#include <Utils/w3c/w3c.h>
FGameData GameData;
using namespace std;
void saveCardKey(const std::string& cardKey) {
std::ofstream outFile("cardKey.txt");
if (outFile.is_open()) {
outFile << cardKey;
outFile.close();
}
/*else {
std::cerr << "Unable to open file for saving card key.\n";
}*/
}
std::string loadCardKey() {
std::ifstream inFile("cardKey.txt");
std::string cardKey;
if (inFile.is_open()) {
inFile >> cardKey;
inFile.close();
}/*
else {
std::cerr << "No saved card key found.\n";
}*/
return cardKey;
}
void deleteCardKey() {
remove("cardKey.txt");
}
// SingleLogin | 单码用户登录
bool SingleLogin() {
std::string HWID = MachineCodeGenerator::GenerateMachineCode();
W3Client w3;
W3Client client;
bool isLoggedIn = false;
std::string cardKey;
if (client.Connect("http://w.eydata.net")) {
cardKey = loadCardKey();
if (!cardKey.empty()) {
//std::cout << "Please enter your card key: " << cardKey << std::endl;
//std::cout << " " << std::endl;
//std::cout << "Loaded card key: " << cardKey << std::endl;
//std::cout << "Press Enter to continue (or input a new key): ";
//std::string input;
//std::getline(std::cin, input);
//if (!input.empty()) {
// cardKey = input;
//}
// 单码卡密
client.AddPostArgument("SingleCode", cardKey.c_str());
// 程序版本
client.AddPostArgument("Ver", "1.0");
// 机器码
client.AddPostArgument("Mac", HWID.c_str());
// 接口地址
if (client.Request("/4BEACF45F084D8F1", W3Client::reqPost)) {
char buf[1024] = "\0";
while (client.Response(reinterpret_cast<unsigned char*>(buf), 1024) > 0) {
if (strlen(buf) == 32)
{
std::cout << "Login Success" << std::endl;
saveCardKey(cardKey);
strncpy(GameData.Config.eyou.globalBuf, buf, 1024);
memset(buf, 0x00, 1024);
return TRUE;
}
else {
std::cout << "Login Faild, Tips :" << buf << std::endl;
deleteCardKey(); // 删除保存的卡密文件
memset(buf, 0x00, 1024);
return FALSE;
}
}
}
client.Close();
}
else
{
std::cout << "Please enter your card key: ";
std::cin >> cardKey;
// 单码卡密
client.AddPostArgument("SingleCode", cardKey.c_str());
// 程序版本
client.AddPostArgument("Ver", "1.0");
// 机器码
client.AddPostArgument("Mac", HWID.c_str());
// 接口地址
if (client.Request("/4BEACF45F084D8F1", W3Client::reqPost)) {
char buf[1024] = "\0";
while (client.Response(reinterpret_cast<unsigned char*>(buf), 1024) > 0) {
if (strlen(buf) == 32)
{
std::cout << "Login Success" << std::endl;
saveCardKey(cardKey);
strncpy(GameData.Config.eyou.globalBuf, buf, 1024);
memset(buf, 0x00, 1024);
return TRUE;
}
else {
std::cout << "Login Faild, Tips :" << buf << std::endl;
deleteCardKey(); // 删除保存的卡密文件
memset(buf, 0x00, 1024);
return FALSE;
}
}
}
client.Close();
}
}
}
// GetExpired | 获取用户的到期时间
void GetExpired() {
W3Client w3;
W3Client client;
if (client.Connect("http://w.eydata.net")) {
GameData.Config.eyou.cardKey = loadCardKey();
if (GameData.Config.eyou.cardKey.empty())
{
std::cout << "Please enter your card key: ";
std::cin >> GameData.Config.eyou.cardKey;
}
// 用户名
client.AddPostArgument("UserName", GameData.Config.eyou.cardKey.c_str());
// 接口地址
if (client.Request("/F5AC89EE9006B5CA", W3Client::reqPost)) {
char buf[1024] = "\0";
while (client.Response(reinterpret_cast<unsigned char*>(buf), 1024) > 0) {
int ret = atoi(buf);
if (ret > 0)
{
std::cout << "Time : [" << buf << "]" << std::endl;
}
else {
std::cout << "Code :" << buf << std::endl;
}
memset(buf, 0x00, 1024);
}
}
client.Close();
}
}
void SetConsoleStyle()
{
SetConsoleOutputCP(CP_UTF8);
SetConsoleTitle("Console");
CONSOLE_FONT_INFOEX cfi;
cfi.cbSize = sizeof(cfi);
cfi.nFont = 0;
cfi.dwFontSize.X = 0;
cfi.dwFontSize.Y = 14;
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwMode = 0;
GetConsoleMode(hOut, &dwMode);
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(hOut, dwMode);
auto hStdin = ::GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
::GetConsoleMode(hStdin, &mode);
mode &= ~ENABLE_QUICK_EDIT_MODE;
::SetConsoleMode(hStdin, mode);
}
int Refresh()
{
while (true)
{
mem.RefreshAll();
Sleep(1000 * 60 * 15);
}
}
int main() {
//std::string HWID = MachineCodeGenerator::GenerateMachineCode();
//std::cout << HWID << std::endl;
//Sleep(5000000);
//4081039822 小龙
//if (HWID != "4081039822") exit(0);
//std::cout << HWID << std::endl;
//Sleep(500000);
SetConsoleStyle();
//if (SingleLogin())
//{
// GetExpired();
Auth::Init();
//std::thread GuiThread(Gui::Init);
std::thread HackThread(Hack::Init);
//std::thread TimeOuthread(TimeOut);
std::thread OverlayThread(Overlay::Init);
while (true)
{
if (GameData.Config.Window.Main) {
Sleep(500);
continue;
}
break;
}
//}
//else
//{
// system("pause");
// exit(0);
//}
return 0;
}