Skip to content

Commit 41c2584

Browse files
committed
Improve session check security
1 parent 4f5bd87 commit 41c2584

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

x64/auth.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace KeyAuth {
2020

2121
void ban(std::string reason = "");
2222
void init();
23-
void check();
23+
void check(bool check_paid = false);
2424
void log(std::string msg);
2525
void license(std::string key);
2626
std::string var(std::string varid);
@@ -75,8 +75,9 @@ namespace KeyAuth {
7575
public:
7676
// response data
7777
std::vector<channel_struct> channeldata;
78-
bool success{false};
78+
bool success{};
7979
std::string message;
80+
bool isPaid{};
8081
};
8182

8283
userdata user_data;

x64/library_x64.lib

12.4 KB
Binary file not shown.

x64/main.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ static std::time_t string_to_timet(std::string timestamp);
99
static std::tm timet_to_tm(time_t timestamp);
1010
const std::string compilation_date = (std::string)skCrypt(__DATE__);
1111
const std::string compilation_time = (std::string)skCrypt(__TIME__);
12+
void sessionStatus();
1213

1314
using namespace KeyAuth;
1415

1516
// copy and paste from https://keyauth.cc/app/ and replace these string variables
16-
// Please watch tutorial HERE
17+
// Please watch tutorial HERE https://www.youtube.com/watch?v=5x4YkTmFH-U
1718
std::string name = skCrypt("name").decrypt();
1819
std::string ownerid = skCrypt("ownerid").decrypt();
1920
std::string version = skCrypt("1.0").decrypt();
@@ -138,6 +139,7 @@ int main()
138139
*/
139140
std::thread run(checkAuthenticated, ownerid);
140141
// do NOT remove checkAuthenticated(), it MUST stay for security reasons
142+
std::thread check(sessionStatus); // do NOT remove this function either.
141143

142144
if (KeyAuthApp.user_data.username.empty()) exit(10);
143145
std::cout << skCrypt("\n User data:");
@@ -160,6 +162,23 @@ int main()
160162
return 0;
161163
}
162164

165+
void sessionStatus() {
166+
KeyAuthApp.check(true); // do NOT specify true usually, it is slower and will get you blocked from API
167+
if (!KeyAuthApp.response.success) {
168+
exit(0);
169+
}
170+
171+
if (KeyAuthApp.response.isPaid) {
172+
while (true) {
173+
Sleep(20000); // this MUST be included or else you get blocked from API
174+
KeyAuthApp.check();
175+
if (!KeyAuthApp.response.success) {
176+
exit(0);
177+
}
178+
}
179+
}
180+
}
181+
163182
std::string tm_to_readable_time(tm ctx) {
164183
char buffer[80];
165184

0 commit comments

Comments
 (0)