Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 KB | None | 0 0
  1. // csgo_bhop.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include <Windows.h>
  5. #include <stdio.h>
  6. #include <cstdint>
  7. #include <algorithm>
  8. #include <iostream>
  9. #include <vector>
  10. #include <chrono>
  11. #include <deque>
  12. #include <random>
  13. #include <Psapi.h>
  14. #include <atomic>
  15. #include <array>
  16. #include <chrono>
  17. #include <iomanip>
  18. #include <iphlpapi.h>
  19. #include <locale>
  20. #include <stdlib.h>
  21. #include <string>
  22. #include <iostream>
  23. #include <sstream>
  24. #include <fstream>
  25. #include <thread>
  26. #include <assert.h>
  27. #include <cstddef>
  28. #include <thread>
  29. #include <TlHelp32.h>
  30.  
  31. uint32_t client_dll;
  32. uint32_t m_fFlags = 0x100;;
  33. uint32_t dwLocalPlayer = 0xC5E87C;
  34. uint32_t dwForceJump = 0x50DE048;
  35. HANDLE h_csgo;
  36. uint32_t pid_csgo;
  37.  
  38.  
  39. auto get_process_id(std::string process) ->uint32_t {
  40. HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  41. PROCESSENTRY32 entry;
  42. entry.dwSize = sizeof(entry);
  43. do
  44. {
  45. if (process == entry.szExeFile)
  46. {
  47. DWORD pid = entry.th32ProcessID;
  48. CloseHandle(hSnap);
  49.  
  50. return pid;
  51. }
  52. } while (Process32Next(hSnap, &entry));
  53.  
  54. CloseHandle(hSnap);
  55. return 0;
  56. }
  57. auto attach(std::string process) ->void {
  58. while (true)
  59. {
  60. pid_csgo = get_process_id(process);
  61. if (pid_csgo != 0)
  62. {
  63. h_csgo = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid_csgo);
  64. return;
  65. }
  66. Sleep(400);
  67. }
  68. }
  69. auto get_module(const char* modName) ->uint32_t
  70. {
  71. HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid_csgo);
  72.  
  73. MODULEENTRY32 entry;
  74. entry.dwSize = sizeof(entry);
  75.  
  76. do
  77. {
  78. if (!strcmp(entry.szModule, (LPSTR)modName))
  79. {
  80. CloseHandle(handle);
  81. return (DWORD)entry.modBaseAddr;
  82. }
  83.  
  84. } while (Module32Next(handle, (LPMODULEENTRY32)&entry));
  85.  
  86. return NULL;
  87. }
  88.  
  89. template <class T>
  90. auto read(uint32_t adr) -> T {
  91. T ret;
  92. ReadProcessMemory(h_csgo, reinterpret_cast<LPVOID>(adr), &ret, sizeof(T), NULL);
  93. return ret;
  94. }
  95.  
  96. template <class T>
  97. auto write(uint32_t adr, T buf) -> void {
  98. WriteProcessMemory(h_csgo, reinterpret_cast<LPVOID>(adr), &buf, sizeof(T), NULL);
  99. }
  100.  
  101.  
  102. uint32_t main()
  103. {
  104. attach("csgo.exe");
  105. std::this_thread::sleep_for(std::chrono::milliseconds(400));
  106. client_dll = get_module("client_panorama.dll");
  107. std::this_thread::sleep_for(std::chrono::milliseconds(400));
  108.  
  109. do {
  110.  
  111. auto local_player = read<uint32_t>(client_dll + dwLocalPlayer);
  112. auto flags = read<int>(local_player + m_fFlags);
  113. if (GetAsyncKeyState(32)) {
  114. if (flags < 263 && flags != 257)
  115. write<uint32_t>(client_dll + dwForceJump, 4);
  116. else
  117. write<uint32_t>(client_dll + dwForceJump, 5);
  118. }
  119. if (GetAsyncKeyState(4)) {
  120. printf_s("Client dll: 0x%x \n", client_dll);
  121. auto hp = read<int>(local_player + 0xFC);
  122. printf_s("Local Player: 0x%x \n", local_player);
  123. printf_s("Health: %d", hp);
  124. }
  125.  
  126. } while (true);
  127.  
  128. return 0;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement