Skip to content

Commit a4afb15

Browse files
Merge pull request #68 from wnelson03/main
Security update
2 parents 0951cbb + fef9dd2 commit a4afb15

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

x64/auth.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ namespace KeyAuth {
1414
class api {
1515
public:
1616

17-
std::string name, ownerid, secret, version, url, path;
17+
std::string name, ownerid, version, url, path;
1818

19-
api(std::string name, std::string ownerid, std::string secret, std::string version, std::string url, std::string path) : name(name), ownerid(ownerid), secret(secret), version(version), url(url), path(path) {}
19+
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) {}
2020

2121
void ban(std::string reason = "");
2222
void init();
@@ -75,7 +75,7 @@ namespace KeyAuth {
7575
public:
7676
// response data
7777
std::vector<channel_struct> channeldata;
78-
bool success{};
78+
bool success{false};
7979
std::string message;
8080
};
8181

x64/example.vcxproj

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
<FunctionLevelLinking>true</FunctionLevelLinking>
105105
<IntrinsicFunctions>true</IntrinsicFunctions>
106106
<SDLCheck>true</SDLCheck>
107-
<PreprocessorDefinitions>CURL_STATICLIB;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
108108
<ConformanceMode>true</ConformanceMode>
109109
<LanguageStandard>stdcpp17</LanguageStandard>
110110
</ClCompile>
@@ -113,7 +113,7 @@
113113
<EnableCOMDATFolding>true</EnableCOMDATFolding>
114114
<OptimizeReferences>true</OptimizeReferences>
115115
<GenerateDebugInformation>true</GenerateDebugInformation>
116-
<AdditionalDependencies>libcurl.lib;library_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
116+
<AdditionalDependencies>library_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
117117
</Link>
118118
</ItemDefinitionGroup>
119119
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -139,6 +139,7 @@
139139
<ConformanceMode>true</ConformanceMode>
140140
<LanguageStandard>stdcpp17</LanguageStandard>
141141
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
142+
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
142143
</ClCompile>
143144
<Link>
144145
<SubSystem>Console</SubSystem>

x64/library_x64.lib

15.7 MB
Binary file not shown.

x64/main.cpp

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <Windows.h>
22
#include "auth.hpp"
33
#include <string>
4+
#include <thread>
45
#include "utils.hpp"
56
#include "skStr.h"
67
std::string tm_to_readable_time(tm ctx);
@@ -11,22 +12,23 @@ const std::string compilation_time = (std::string)skCrypt(__TIME__);
1112

1213
using namespace KeyAuth;
1314

15+
// copy and paste from https://keyauth.cc/app/ and replace these string variables
16+
// Please watch tutorial HERE
1417
std::string name = skCrypt("name").decrypt();
1518
std::string ownerid = skCrypt("ownerid").decrypt();
1619
std::string secret = skCrypt("secret").decrypt();
1720
std::string version = skCrypt("1.0").decrypt();
18-
std::string url = skCrypt("https://keyauth.win/api/1.2/").decrypt(); // change if you're self-hosting
21+
std::string url = skCrypt("https://keyauth.win/api/1.3/").decrypt(); // change if using KeyAuth custom domains feature
1922
std::string path = skCrypt("").decrypt(); //optional, set a path if you're using the token validation setting
2023

21-
api KeyAuthApp(name, ownerid, secret, version, url, path);
24+
api KeyAuthApp(name, ownerid, version, url, path);
2225

2326
int main()
2427
{
25-
// Freeing memory to prevent memory leak or memory scraping
26-
name.clear(); ownerid.clear(); secret.clear(); version.clear(); url.clear();
2728
std::string consoleTitle = skCrypt("Loader - Built at: ").decrypt() + compilation_date + " " + compilation_time;
2829
SetConsoleTitleA(consoleTitle.c_str());
2930
std::cout << skCrypt("\n\n Connecting..");
31+
3032
KeyAuthApp.init();
3133
if (!KeyAuthApp.response.success)
3234
{
@@ -111,12 +113,14 @@ int main()
111113
exit(1);
112114
}
113115

116+
if (KeyAuthApp.response.message.empty()) exit(11);
114117
if (!KeyAuthApp.response.success)
115118
{
116119
std::cout << skCrypt("\n Status: ") << KeyAuthApp.response.message;
117120
Sleep(1500);
118121
exit(1);
119122
}
123+
120124
if (username.empty() || password.empty())
121125
{
122126
WriteToJson("test.json", "license", key, false, "", "");
@@ -127,10 +131,19 @@ int main()
127131
WriteToJson("test.json", "username", username, true, "password", password);
128132
std::cout << skCrypt("Successfully Created File For Auto Login");
129133
}
130-
131-
132134
}
133135

136+
/*
137+
* Do NOT remove this checkAuthenticated() function.
138+
* It protects you from cracking, it would be NOT be a good idea to remove it
139+
*/
140+
std::cout << ownerid;
141+
std::string owner = ownerid;
142+
std::cout << "\nOwner: " + owner;
143+
std::thread run(checkAuthenticated, ownerid);
144+
// do NOT remove checkAuthenticated(), it MUST stay for security reasons
145+
146+
if (KeyAuthApp.user_data.username.empty()) exit(10);
134147
std::cout << skCrypt("\n User data:");
135148
std::cout << skCrypt("\n Username: ") << KeyAuthApp.user_data.username;
136149
std::cout << skCrypt("\n IP address: ") << KeyAuthApp.user_data.ip;

x64/utils.hpp

+9
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,12 @@ bool WriteToJson(std::string path, std::string name, std::string value, bool use
4545

4646
return true;
4747
}
48+
49+
void checkAuthenticated(std::string ownerid) {
50+
while (true) {
51+
if (GlobalFindAtomA(ownerid.c_str()) == 0) {
52+
exit(13);
53+
}
54+
Sleep(1000); // thread interval
55+
}
56+
}

0 commit comments

Comments
 (0)