Skip to content

Commit e0028ff

Browse files
committed
Bug fixes
1 parent 11c9579 commit e0028ff

File tree

5 files changed

+77
-15
lines changed

5 files changed

+77
-15
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ KeyAuth CPP Example
33

44
- Download Repository
55
- extract `libs.zip` so that there is a libs folder in your project. then you may delete `libs.zip`
6-
- Add application info to main.cpp file, here is a video tutorial if needed: https://youtube.com/watch?v=uJ0Umy_C6Fg
6+
- Add application info to `main.cpp` file, here is a video tutorial if needed: https://youtube.com/watch?v=uJ0Umy_C6Fg
77

8-
Then you are ready to compile!
8+
Then you're ready to compile!
99

1010
**What is KeyAuth?**
1111

12-
KeyAuth is a GameChanging authentication system. We have never-seen before features, and we listen to our customers.
12+
KeyAuth is an Open source authentication system with cloud hosting plans as well. Client SDKs available for C++, C#, Python, Rust, PHP, and VB.NET.
13+
KeyAuth several unique features such as memory streaming, webhook function where you can send requests to API without leaking the API, discord webhook notifications, ban the user securely through the application at your discretion.
1314
Feel free to join https://keyauth.com/discord/ if you have questions or suggestions.

api/KeyAuth.hpp

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,33 @@ namespace KeyAuth {
376376
}
377377
}
378378

