Guest User

Untitled

a guest
Apr 4th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. #include "Xor.h"
  2. #include <Windows.h>
  3. #pragma comment(lib, "ArkApi.lib")
  4. #pragma comment(lib, "Rpcrt4.lib")
  5. #include <iostream>
  6. #include <fstream>
  7.  
  8.  
  9. void OldAuth();
  10. void CallAuth()
  11. {
  12. OldAuth();
  13. }
  14.  
  15. void OldAuth();
  16.  
  17. void Hook_AShooterGameMode_InitGame(AShooterGameMode* a_shooter_game_mode, FString* map_name, FString* options,
  18. FString* error_message)
  19. {
  20.  
  21.  
  22. AShooterGameMode_InitGame_original(a_shooter_game_mode, map_name, options, error_message);
  23. CallAuth();
  24. }
  25.  
  26. std::hash<std::string> hasher;
  27. struct AuthInfo
  28. {
  29. const FString UserID;
  30. const int HWID;
  31. AuthInfo(const FString& UserID, const FString& HWID) : UserID(UserID), HWID(hasher(HWID.ToString())) {}
  32. };
  33.  
  34. TArray<AuthInfo> Auths = {
  35. AuthInfo(XorStr("WETBATMAN"), XorStr("w1248500060D85354CB8A00")),
  36. AuthInfo(XorStr("MATICHA"), XorStr("41664101023083649C23AB"))
  37. };
  38.  
  39. const char* GetHwid(int& HwidHash)
  40. {
  41. const char* HwidXor = XorStr("w%u%02X%02X%02X%02X%02X%02X"), *HomeDriveXor = XorStr("HOMEDRIVE"), *HomeDriveStr = XorStr("%s\\"), *HwidXorKey = XorStr("'");
  42. DWORD dwSerial;
  43. char hardid1[10];
  44. sprintf_s(hardid1, 10, HomeDriveStr, getenv(HomeDriveXor));
  45. GetVolumeInformationA(hardid1, NULL, 255, &dwSerial, NULL, NULL, NULL, 255);
  46.  
  47. //MAC SHIT
  48. unsigned char MACData[6];
  49. UUID uuid;
  50. UuidCreateSequential(&uuid);
  51. for (int i = 2; i < 8; i++) MACData[i - 2] = uuid.Data4[i];
  52. static char Hwid[40];
  53. sprintf_s(Hwid, 40, HwidXor, dwSerial, MACData[0], MACData[3], MACData[4], MACData[1], MACData[2], MACData[5]);
  54. HwidHash = hasher(Hwid);
  55. return Hwid;
  56. }
  57.  
  58. uint16 getCpuHash()
  59. {
  60.  
  61. int cpuinfo[4] = { 0, 0, 0, 0 };
  62. __cpuid(cpuinfo, 0);
  63. uint16 hash = 0;
  64. uint16* ptr = (uint16*)(&cpuinfo[0]);
  65. for (uint16 i = 0; i < 8; i++) hash += ptr[i];
  66. return hash;
  67.  
  68. }
  69.  
  70. const char* GetHwid2(int& HwidHash)
  71. {
  72. const char* HwidXor = XorStr("%u-3-%u"), *HomeDriveXor = XorStr("HOMEDRIVE"), *HomeDriveStr = XorStr("%s\\"), *HwidXorKey = XorStr("'");
  73. DWORD dwSerial;
  74. char hardid1[10];
  75. sprintf_s(hardid1, 10, HomeDriveStr, getenv(HomeDriveXor));
  76. GetVolumeInformationA(hardid1, NULL, 255, &dwSerial, NULL, NULL, NULL, 255);
  77.  
  78. static char Hwid[40];
  79. sprintf_s(Hwid, 40, HwidXor, dwSerial, getCpuHash());
  80. HwidHash = hasher(Hwid);
  81. return Hwid;
  82. }
  83. bool authed;
  84. void OldAuth()
  85. {
  86. int MyHwidHash, MyHwidHash2;
  87. const char* MyHwid = GetHwid(MyHwidHash), *MyHwid2 = GetHwid2(MyHwidHash2);
  88. AuthInfo* Auth = Auths.FindByPredicate([MyHwidHash, MyHwidHash2](const AuthInfo& Auth) { return Auth.HWID == MyHwidHash || Auth.HWID == MyHwidHash2; });
  89. if (Auth)
  90. {
  91. const char* AccountMsg = XorStr("UserID({}) Authenticated, Loaded NoAnnunaki!");
  92. Log::GetLog()->info(AccountMsg, Auth->UserID.ToString());
  93. ArkApi::GetHooks().SetHook(XorStr("APrimalStructure.TakeDamage"), &Hook_APrimalStructure_TakeDamage,
  94. &APrimalStructure_TakeDamage_original);
  95. authed = true;
  96.  
  97. return;
  98. }
  99. const char* AccountMsg = XorStr("Hwid1: {}\nHwid2: {} \nNot Authenticated, Unloaded NoAnnunaki!");
  100. std::ofstream outfile(ArkApi::Tools::GetCurrentDir() + (XorStr("/ArkApi/Plugins/NoAnnunaki/HWID.txt")));
  101. outfile << XorStr("HWID 1 = ") << MyHwid << XorStr("\nHWID 2 = ") <<MyHwid2 << std::endl;
  102. outfile.close();
  103. Log::GetLog()->error(AccountMsg, MyHwid, MyHwid2);
  104. }
  105.  
  106. void Unload()
  107. {
  108.  
  109. if (authed == true)
  110. {
  111. ArkApi::GetHooks().DisableHook(XorStr("APrimalStructure.TakeDamage"), &Hook_APrimalStructure_TakeDamage);
  112. ArkApi::GetHooks().DisableHook(XorStr("AShooterGameMode.InitGame"), &Hook_AShooterGameMode_InitGame);
  113. }
  114.  
  115. }
  116.  
  117. BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
  118. {
  119. Log::Get().Init("NoAnunnaki");
  120. switch (ul_reason_for_call)
  121. {
  122. case DLL_PROCESS_ATTACH:
  123. if (IsDebuggerPresent())
  124. return FALSE;
  125. if (ArkApi::GetApiUtils().GetStatus() == ArkApi::ServerStatus::Ready)
  126. {
  127. OldAuth();
  128. }
  129.  
  130. ArkApi::GetHooks().SetHook(XorStr("AShooterGameMode.InitGame"), &Hook_AShooterGameMode_InitGame,
  131. &AShooterGameMode_InitGame_original);
  132. break;
  133. case DLL_PROCESS_DETACH:
  134. Unload();
  135. break;
  136. }
  137. return TRUE;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment