Skip to content

Commit 30eee94

Browse files
authored
Update auth.hpp
1 parent 2520a4e commit 30eee94

File tree

1 file changed

+70
-8
lines changed

1 file changed

+70
-8
lines changed

x64/auth.hpp

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#include <Windows.h>
2-
#include <iostream>
3-
#include <vector>
4-
#include <fstream>
1+
#include <includes.hpp>
2+
#include <xorstr.hpp>
3+
#include <random>
4+
5+
#define CURL_STATICLIB
56

67
struct channel_struct
78
{
@@ -14,15 +15,15 @@ namespace KeyAuth {
1415
class api {
1516
public:
1617

17-
std::string name, ownerid, version, url, path;
18+
std::string name, ownerid, version, url, path;
1819

1920
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) {}
2021

2122
void ban(std::string reason = "");
2223
void init();
2324
void check(bool check_paid = false);
2425
void log(std::string msg);
25-
void license(std::string key);
26+
void license(std::string key, std::string code = "");
2627
std::string var(std::string varid);
2728
std::string webhook(std::string id, std::string params, std::string body = "", std::string contenttype = "");
2829
void setvar(std::string var, std::string vardata);
@@ -31,7 +32,7 @@ namespace KeyAuth {
3132
void web_login();
3233
void button(std::string value);
3334
void upgrade(std::string username, std::string key);
34-
void login(std::string username, std::string password);
35+
void login(std::string username, std::string password, std::string code = "");
3536
std::vector<unsigned char> download(std::string fileid);
3637
void regstr(std::string username, std::string password, std::string key, std::string email = "");
3738
void chatget(std::string channel);
@@ -41,6 +42,8 @@ namespace KeyAuth {
4142
void fetchstats();
4243
void forgot(std::string username, std::string email);
4344
void logout();
45+
void enable2fa(std::string code = "");
46+
void disable2fa(std::string code);
4447

4548
class subscriptions_class {
4649
public:
@@ -83,8 +86,67 @@ namespace KeyAuth {
8386
userdata user_data;
8487
appdata app_data;
8588
responsedata response;
86-
8789
private:
8890
std::string sessionid, enckey;
91+
92+
static std::string req(std::string data, std::string url);
93+
94+
95+
void load_user_data(nlohmann::json data) {
96+
api::user_data.username = data[XorStr("username")];
97+
api::user_data.ip = data[XorStr("ip")];
98+
if (data[XorStr("hwid")].is_null()) {
99+
api::user_data.hwid = XorStr("none");
100+
}
101+
else {
102+
api::user_data.hwid = data[XorStr("hwid")];
103+
}
104+
api::user_data.createdate = data[XorStr("createdate")];
105+
api::user_data.lastlogin = data[XorStr("lastlogin")];
106+
107+
for (int i = 0; i < data[XorStr("subscriptions")].size(); i++) { // Prompto#7895 & stars#2297 was here
108+
subscriptions_class subscriptions;
109+
subscriptions.name = data[XorStr("subscriptions")][i][XorStr("subscription")];
110+
subscriptions.expiry = data[XorStr("subscriptions")][i][XorStr("expiry")];
111+
api::user_data.subscriptions.emplace_back(subscriptions);
112+
}
113+
}
114+
115+
void load_app_data(nlohmann::json data) {
116+
api::app_data.numUsers = data[XorStr("numUsers")];
117+
api::app_data.numOnlineUsers = data[XorStr("numOnlineUsers")];
118+
api::app_data.numKeys = data[XorStr("numKeys")];
119+
api::app_data.version = data[XorStr("version")];
120+
api::app_data.customerPanelLink = data[XorStr("customerPanelLink")];
121+
}
122+
123+
void load_response_data(nlohmann::json data) {
124+
api::response.success = data[XorStr("success")];
125+
api::response.message = data["message"];
126+
127+
if (data.contains(XorStr("role").c_str()) && data[XorStr("role")] != XorStr("tester").c_str() && data[XorStr("role")] != XorStr("not_checked").c_str()) {
128+
api::response.isPaid = true;
129+
}
130+
}
131+
132+
void load_channel_data(nlohmann::json data) {
133+
api::response.success = data["success"]; // intentional. Possibly trick a reverse engineer into thinking this string is for login function
134+
api::response.message = data["message"];
135+
api::response.channeldata.clear(); //If you do not delete the data before pushing it, the data will be repeated. github.com/TTakaTit
136+
for (const auto sub : data["messages"]) {
137+
138+
std::string authoroutput = sub[XorStr("author")];
139+
std::string messageoutput = sub["message"];
140+
int timestamp = sub[XorStr("timestamp")]; std::string timestampoutput = std::to_string(timestamp);
141+
authoroutput.erase(remove(authoroutput.begin(), authoroutput.end(), '"'), authoroutput.end());
142+
messageoutput.erase(remove(messageoutput.begin(), messageoutput.end(), '"'), messageoutput.end());
143+
timestampoutput.erase(remove(timestampoutput.begin(), timestampoutput.end(), '"'), timestampoutput.end());
144+
channel_struct output = { authoroutput , messageoutput, timestampoutput };
145+
api::response.channeldata.push_back(output);
146+
}
147+
}
148+
149+
nlohmann::json response_decoder;
150+
89151
};
90152
}

0 commit comments

Comments
 (0)