379+
void ban() {
380+
381+
auto iv = encryption::sha256(encryption::iv_key());
382+
std::string hwid = utils::get_hwid();
383+
auto data =
384+
XorStr("type=").c_str() + encryption::encode("ban") +
385+
XorStr("&sessionid=").c_str() + encryption::encode(sessionid) +
386+
XorStr("&name=").c_str() + encryption::encode(name) +
387+
XorStr("&ownerid=").c_str() + encryption::encode(ownerid) +
388+
XorStr("&init_iv=").c_str() + iv;
389+
auto response = req(data);
390+
response = encryption::decrypt(response, enckey, iv);
391+
auto json = response_decoder.parse(response);
392+
393+
if (json[("success")])
394+
{
395+
// optional success message
396+
}
397+
else
398+
{
399+
std::cout << XorStr("\n\n Status: Failure: ");
400+
std::cout << std::string(json[("message")]);
401+
Sleep(3500);
402+
exit(0);
403+
}
404+
}
405+
379406
std::string var(std::string varid) {
380407

381408
auto iv = encryption::sha256(encryption::iv_key());
@@ -410,7 +437,7 @@ namespace KeyAuth {
410437
GetUserNameA(acUserName, &nUserName);
411438
std::string UsernamePC = acUserName;
412439

413-
std::string data =
440+
auto data =
414441
XorStr("type=").c_str() + encryption::encode(XorStr("log").c_str()) +
415442
XorStr("&pcuser=").c_str() + encryption::encrypt(UsernamePC, enckey, iv) +
416443
XorStr("&message=").c_str() + encryption::encrypt(message, enckey, iv) +
@@ -454,19 +481,22 @@ namespace KeyAuth {
454481
void webhook(std::string id, std::string params) {
455482

456483
auto iv = encryption::sha256(encryption::iv_key());
457-
std::string hwid = utils::get_hwid();
458484

459-
std::string data =
485+
auto data =
460486
XorStr("type=").c_str() + encryption::encode(XorStr("webhook").c_str()) +
461-
XorStr("&webid=").c_str() + encryption::encrypt(id, secret, iv) +
462-
XorStr("&params=").c_str() + encryption::encrypt(params, secret, iv) +
487+
XorStr("&webid=").c_str() + encryption::encrypt(id, enckey, iv) +
488+
XorStr("&params=").c_str() + encryption::encrypt(params, enckey, iv) +
463489
XorStr("&sessionid=").c_str() + encryption::encode(sessionid) +
464490
XorStr("&name=").c_str() + encryption::encode(name) +
465491
XorStr("&ownerid=").c_str() + encryption::encode(ownerid) +
466492
XorStr("&init_iv=").c_str() + iv;
467493

468494
auto response = req(data);
495+
469496
response = encryption::decrypt(response, enckey, iv);
497+
std::cout << response;
498+
499+
470500
auto json = response_decoder.parse(response);
471501

472502
if (json[("success")])

example.vcxproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@
164164
<OptimizeReferences>true</OptimizeReferences>
165165
<GenerateDebugInformation>false</GenerateDebugInformation>
166166
<AdditionalDependencies>./libs/cryptopp/lib/cryptopp-static.lib;./libs/curl/lib/libcurl.lib;./libs/openssl/lib/libcrypto.lib;./libs/openssl/lib/libssl.lib;./libs/zlib.lib;Normaliz.lib;Ws2_32.lib;Wldap32.lib;Crypt32.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
167-
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
168167
</Link>
169168
</ItemDefinitionGroup>
170169
<ItemGroup>
@@ -175,4 +174,4 @@
175174
<ClInclude Include="xorstr.hpp" />
176175
</ItemGroup>
177176
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
178-
</Project>
177+
</Project>

example.vcxproj.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
<PropertyGroup>
44
<ShowAllFiles>true</ShowAllFiles>
55
</PropertyGroup>
6-
</Project>
6+
</Project>

main.cpp

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ using namespace KeyAuth;
1414
*
1515
*/
1616

17-
std::string name = ("");
18-
std::string ownerid = ("");
19-
std::string secret = ("");
20-
std::string version = ("1.0");
17+
std::string name = XorStr(""); // application name. right above the blurred text aka the secret on the licenses tab among other tabs
18+
std::string ownerid = XorStr(""); // ownerid, found in account settings. click your profile picture on top right of dashboard and then account settings.
19+
std::string secret = XorStr(""); // app secret, the blurred text on licenses tab and other tabs
20+
std::string version = XorStr("1.0"); // leave alone unless you've changed version on website
2121

2222
api KeyAuthApp(name, ownerid, secret, version);
2323

@@ -71,6 +71,38 @@ int main()
7171
Sleep(3000);
7272
exit(0);
7373
}
74+
75+
/*
76+
// download file
77+
std::vector<std::uint8_t> bytes = KeyAuthApp.download("123456");
78+
std::ofstream file("file.exe", std::ios_base::out | std::ios_base::binary);
79+
file.write((char*)bytes.data(), bytes.size());
80+
file.close();
81+
*/
82+
83+
// KeyAuthApp.log("user logged in"); // send event to logs. if you set discord webhook in app settings, it will send there too
84+
// KeyAuthApp.webhook("HDb5HiwOSM", "&type=black&ip=1.1.1.1&hwid=abc"); // webhook request to securely send GET request to API, here's what it looks like on dashboard https://i.imgur.com/jW74Hwe.png
85+
// KeyAuthApp.ban(); // ban the current user, must be logged in
86+
87+
#pragma region
88+
time_t rawtime = mktime(&KeyAuthApp.user_data.expiry);
89+
struct tm* timeinfo;
90+
timeinfo = localtime(&rawtime);
91+
printf(XorStr("\n Your Subscription Expires At: %s").c_str(), asctime(timeinfo));
92+
93+
time_t currtime;
94+
struct tm* tminfo;
95+
time(&currtime);
96+
tminfo = localtime(&currtime);
7497

98+
std::time_t x = std::mktime(tminfo);
99+
std::time_t y = std::mktime(&KeyAuthApp.user_data.expiry);
100+
if (x != (std::time_t)(-1) && y != (std::time_t)(-1))
101+
{
102+
double difference = std::difftime(y, x) / (60 * 60 * 24);
103+
std::cout << "\n " << difference << " day(s) left" << std::endl;
104+
}
105+
#pragma endregion Display Expiration Date and Days Left Until Expiry
106+
75107
Sleep(-1); // this is to keep your application open for test purposes. it pauses your application forever, remove this when you want.
76108
}

0 commit comments

Comments
 (0)