Skip to content

Commit 8dce8e9

Browse files
Merge pull request #43 from Shxde1/main
2 parents 9465ca9 + bb3c152 commit 8dce8e9

File tree

3 files changed

+15
-342
lines changed

3 files changed

+15
-342
lines changed

auth.cpp

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,6 @@ void KeyAuth::api::init()
155155
if ((hasher(result ^ 0xA5A5) & 0xFFFF) == (expectedHash & 0xFFFF))
156156
{
157157
auto json = response_decoder.parse(response);
158-
if (json[(XorStr("ownerid"))] != ownerid) {
159-
LI_FN(exit)(8);
160-
}
161-
162-
std::string message = json[(XorStr("message"))];
163-
164-
load_response_data(json);
165158

166159
if (json[(XorStr("ownerid"))] != ownerid) {
167160
LI_FN(exit)(8);
@@ -188,6 +181,7 @@ void KeyAuth::api::init()
188181
else if (json[(XorStr("message"))] == XorStr("invalidver"))
189182
{
190183
std::string dl = json[(XorStr("download"))];
184+
api::app_data.downloadLink = json[XorStr("download")];
191185
if (dl == "")
192186
{
193187
MessageBoxA(0, XorStr("Version in the loader does match the one on the dashboard, and the download link on dashboard is blank.\n\nTo fix this, either fix the loader so it matches the version on the dashboard. Or if you intended for it to have different versions, update the download link on dashboard so it will auto-update correctly.").c_str(), NULL, MB_ICONERROR);
@@ -290,26 +284,6 @@ void KeyAuth::api::login(std::string username, std::string password, std::string
290284
file.close();
291285
}
292286

293-
std::string message = json[(XorStr("message"))];
294-
295-
std::hash<int> hasher;
296-
size_t expectedHash = hasher(68);
297-
size_t resultCode = hasher(json[(XorStr("code"))]);
298-
299-
if (!json[(XorStr("success"))] || (json[(XorStr("success"))] && (resultCode == expectedHash))) {
300-
load_response_data(json);
301-
if (json[(XorStr("success"))])
302-
load_user_data(json[(XorStr("info"))]);
303-
304-
if (api::response.message != XorStr("Initialized").c_str()) {
305-
LI_FN(GlobalAddAtomA)(seed.c_str());
306-
307-
std::string file_path = XorStr("C:\\ProgramData\\").c_str() + seed;
308-
std::ofstream file(file_path);
309-
if (file.is_open()) {
310-
file << seed;
311-
file.close();
312-
}
313287
std::string regPath = XorStr("Software\\").c_str() + seed;
314288
HKEY hKey;
315289
LONG result = RegCreateKeyExA(HKEY_CURRENT_USER, regPath.c_str(), 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL);
@@ -504,10 +478,6 @@ KeyAuth::api::Tfa& KeyAuth::api::Tfa::handleInput(KeyAuth::api& instance) {
504478
instance.disable2fa(code);
505479
}
506480

507-
}
508-
else {
509-
LI_FN(exit)(7);
510-
}
511481
}
512482

513483
void KeyAuth::api::web_login()
@@ -1873,8 +1843,6 @@ void checkRegistry() {
18731843
LI_FN(RegCloseKey)(hKey);
18741844
}
18751845
Sleep(1500); // thread interval
1876-
Sleep(1500); // thread interval
1877-
}
18781846
}
18791847

18801848
std::string checksum()
@@ -1921,9 +1889,13 @@ void RedactField(nlohmann::json& jsonObject, const std::string& fieldName)
19211889
}
19221890
}
19231891

1924-
void debugInfo(std::string data, std::string url, std::string response, std::string headers) {
1892+
void KeyAuth::api::debugInfo(std::string data, std::string url, std::string response, std::string headers) {
19251893
// output debug logs to C:\ProgramData\KeyAuth\Debug\
19261894
1895+
if (!KeyAuth::api::debug) {
1896+
return;
1897+
}
1898+
19271899
std::string redacted_response = "n/a";
19281900
// for logging the headers, since response is not avaliable there
19291901
if (response != "n/a") {

auth.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ namespace KeyAuth {
1616
public:
1717

1818
std::string name, ownerid, version, url, path;
19+
static bool debug;
1920

20-
api(std::string name, std::string ownerid, std::string version, std::string url, std::string path) : name(name), ownerid(ownerid), version(version), url(url), path(path) {}
21+
api(std::string name, std::string ownerid, std::string version, std::string url, std::string path, bool debug = true) {
22+
debug = debug;
23+
}
2124

2225
void ban(std::string reason = "");
2326
void init();
@@ -70,6 +73,7 @@ namespace KeyAuth {
7073
std::string numKeys;
7174
std::string version;
7275
std::string customerPanelLink;
76+
std::string downloadLink;
7377
};
7478

7579
class responsedata {
@@ -102,6 +106,8 @@ namespace KeyAuth {
102106
std::string sessionid, enckey;
103107

104108
static std::string req(std::string data, std::string url);
109+
110+
static void debugInfo(std::string data, std::string url, std::string response, std::string headers);
105111

106112

107113
void load_user_data(nlohmann::json data) {
@@ -131,7 +137,7 @@ namespace KeyAuth {
131137
api::app_data.version = data[XorStr("version")];
132138
api::app_data.customerPanelLink = data[XorStr("customerPanelLink")];
133139
}
134-
140+
135141
void load_response_data(nlohmann::json data) {
136142
api::response.success = data[XorStr("success")];
137143
api::response.message = data["message"];

0 commit comments

Comments
 (0)