Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.14 KB | None | 0 0
  1. // dllmain.cpp : Defines the entry point for the DLL application
  2. #include "framework.h"
  3. #include "csgo.hpp"
  4. #include "mem.h"
  5. #include <iostream>
  6. #include <assert.h>
  7.  
  8. struct variables
  9. {
  10.     uintptr_t localPlayer;
  11.     uintptr_t gameModule;
  12.     uintptr_t engineModule;
  13.     uintptr_t glowObject;
  14. } val;
  15.  
  16. struct GlowStruct
  17. {
  18.     BYTE base[4];
  19.     float red;
  20.     float green;
  21.     float blue;
  22.     float alpha;
  23.     BYTE buffer[16];
  24.     bool renderWhenOccluded;
  25.     bool renderWhenUnOccluded;
  26.     bool fullBloom;
  27.     BYTE buffer1[5];
  28.     int glowStyle;
  29. };
  30.  
  31. void SetTeamGlow(uintptr_t entity, int glowIndex)
  32. {
  33.     GlowStruct TGlow;
  34.     TGlow = *(GlowStruct*)(val.glowObject + (glowIndex * 0x38));
  35.  
  36.     TGlow.blue = 1.0f;
  37.     TGlow.alpha = 1.0f;
  38.     TGlow.renderWhenOccluded = true;
  39.     TGlow.renderWhenUnOccluded = false;
  40.     *(GlowStruct*)(val.glowObject + (glowIndex * 0x38)) = TGlow;
  41. }
  42.  
  43. void SetEnemyGlow(uintptr_t entity, int glowIndex)
  44. {
  45.     GlowStruct EGlow;
  46.     EGlow = *(GlowStruct*)(val.glowObject + (glowIndex * 0x38));
  47.     EGlow.blue = 1.0f;
  48.     EGlow.alpha = 1.0f;
  49.     EGlow.renderWhenOccluded = true;
  50.     EGlow.renderWhenUnOccluded = false;
  51.     *(GlowStruct*)(val.glowObject + (glowIndex * 0x38)) = EGlow;
  52. }
  53.  
  54. DWORD APIENTRY HackThread(HMODULE hModule)
  55. {
  56.     AllocConsole();
  57.     FILE* f;
  58.     freopen_s(&f, "CONOUT$", "w", stdout);
  59.  
  60.     uintptr_t moduleBase = (uintptr_t)GetModuleHandle(L"client_panorama.dll");
  61.     std::cout << "Module Base : " << std::hex << moduleBase << std::endl;
  62.     val.localPlayer = (uintptr_t)(moduleBase + hazedumper::signatures::dwLocalPlayer); // 28DC2A3C | 28DC2A3C
  63.     std::cout << "Local Player : " << std::hex << val.localPlayer << std::endl;
  64.  
  65.     if (val.localPlayer == NULL)
  66.     {
  67.         std::cout << "Local player is NULL - If statement test" << std::endl;
  68.     }
  69.     while (val.localPlayer == NULL)
  70.     {
  71.         std::cout << "Local player is NULL - Loop" << std::endl;
  72.         val.localPlayer = (uintptr_t)(moduleBase + hazedumper::signatures::dwLocalPlayer);
  73.     }
  74.    
  75.     while (1)
  76.     {
  77.         val.glowObject = (uintptr_t)(moduleBase + hazedumper::signatures::dwGlowObjectManager);
  78.         int myTeam = *(int*)mem::FindDMAAddy(val.localPlayer, { hazedumper::netvars::m_iTeamNum });
  79.         std::cout << "myTeam : " << myTeam << std::endl;
  80.        
  81.  
  82.  
  83.         for (unsigned int i = 0; i < 65; ++i)
  84.         {
  85.             uintptr_t entity = (uintptr_t)(moduleBase + hazedumper::signatures::dwEntityList + i * 0x10); // PROBLEM LIES HERE
  86.             if (entity != NULL)
  87.             {
  88.                 std::cout << "Entity is not null check went through" << std::endl;
  89.                 std::cout << "Entity Address : " << std::hex << entity << std::endl;
  90.                
  91.                 //uintptr_t glowIndexAddr = (uintptr_t)(entity + hazedumper::netvars::m_iGlowIndex);
  92.                 int glowIndex = *(int*)mem::FindDMAAddy(entity, { hazedumper::netvars::m_iGlowIndex });
  93.                 //uintptr_t entityTeamAddr = (uintptr_t)(entity + hazedumper::netvars::m_iTeamNum);
  94.                 int entityTeam = *(int*)mem::FindDMAAddy(entity, { hazedumper::netvars::m_iTeamNum });
  95.                 std::cout << "glowIndex : " << std::dec << glowIndex << std::endl;
  96.                 std::cout << "EntityTeam : " << std::dec << entityTeam << std::endl;
  97.  
  98.                 if (entityTeam != 2 && entityTeam != 3) continue; // Performance increase
  99.  
  100.                 if (myTeam == entityTeam)
  101.                 {
  102.                     std::cout << "Equal to team check" << std::endl;
  103.                     SetTeamGlow(entity, glowIndex);
  104.                     std::cout << "Set glow fine #1" << std::endl;
  105.                 }
  106.                 else
  107.                 {
  108.                     std::cout << "Not Equal to team check" << std::endl;
  109.                     SetEnemyGlow(entity, glowIndex);
  110.                     std::cout << "Set glow fine #2" << std::endl;
  111.                 }
  112.             }
  113.             std::cout << "First loop #" << std::dec << i << '\t' << std::endl;
  114.             Sleep(3);
  115.         }
  116.  
  117.         if (GetAsyncKeyState(VK_NUMPAD1) & 1)
  118.         {
  119.             break;
  120.         }
  121.  
  122.         Sleep(5);
  123.     }
  124.    
  125.     fclose(f);
  126.     FreeConsole();
  127.     FreeLibraryAndExitThread(hModule, 0);
  128.     return 0;
  129. }
  130.  
  131. BOOL APIENTRY DllMain( HMODULE hModule,
  132.                        DWORD  ul_reason_for_call,
  133.                        LPVOID lpReserved
  134.                      )
  135. {
  136.     switch (ul_reason_for_call)
  137.     {
  138.     case DLL_PROCESS_ATTACH:
  139.     {
  140.         CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)HackThread, hModule, 0, nullptr));
  141.     }
  142.     case DLL_THREAD_ATTACH:
  143.     case DLL_THREAD_DETACH:
  144.     case DLL_PROCESS_DETACH:
  145.         break;
  146.     }
  147.     return TRUE;
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement