-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
149 lines (126 loc) · 4.48 KB
/
Copy pathmain.cpp
File metadata and controls
149 lines (126 loc) · 4.48 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
#include <iostream>
#include <windows.h>
#include "Core/Move.h"
#include "Core/FastFind.h"
#include "Core/Config.h"
#include "Core/Cmds.h"
#include <shellapi.h>
#include <cstdlib>
#include <ctime>
bool IsRunningAsAdmin()
{
BOOL fIsRunAsAdmin = FALSE;
PSID pAdministratorsGroup = NULL;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
if (AllocateAndInitializeSid(
&NtAuthority, 2,
SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS,
0, 0, 0, 0, 0, 0,
&pAdministratorsGroup))
{
CheckTokenMembership(
NULL, pAdministratorsGroup,
&fIsRunAsAdmin);
FreeSid(pAdministratorsGroup);
}
return fIsRunAsAdmin == TRUE;
}
void RequestAdminPrivileges()
{
if (!IsRunningAsAdmin())
{
char szPath[MAX_PATH];
if (GetModuleFileNameA(NULL, szPath, ARRAYSIZE(szPath)))
{
SHELLEXECUTEINFOA sei = {sizeof(sei)};
sei.lpVerb = "runas";
sei.lpFile = szPath;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (ShellExecuteExA(&sei))
{
exit(0);
}
}
}
}
int main()
{
srand((unsigned int)time(nullptr));
RequestAdminPrivileges();
AllocConsole();
SetConsoleTitleA("Zeco");
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
DWORD dwMode = 0;
if (GetConsoleMode(hOut, &dwMode))
{
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
SetConsoleMode(hOut, dwMode);
}
FILE *dummy;
freopen_s(&dummy, "CONOUT$", "w", stdout);
Config config;
config.Load();
ConsoleCommands consoleCommands(&config);
if (config.GetBool("debug", false))
{
std::cout << "\033[33m[Zeco DEBUG] Initial configuration loaded successfully.\033[0m\n";
std::cout << "\033[33m[Zeco DEBUG] Aim key: " << config.GetInt("aim", 2)
<< " | FOV: " << config.GetFloat("fov", 80.0f)
<< " | Strength: " << config.GetFloat("strength", 0.19f) << "\n\033[0m";
}
const char *reset = "\033[0m";
const char *cyan = "\033[36m";
const char *green = "\033[32m";
const char *yellow = "\033[33m";
const char *red = "\033[31m";
const char *link = "\033]8;;https://github.com/Zeppth\033\\";
std::cout << "\n"
<< " GitHub: " << link << cyan << "https://github.com/Zeppth" << reset << "\n"
<< " ------------------------------------\n"
<< " " << green << "*" << reset << " System started successfully.\n"
<< " " << yellow << "*" << reset << " Real-time adjustments (e.g., /FOV =+10)\n"
<< " " << red << "*" << reset << " Press END to exit.\n\n";
bool running = true;
FastFind FastFind(&config);
Move Mover(&config);
while (running)
{
if (GetAsyncKeyState(config.GetInt("exitkey", 35)) & 0x01)
break;
if (GetAsyncKeyState(config.GetInt("aim", 2)) & 0x8000)
{
int fov = config.GetInt("fov", 80);
int refX = config.GetInt("referencex", 0);
int refY = config.GetInt("referencey", 0);
const int SCREEN_WIDTH = GetSystemMetrics(SM_CXSCREEN);
const int SCREEN_HEIGHT = GetSystemMetrics(SM_CYSCREEN);
const int MONITOR_CENTER_X = SCREEN_WIDTH / 2;
const int MONITOR_CENTER_Y = SCREEN_HEIGHT / 2;
int x = MONITOR_CENTER_X - fov / 2 + refX;
int y = MONITOR_CENTER_Y - fov / 2 + refY;
if (FastFind.ScreenShoot(SCREEN_WIDTH, SCREEN_HEIGHT) && FastFind.ColorSearch(x, y))
{
float offsetX = config.GetFloat("offsetx", 0.0f);
float offsetY = config.GetFloat("offsety", 0.0f);
int targetX = static_cast<int>((x - MONITOR_CENTER_X + offsetX));
int targetY = static_cast<int>((y - MONITOR_CENTER_Y + offsetY));
if (config.GetBool("useaimassist", true))
{
Mover.AimAssist(targetX, targetY);
}
else
{
Mover.AimHumanized(targetX, targetY);
}
}
Sleep(config.GetInt("sleepaim", 1));
}
else
{
Sleep(config.GetInt("sleepidle", 10));
}
}
return 0;
};