InfoKriegerX66

Pluton

May 12th, 2016
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Windows.h>
  2. #include <Psapi.h>
  3. #include <TlHelp32.h>
  4. #include <iostream>
  5. #include <tchar.h>
  6.  
  7. #include "Resource.hpp"
  8.  
  9. #ifdef _USING_V110_SDK71_
  10. #define WINDOWS_XP_BUILD
  11. #endif // _USING_V110_SDK71_
  12.  
  13. #define FFLAGS_FALLING 128
  14. #define FFLAGS_GROUND 129
  15. #define FFLAGS_AIR 130
  16. #define FFLAGS_GROUNDCROUCH 131
  17. #define FFLAGS_WATER 641
  18. #define FFLAGS_WATERCROUCH 643
  19.  
  20. LPCTSTR szWindowTitle = _T("Left 4 Dead 2");
  21. HWND hWnd = NULL;
  22. HINSTANCE hInstance = NULL;
  23. HANDLE hConsoleOutput = NULL;
  24. HANDLE hProcess = NULL;
  25. HANDLE hThread = NULL;
  26. DWORD dwPiD = NULL;
  27. DWORD dwAddress = NULL;
  28. DWORD dwClientBase = NULL;
  29. DWORD dwBaseEntity = NULL;
  30. bool bIsEnabled = false;
  31.  
  32. BOOL SetConsoleIcon(HICON hIcon)
  33. {
  34.     typedef BOOL(WINAPI* SetConsoleIconFn)(HICON);
  35.     static SetConsoleIconFn fnSetConsoleIcon = NULL;
  36.     if (!fnSetConsoleIcon)
  37.         fnSetConsoleIcon = (SetConsoleIconFn)GetProcAddress(GetModuleHandle(_T("kernel32")), "SetConsoleIcon");
  38.     if (!fnSetConsoleIcon)
  39.         return FALSE;
  40.     return fnSetConsoleIcon(hIcon);
  41. }
  42.  
  43. LPCTSTR FormatError(DWORD dwStatus)
  44. {
  45.     LPTSTR lpBuffer = NULL;
  46.     if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
  47.         NULL, dwStatus, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPTSTR)&lpBuffer, 0, NULL))
  48.         wsprintf(lpBuffer, _T("Error Code: %lu"), dwStatus);
  49.     return lpBuffer;
  50. }
  51.  
  52. DWORD GetModuleSize(LPCTSTR szModuleName, DWORD dwProcessId)
  53. {
  54.     MODULEENTRY32 cbModule = { sizeof(MODULEENTRY32) };
  55.     HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId);
  56.     if (hSnapshot == INVALID_HANDLE_VALUE)
  57.         return NULL;
  58.  
  59.     if (Module32First(hSnapshot, &cbModule))
  60.         while (Module32Next(hSnapshot, &cbModule))
  61.             if (!lstrcmp(cbModule.szModule, szModuleName))
  62.                 break;
  63.  
  64.     CloseHandle(hSnapshot);
  65.     return cbModule.modBaseSize;
  66. }
  67.  
  68. DWORD GetModuleBase(LPCTSTR szModuleName, DWORD dwProcessId)
  69. {
  70.     MODULEENTRY32 cbModule = { sizeof(MODULEENTRY32) };
  71.     HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId);
  72.     if (hSnapshot == INVALID_HANDLE_VALUE)
  73.         return NULL;
  74.  
  75.     if (Module32First(hSnapshot, &cbModule))
  76.         while (Module32Next(hSnapshot, &cbModule))
  77.             if (!lstrcmp(cbModule.szModule, szModuleName))
  78.                 break;
  79.  
  80.     CloseHandle(hSnapshot);
  81.     return (DWORD)cbModule.modBaseAddr;
  82. }
  83.  
  84. DWORD GetProcessIdFromName(LPCTSTR szProcName)
  85. {
  86.     PROCESSENTRY32 cbProcess = { sizeof(PROCESSENTRY32) };
  87.     HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  88.     if (hSnapshot == INVALID_HANDLE_VALUE)
  89.         return NULL;
  90.  
  91.     if (Process32First(hSnapshot, &cbProcess))
  92.         while (Process32Next(hSnapshot, &cbProcess))
  93.             if (!lstrcmp(cbProcess.szExeFile, szProcName))
  94.                 break;
  95.  
  96.     CloseHandle(hSnapshot);
  97.     return cbProcess.th32ProcessID;
  98. }
  99.  
  100. VOID ThreadProc()
  101. {
  102.     BYTE kState[256];
  103.     int fFlags = 0;
  104.     bool bIsJumped = false;
  105.     bool bIsPressed = false;
  106.     bool bIsCrouched = false;
  107.  
  108.     while (bIsEnabled)
  109.     {
  110.         ReadProcessMemory(hProcess, (PBYTE*)(dwClientBase + 0x7964FC), &dwBaseEntity, sizeof(DWORD), NULL);
  111.         ReadProcessMemory(hProcess, (PBYTE*)(dwBaseEntity + 0xF0), &fFlags, sizeof(int), NULL); // 0xF0
  112.        
  113.         if ((GetAsyncKeyState(VK_SPACE) & 0x8000) || (GetAsyncKeyState(VK_LMENU) & 0x8000))
  114.         {
  115.             if (fFlags == FFLAGS_GROUND || fFlags == FFLAGS_GROUNDCROUCH || fFlags == FFLAGS_WATER || fFlags == FFLAGS_WATERCROUCH)
  116.             {
  117.                 if ((GetAsyncKeyState(VK_LMENU) & 0x8000) && !bIsCrouched)
  118.                 {
  119.                     GetKeyboardState((PBYTE)&kState);
  120.                     kState[VK_LCONTROL] |= 0x80;
  121.                     SetKeyboardState((PBYTE)&kState);
  122.                     PostMessage(hWnd, WM_KEYDOWN, VK_LCONTROL, ((LPARAM)(29 << 16)) | 0x00000001);
  123.                     bIsCrouched = true;
  124.                 }
  125.                 SendMessage(hWnd, WM_KEYDOWN, VK_SPACE, 0x390000);
  126.                 bIsJumped = true;
  127.                 bIsPressed = true;
  128.             }
  129.             else if (fFlags == FFLAGS_AIR || fFlags == FFLAGS_FALLING)
  130.             {
  131.                 SendMessage(hWnd, WM_KEYUP, VK_SPACE, 0x390000);
  132.                 /* SMAC Bypass */
  133.                 if (bIsJumped)
  134.                 {
  135.                     Sleep(16);
  136.                     SendMessage(hWnd, WM_KEYDOWN, VK_SPACE, 0x390000);
  137.                     SendMessage(hWnd, WM_KEYUP, VK_SPACE, 0x390000);
  138.                     bIsJumped = false;
  139.                 }
  140.                 bIsPressed = true;
  141.             }
  142.         }
  143.         else if (bIsPressed)
  144.         {
  145.             if (bIsCrouched)
  146.             {
  147.                 GetKeyboardState((PBYTE)&kState);
  148.                 kState[VK_LCONTROL] &= ~0x80;
  149.                 SetKeyboardState((PBYTE)&kState);
  150.                 PostMessage(hWnd, WM_KEYUP, VK_LCONTROL, ((LPARAM)(29 << 16)) | 0xC0000001);
  151.                 bIsCrouched = false;
  152.             }
  153.             if (bIsJumped)
  154.                 SendMessage(hWnd, WM_KEYUP, VK_SPACE, 0x390000);
  155.             bIsPressed = false;
  156.         }
  157.         Sleep(10);
  158.     }
  159. }
  160.  
  161. int _tmain(int argc, _TCHAR* argv[], _TCHAR* envp[])
  162. {
  163.     CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
  164.  
  165.     hWnd = GetConsoleWindow();
  166.     hInstance = GetModuleHandle(NULL);
  167.     hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
  168.  
  169. #ifdef WINDOWS_XP_BUILD
  170.     SetConsoleTitle(_T("Pluton for Windows XP"));
  171. #else
  172.     SetConsoleTitle(_T("Pluton for Windows"));
  173. #endif
  174.     SetConsoleIcon(LoadIcon(hInstance, MAKEINTRESOURCE(ICON_L4D2)));
  175.  
  176. #ifndef WINDOWS_XP_BUILD
  177.     CONSOLE_FONT_INFOEX cbFontInfo = { 0 };
  178.     GetCurrentConsoleFontEx(hConsoleOutput, FALSE, &cbFontInfo);
  179.     cbFontInfo.cbSize = sizeof(CONSOLE_FONT_INFOEX);
  180.     cbFontInfo.nFont = 9;
  181.     cbFontInfo.dwFontSize.X = 10;
  182.     cbFontInfo.dwFontSize.Y = 16;
  183.     cbFontInfo.FontFamily = 54;
  184.     cbFontInfo.FontWeight = 400;
  185.     wcscpy_s(cbFontInfo.FaceName, L"Consolas");
  186.     SetCurrentConsoleFontEx(hConsoleOutput, FALSE, &cbFontInfo);
  187.  
  188.     COORD cbSize = { 100, 30 };
  189.     SetConsoleScreenBufferSize(hConsoleOutput, cbSize);
  190.     SMALL_RECT cbWindowInfo = { 0, 0, 100 - 1, 30 - 1 }; // Window Size
  191.     SetConsoleWindowInfo(hConsoleOutput, TRUE, &cbWindowInfo);
  192.     RECT cbRect = { 0, 0, 0, 0 };
  193.     GetWindowRect(hWnd, &cbRect);
  194.     LONG dwWidth = (GetSystemMetrics(SM_CXSCREEN) - cbRect.right) / 2;
  195.     LONG dwHeight = (GetSystemMetrics(SM_CYSCREEN) - cbRect.bottom) / 4;
  196.  
  197.     SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_LAYERED);
  198.     SetLayeredWindowAttributes(hWnd, 0, 220, LWA_ALPHA);
  199. #endif
  200.    
  201.     SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
  202.    
  203.     _tprintf(_T(" __________.__          __                 \n"));
  204.     _tprintf(_T(" \\______   \\  |  __ ___/  |_  ____   ____  \n"));
  205.     _tprintf(_T("  |     ___/  | |  |  \\   __\\/  _ \\ /    \\ \n"));
  206.     _tprintf(_T("  |    |   |  |_|  |  /|  | (  <_> )   |  \\\n"));
  207.     _tprintf(_T("  |____|   |____/____/ |__|  \\____/|___|  /\n"));
  208.     _tprintf(_T("                                        \\/ \n\n"));
  209.  
  210.     _tprintf(_T("INSERT   : Activate Pluton.\n"));
  211.     _tprintf(_T("NUMPAD 0 : Auto Bhop Disables.\n"));
  212.     _tprintf(_T("NUMPAD 1 : Auto Bhop Enables.\n"));
  213.    
  214.     if (!(hWnd = FindWindow(NULL, szWindowTitle)))
  215.     {
  216.         SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  217.         _tprintf(_T("\n[*] Awaiting Left 4 Dead 2 launch..."));
  218.         while (!(hWnd = FindWindow(NULL, szWindowTitle)))
  219.             Sleep(50);
  220.     }
  221.    
  222.     SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  223.     _tprintf(_T("\n[+] Left 4 Dead 2 found!\n"));
  224.  
  225.     while (!(dwPiD = GetProcessIdFromName(_T("left4dead2.exe"))))
  226.         Sleep(50);
  227.     while (!(hProcess = OpenProcess(SYNCHRONIZE | PROCESS_VM_READ, FALSE, dwPiD)))
  228.         Sleep(50);
  229.     while (!(dwClientBase = GetModuleBase(_T("client.dll"), dwPiD)))
  230.         Sleep(50);
  231.  
  232.     SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
  233.     _tprintf(_T("[*] Awaiting Pluton's activation...\n"));
  234.     while (!GetAsyncKeyState(VK_INSERT))
  235.         Sleep(50);
  236.  
  237.     SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  238.     _tprintf(_T("[+] Pluton activated!\n"));
  239.     SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
  240.     Beep(0x367, 250);
  241.  
  242.     while (FindWindow(NULL, szWindowTitle))
  243.     {
  244.         if ((GetAsyncKeyState(VK_NUMPAD0) & 0x8000) && bIsEnabled)
  245.         {
  246.             bIsEnabled = false;
  247.             hThread = NULL;
  248.             SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_RED | FOREGROUND_INTENSITY);
  249.             _tprintf(_T("[-] Auto Bhop Disabled!\n"));
  250.             SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
  251.             if (!Beep(0x255, 250))
  252.                 Sleep(250);
  253.         }
  254.  
  255.         if ((GetAsyncKeyState(VK_NUMPAD1) & 0x8000) && !bIsEnabled)
  256.         {
  257.             bIsEnabled = true;
  258.             hThread = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)ThreadProc, NULL, NULL, NULL);
  259.             if (!hThread)
  260.             {
  261.                 SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_RED | FOREGROUND_INTENSITY);
  262.                 _tprintf(_T("[-] Error: %ls\n"), FormatError(GetLastError()));
  263.                 SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
  264.                 break;
  265.             }
  266.             SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
  267.             _tprintf(_T("[+] Auto Bhop Enabled!\n"));
  268.             SetConsoleTextAttribute(hConsoleOutput, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
  269.             if (!Beep(0x367, 250))
  270.                 Sleep(250);
  271.         }
  272.         Sleep(50);
  273.     }
  274.     _tprintf(_T("\n"));
  275.     _tsystem(_T("pause"));
  276.     return EXIT_SUCCESS;
  277. }
Advertisement
Add Comment
Please, Sign In to add comment