Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.53 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <windows.h>
  3. #include <iostream>
  4. #include "Memory.h"
  5. #include "vector.h"
  6.  
  7. // T2 made by james1.
  8.  
  9.  
  10. //Hack toggle sounds
  11. const int C = 261;
  12. const int Cis = 277;
  13. const int D = 293;
  14. const int Dis = 311;
  15. const int E = 329;
  16. const int F = 349;
  17. const int Fis = 369;
  18. const int G = 391;
  19. const int Gis = 415;
  20. const int A = 440;
  21. const int Ais = 466;
  22. const int H = 493;
  23. const int Takt = 1700;
  24. //End
  25.  
  26. typedef unsigned char uint8_t;
  27.  
  28. template <typename T, size_t N>
  29.  
  30. size_t countof(T(&array)[N])
  31. {
  32. return N;
  33. }
  34.  
  35. DWORD dwLocalPlayer;
  36. DWORD dwEntityList;
  37. DWORD dwGlow;
  38. DWORD dwJump;
  39. DWORD dwForceAttack;
  40. DWORD dwClientState_ViewAngles;
  41. DWORD dwClientState;
  42. DWORD dwClientState_state;
  43.  
  44. DWORD dwTeam = 0xF0;
  45. DWORD dwDormant = 0xE9;
  46. DWORD dwFlags = 0x100;
  47. DWORD m_iShotsFired = 0xA2B0;
  48. DWORD m_aimPunchAngle = 0x301C;
  49. DWORD m_iCrosshairId = 0xB2A4;
  50. DWORD m_lifeState = 0x25B;
  51. DWORD DwEntitySize = 0x10;
  52.  
  53. /* Glow Object structure in csgo */
  54. struct glow_t
  55. {
  56. DWORD dwBase;
  57. float r;
  58. float g;
  59. float b;
  60. float a;
  61. uint8_t unk1[16];
  62. bool m_bRenderWhenOccluded;
  63. bool m_bRenderWhenUnoccluded;
  64. bool m_bFullBloom;
  65. uint8_t unk2[14];
  66. };
  67.  
  68. // Entity structure in csgo
  69. struct Entity
  70. {
  71. DWORD dwBase;
  72. int team;
  73. bool is_dormant;
  74. };
  75.  
  76. // Player structure in csgo
  77. struct Player
  78. {
  79. DWORD dwBase;
  80. bool isDormant;
  81. };
  82.  
  83. process memory;
  84. process _modClient;
  85. process* mem;
  86. PModule modClient;
  87. PModule modEngine;
  88.  
  89. int iFriendlies;
  90. int iEnemies;
  91.  
  92. Entity entEnemies[32];
  93. Entity entFriendlies[32];
  94. Entity me;
  95.  
  96. void update_entity_data(Entity* e, DWORD dwBase)
  97. {
  98. int dormant = memory.Read<int>(dwBase + dwDormant);
  99. e->dwBase = dwBase;
  100. e->team = memory.Read<int>(dwBase + dwTeam);
  101. e->is_dormant = dormant == 1;
  102. }
  103. /* Get Pointer To Client.dll*/
  104. PModule* GetClientModule() {
  105. if (modClient.dwBase == 0 && modClient.dwSize == 0) {
  106. modClient = memory.GetModule("client.dll");
  107. }
  108. return &modClient;
  109. }
  110.  
  111. PModule* GetEngineModule() {
  112. if (modEngine.dwBase == 0 && modEngine.dwSize == 0) {
  113. modEngine = memory.GetModule("engine.dll");
  114. }
  115. return &modEngine;
  116. }
  117.  
  118. Entity* GetEntityByBase(DWORD dwBase) {
  119.  
  120. for (int i = 0; i < iFriendlies; i++) {
  121. if (dwBase == entFriendlies[i].dwBase) {
  122. return &entFriendlies[i];
  123. }
  124. }
  125. for (int i = 0; i < iEnemies; i++) {
  126. if (dwBase == entEnemies[i].dwBase) {
  127. return &entEnemies[i];
  128. }
  129. }
  130. return nullptr;
  131. }
  132.  
  133. /* offset updating class, that uses patterns to find memory addresses */
  134. class offset
  135. {
  136. private:
  137. static void update_local_player() {
  138. DWORD lpStart = mem->FindPatternArray(modClient.dwBase, modClient.dwSize, "xxx????xx????xxxxx?", 19, 0x8D, 0x34, 0x85, 0x0, 0x0, 0x0, 0x0, 0x89, 0x15, 0x0, 0x0, 0x0, 0x0, 0x8B, 0x41, 0x8, 0x8B, 0x48, 0x0);
  139. DWORD lpP1 = mem->Read<DWORD>(lpStart + 3);
  140. BYTE lpP2 = mem->Read<BYTE>(lpStart + 18);
  141. dwLocalPlayer = (lpP1 + lpP2) - modClient.dwBase;
  142. }
  143.  
  144. static void update_entity_list() {
  145. DWORD elStart = mem->FindPatternArray(modClient.dwBase, modClient.dwSize, "x????xx?xxx", 11, 0x5, 0x0, 0x0, 0x0, 0x0, 0xC1, 0xE9, 0x0, 0x39, 0x48, 0x4);
  146. DWORD elP1 = mem->Read<DWORD>(elStart + 1);
  147. BYTE elP2 = mem->Read<BYTE>(elStart + 7);
  148. dwEntityList = (elP1 + elP2) - modClient.dwBase;
  149. }
  150.  
  151. static void update_glow() {
  152. DWORD gpStart = mem->FindPatternArray(modClient.dwBase, modClient.dwSize, "xxx????xxxxx????????", 20, 0x0F, 0x11, 0x05, 0x0, 0x0, 0x0, 0x0, 0x83, 0xC8, 0x01, 0xC7, 0x05, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0);
  153. dwGlow = mem->Read<DWORD>(gpStart + 3) - modClient.dwBase;
  154. }
  155.  
  156. static void update_Jump() {
  157. DWORD jStart = mem->FindPatternArray(modClient.dwBase, modClient.dwSize, "xx????xxxxxxx", 23, 0x8B, 0x0D, 0x0, 0x0, 0x0, 0x0, 0x8B, 0xD6, 0x8B, 0xC1, 0x83, 0xCA, 0x02);
  158. DWORD jOff = mem->Read<DWORD>(jStart + 2);
  159. dwJump = jOff - modClient.dwBase;
  160. }
  161.  
  162. static void update_ViewAngles() {
  163. DWORD esStart = mem->FindPatternArray(modEngine.dwBase, modEngine.dwSize, "xxxx????xxxxx", 13, 0xF3, 0x0F, 0x11, 0x80, 0x0, 0x0, 0x0, 0x0, 0xD9, 0x46, 0x04, 0xD9, 0x05);
  164. dwClientState_ViewAngles = mem->Read<DWORD>(esStart + 4);
  165. }
  166.  
  167. static void update_ClientState() {
  168. DWORD epStart = mem->FindPatternArray(modEngine.dwBase, modEngine.dwSize, "x????xxx?x?xxxx", 15, 0xA1, 0x0, 0x0, 0x0, 0x0, 0x33, 0xD2, 0x6A, 0x0, 0x6A, 0x0, 0x33, 0xC9, 0x89, 0xB0);
  169. dwClientState = mem->Read<DWORD>(epStart + 1) - modEngine.dwBase;
  170. }
  171.  
  172. static void update_ClientState_state() {
  173. DWORD ewpStart = mem->FindPatternArray(modEngine.dwBase, modEngine.dwSize, "xx????xxxx", 11, 0x83, 0xB8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0F, 0x94, 0xC0, 0xC3);
  174. dwClientState_state = mem->Read<DWORD>(ewpStart + 2);
  175. }
  176.  
  177. public:
  178. static void get_offset(process* m) {
  179. mem = m;
  180. modClient = mem->GetModule("client.dll");
  181. modEngine = mem->GetModule("engine.dll");
  182. update_local_player();
  183. update_entity_list();
  184. update_glow();
  185. update_Jump();
  186. update_ViewAngles();
  187. update_ClientState();
  188. update_ClientState_state();
  189. }
  190.  
  191. //constantly scanning & updating our offsets
  192. static DWORD WINAPI scan_offsets(LPVOID PARAM)
  193. {
  194. Entity players[64];
  195. while (true) {
  196. Sleep(1);
  197. DWORD playerBase = memory.Read<DWORD>(GetClientModule()->dwBase + dwLocalPlayer);
  198. int cp = 0;
  199.  
  200. update_entity_data(&me, playerBase);
  201. for (int i = 1; i < 64; i++) {
  202. DWORD entBase = memory.Read<DWORD>((GetClientModule()->dwBase + dwEntityList) + i * 0x10);
  203.  
  204. if (entBase == NULL)
  205. continue;
  206.  
  207. update_entity_data(&players[cp], entBase);
  208.  
  209. cp++;
  210. }
  211.  
  212. int cf = 0, ce = 0;
  213.  
  214. for (int i = 0; i < cp; i++) {
  215. if (players[i].team == me.team) {
  216. entFriendlies[cf] = players[i];
  217. cf++;
  218. }
  219. else {
  220. entEnemies[ce] = players[i];
  221. ce++;
  222. }
  223. }
  224. iEnemies = ce;
  225. iFriendlies = cf;
  226. }
  227. }
  228. };
  229.  
  230.  
  231. class virtualesp
  232. {
  233. private:
  234. static void glow_player(DWORD mObj, float r, float g, float b)
  235. {
  236. memory.Write<float>(mObj + 0x4, r);
  237. memory.Write<float>(mObj + 0x8, g);
  238. memory.Write<float>(mObj + 0xC, b);
  239. memory.Write<float>(mObj + 0x10, 1.0f);
  240. memory.Write<BOOL>(mObj + 0x24, true);
  241. memory.Write<BOOL>(mObj + 0x25, false);
  242. }
  243.  
  244. public:
  245. static void start_engine() {
  246. while (!memory.Attach("csgo.exe", PROCESS_ALL_ACCESS)) {
  247. Sleep(100);
  248. }
  249. do {
  250. Sleep(1000);
  251. offset::get_offset(&memory);
  252. } while (dwLocalPlayer < 65535);
  253. CreateThread(NULL, NULL, &offset::scan_offsets, NULL, NULL, NULL);
  254. }
  255.  
  256. static unsigned long __stdcall esp_thread(void*)
  257. {
  258. int objectCount;
  259. DWORD pointerToGlow;
  260. Entity* Player = NULL;
  261.  
  262. while (true)
  263. {
  264. Sleep(10);
  265. pointerToGlow = memory.Read<DWORD>(GetClientModule()->dwBase + dwGlow);
  266. objectCount = memory.Read<DWORD>(GetClientModule()->dwBase + dwGlow + 0x4);
  267. if (pointerToGlow != NULL && objectCount > 0)
  268. {
  269. for (int i = 0; i < objectCount; i++)
  270. {
  271. //Sleep(1); //flicker
  272.  
  273. DWORD mObj = pointerToGlow + i * sizeof(glow_t);
  274. glow_t glowObject = memory.Read<glow_t>(mObj);
  275. Player = GetEntityByBase(glowObject.dwBase);
  276.  
  277. if (glowObject.dwBase == NULL || Player == nullptr || Player->is_dormant) {
  278. continue;
  279. }
  280. if (me.team == Player->team) {
  281. glow_player(mObj, 0, 255, 0); //change color here Red, Green, Blue
  282. }
  283. else {
  284. glow_player(mObj, 255, 0, 0); //change color here Red, Green, Blue
  285. }
  286. }
  287. }
  288. }
  289. return EXIT_SUCCESS;
  290. }
  291. };
  292.  
  293. DWORD GetEnginePointer()
  294. {
  295. return mem->Read<DWORD>(modEngine.dwBase + dwClientState);
  296. }
  297.  
  298. bool IsInGame()
  299. {
  300. if (mem->Read<int>(GetEnginePointer() + dwClientState_state) == 6)
  301. {
  302. return true;
  303. }
  304. return false;
  305. }
  306.  
  307. Vector GetViewAngles()
  308. {
  309. return mem->Read<Vector>(GetEnginePointer() + dwClientState_ViewAngles);
  310. }
  311.  
  312. void SetViewAngles(Vector angles)
  313. {
  314. mem->Write<Vector>(GetEnginePointer() + dwClientState_ViewAngles, angles);
  315. }
  316.  
  317. DWORD GetLocalPlayer()
  318. {
  319. return mem->Read<DWORD>(modClient.dwBase + dwLocalPlayer);
  320. }
  321.  
  322. int GetShotsFired()
  323. {
  324. return mem->Read<int>(GetLocalPlayer() + m_iShotsFired);
  325. }
  326.  
  327. int getLocalTeam()
  328. {
  329. return mem->Read<int>(GetLocalPlayer() + dwTeam);
  330. }
  331.  
  332. int GetCrosshairId()
  333. {
  334. DWORD PlayerBase = GetLocalPlayer();
  335. if (PlayerBase)
  336. {
  337. return mem->Read<int>(PlayerBase + m_iCrosshairId) - 1;
  338. }
  339. }
  340.  
  341. DWORD GetBaseEntity(int PlayerNumber)
  342. {
  343. return mem->Read<DWORD>(modClient.dwBase + dwEntityList + (DwEntitySize * PlayerNumber));
  344. }
  345.  
  346. int GetTeam(int PlayerNumber)
  347. {
  348. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  349. if (BaseEntity)
  350. {
  351. return mem->Read<int>(BaseEntity + dwTeam);
  352. }
  353. }
  354.  
  355. int GetTeam()
  356. {
  357. DWORD PlayerBase = GetLocalPlayer();
  358. if (PlayerBase)
  359. {
  360. return mem->Read<int>(PlayerBase + dwTeam);
  361. }
  362. }
  363.  
  364. bool IsDead(int PlayerNumber)
  365. {
  366. DWORD BaseEntity = GetBaseEntity(PlayerNumber);
  367. if (BaseEntity)
  368. {
  369. return mem->Read<bool>(BaseEntity + m_lifeState);
  370. }
  371. }
  372.  
  373. class cheats
  374. {
  375. public:
  376. static unsigned long __stdcall trigger_thread(void*)
  377. {
  378. while (true)
  379. {
  380. if (GetAsyncKeyState(VK_MENU) < 0 && VK_MENU != 1)
  381. {
  382. int PlayerNumber = GetCrosshairId();
  383. if (PlayerNumber < 64 && PlayerNumber >= 0 && GetTeam(PlayerNumber) != GetTeam() && IsDead(PlayerNumber) != true)
  384. {
  385. mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
  386. Sleep(200);
  387. mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
  388. Sleep(30);
  389. }
  390. else
  391. {
  392. Sleep(1);
  393. }
  394. }
  395. Sleep(1);
  396. }
  397. return EXIT_SUCCESS;
  398. }
  399. };
  400.  
  401. class sound
  402. {
  403. public:
  404. static unsigned long __stdcall sound_thread(void*)
  405. {
  406. while (true)
  407. {
  408. if (GetAsyncKeyState(VK_CAPITAL) < 0 && VK_CAPITAL != 1)
  409. {
  410. int PlayerNumber = GetCrosshairId();
  411. if (PlayerNumber < 64 && PlayerNumber >= 0 && GetTeam(PlayerNumber) != GetTeam() && IsDead(PlayerNumber) != true)
  412. {
  413. Beep(C * 2, Takt / 8);
  414. Sleep(275);
  415. }
  416. else
  417. {
  418. Sleep(1);
  419. }
  420. }
  421. Sleep(1);
  422. }
  423. return EXIT_SUCCESS;
  424. }
  425. };
  426.  
  427. int main()
  428. {
  429. SetConsoleTitle("Command Prompt");
  430. bool glow = false;
  431. bool bhop = false;
  432. bool norecoil = false;
  433. bool trigger = false;
  434. bool sound = false;
  435.  
  436. HANDLE ESP = NULL;
  437. HANDLE BHOP = NULL;
  438. HANDLE NORECOIL = NULL;
  439. HANDLE TRIGGER = NULL;
  440. HANDLE SOUND = NULL;
  441.  
  442. std::cout << "Microsoft Windows [Version 7.0.17134.122]" << std::endl;
  443. std::cout << "(c) 2018 Microsoft Corporation. All rights reserved." << std::endl;
  444. std::cout << "" << std::endl;
  445. std::cout << "C:\\Users\\Administrator" << std::endl;
  446.  
  447. virtualesp::start_engine();
  448.  
  449. // std::cout << "Offsets" << std::endl;
  450. // std::cout << "" << std::endl;
  451. // std::cout << "Localplayer = 0x" << std::hex << dwLocalPlayer << std::endl;
  452. // std::cout << "Entitylist = 0x" << std::hex << dwEntityList << std::endl;
  453. // std::cout << "Glowobject = 0x" << std::hex << dwGlow << std::endl;
  454. // std::cout << "Forcejump = 0x" << std::hex << dwJump << std::endl;
  455. // std::cout << "Viewangles = 0x" << std::hex << dwClientState_ViewAngles << std::endl;
  456. // td::cout << "Clientstate = 0x" << std::hex << dwClientState << std::endl;
  457. // std::cout << "Clientstate_state = 0x" << std::hex << dwClientState_state << std::endl;
  458. // std::cout << "" << std::endl;
  459.  
  460. while (TRUE)
  461. {
  462. Sleep(1);
  463. if (GetAsyncKeyState(VK_LAUNCH_APP1) & 1) {
  464. glow = !glow;
  465. if (glow) {
  466. // std::cout << "Glow: 1" << std::endl;
  467. ESP = CreateThread(NULL, NULL, &virtualesp::esp_thread, NULL, NULL, NULL);
  468. Beep(C * 2, Takt / 8);
  469. }
  470. else {
  471. // std::cout << "Glow: 0" << std::endl;
  472. TerminateThread(ESP, 0);
  473. CloseHandle(ESP);
  474. Beep(C * 2, Takt / 8);
  475. Beep(C * 2, Takt / 8);
  476. }
  477. }
  478.  
  479. if (GetAsyncKeyState(VK_INSERT) & 1) {
  480. trigger = !trigger;
  481. if (trigger) {
  482. // std::cout << "Trigger: 1" << std::endl;
  483. TRIGGER = CreateThread(NULL, NULL, &cheats::trigger_thread, NULL, NULL, NULL);
  484. Beep(C * 2, Takt / 8);
  485. }
  486. else {
  487. // std::cout << "Trigger: 0" << std::endl;
  488. TerminateThread(TRIGGER, 0);
  489. CloseHandle(TRIGGER);
  490. Beep(C * 2, Takt / 8);
  491. Beep(C * 2, Takt / 8);
  492. }
  493. }
  494.  
  495. if (GetAsyncKeyState(VK_DELETE) & 1) {
  496. sound = !sound;
  497. if (sound) {
  498. // std::cout << "Sound: 1" << std::endl;
  499. SOUND = CreateThread(NULL, NULL, &sound::sound_thread, NULL, NULL, NULL);
  500. Beep(C * 2, Takt / 8);
  501. }
  502. else {
  503. // std::cout << "Sound: 0" << std::endl;
  504. TerminateThread(SOUND, 0);
  505. CloseHandle(SOUND);
  506. Beep(C * 2, Takt / 8);
  507. Beep(C * 2, Takt / 8);
  508. }
  509. }
  510. }
  511. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement