Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security update #68

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions x64/auth.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ namespace KeyAuth {
class api {
public:

std::string name, ownerid, secret, version, url, path;
std::string name, ownerid, version, url, path;

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

void ban(std::string reason = "");
void init();
Expand Down Expand Up @@ -75,7 +75,7 @@ namespace KeyAuth {
public:
// response data
std::vector<channel_struct> channeldata;
bool success{};
bool success{false};
std::string message;
};

Expand Down
5 changes: 3 additions & 2 deletions x64/example.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>CURL_STATICLIB;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
Expand All @@ -113,7 +113,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libcurl.lib;library_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>library_x86.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -139,6 +139,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand Down
Binary file modified x64/library_x64.lib
Binary file not shown.
25 changes: 19 additions & 6 deletions x64/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <Windows.h>
#include "auth.hpp"
#include <string>
#include <thread>
#include "utils.hpp"
#include "skStr.h"
std::string tm_to_readable_time(tm ctx);
Expand All @@ -11,22 +12,23 @@ const std::string compilation_time = (std::string)skCrypt(__TIME__);

using namespace KeyAuth;

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

api KeyAuthApp(name, ownerid, secret, version, url, path);
api KeyAuthApp(name, ownerid, version, url, path);

int main()
{
// Freeing memory to prevent memory leak or memory scraping
name.clear(); ownerid.clear(); secret.clear(); version.clear(); url.clear();
std::string consoleTitle = skCrypt("Loader - Built at: ").decrypt() + compilation_date + " " + compilation_time;
SetConsoleTitleA(consoleTitle.c_str());
std::cout << skCrypt("\n\n Connecting..");

KeyAuthApp.init();
if (!KeyAuthApp.response.success)
{
Expand Down Expand Up @@ -111,12 +113,14 @@ int main()
exit(1);
}

if (KeyAuthApp.response.message.empty()) exit(11);
if (!KeyAuthApp.response.success)
{
std::cout << skCrypt("\n Status: ") << KeyAuthApp.response.message;
Sleep(1500);
exit(1);
}

if (username.empty() || password.empty())
{
WriteToJson("test.json", "license", key, false, "", "");
Expand All @@ -127,10 +131,19 @@ int main()
WriteToJson("test.json", "username", username, true, "password", password);
std::cout << skCrypt("Successfully Created File For Auto Login");
}


}

/*
* Do NOT remove this checkAuthenticated() function.
* It protects you from cracking, it would be NOT be a good idea to remove it
*/
std::cout << ownerid;
std::string owner = ownerid;
std::cout << "\nOwner: " + owner;
std::thread run(checkAuthenticated, ownerid);
// do NOT remove checkAuthenticated(), it MUST stay for security reasons

if (KeyAuthApp.user_data.username.empty()) exit(10);
std::cout << skCrypt("\n User data:");
std::cout << skCrypt("\n Username: ") << KeyAuthApp.user_data.username;
std::cout << skCrypt("\n IP address: ") << KeyAuthApp.user_data.ip;
Expand Down
9 changes: 9 additions & 0 deletions x64/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,12 @@ bool WriteToJson(std::string path, std::string name, std::string value, bool use

return true;
}

void checkAuthenticated(std::string ownerid) {
while (true) {
if (GlobalFindAtomA(ownerid.c_str()) == 0) {
exit(13);
}
Sleep(1000); // thread interval
}
}