Guest User

Untitled

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "iostream";
  3. #include "atlstr.h";
  4. #include <windows.h>
  5. #include <TlHelp32.h>
  6. #include <stdio.h>
  7. #include <psapi.h>
  8. using namespace std;
  9.  
  10. #pragma comment(lib, "Psapi.lib")
  11.  
  12. PROCESS_INFORMATION CreateVProcess();
  13. void TryToCrack(PROCESS_INFORMATION processInfo);
  14.  
  15. //
  16. // 85 c0 0f 84 9e 00 00 00
  17. // 85 c0 0f 85 9e 00 00 00
  18. // First offset 34EC7, do 34EC8
  19. //
  20. // second offset 34F03
  21. // 74 2E
  22. // EB 2E
  23.  
  24.  
  25. int main()
  26. {
  27. cout << "Launching Application" << endl;
  28. PROCESS_INFORMATION processInfo = CreateVProcess();
  29. cout << "Trying to crack..." << endl;
  30. TryToCrack(processInfo);
  31. return 0;
  32. }
  33.  
  34. PROCESS_INFORMATION CreateVProcess()
  35. {
  36. LPCTSTR path = L"NameOfAppHere.exe";
  37.  
  38. // additional information
  39. STARTUPINFO si;
  40. PROCESS_INFORMATION pi;
  41.  
  42. // set the size of the structures
  43. ZeroMemory(&si, sizeof(si));
  44. si.cb = sizeof(si);
  45. ZeroMemory(&pi, sizeof(pi));
  46.  
  47. CreateProcess(
  48. path,
  49. NULL, // Command line
  50. NULL, // Process handle not inheritable
  51. NULL, // Thread handle not inheritable
  52. FALSE, // Set handle inheritance to FALSE
  53. 0, // No creation flags
  54. NULL, // Use parent's environment block
  55. NULL, // Use parent's starting directory
  56. &si, // Pointer to STARTUPINFO structure
  57. &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)
  58. );
  59. return pi;
  60. }
  61.  
  62. void TryToCrack(PROCESS_INFORMATION processInfo)
  63. {
  64. Sleep(500);
  65.  
  66. HANDLE targetProcess = OpenProcess(STANDARD_RIGHTS_WRITE, 0, processInfo.dwProcessId);
  67. void* hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, processInfo.dwProcessId);
  68. MODULEENTRY32 mod32;
  69. mod32.dwSize = sizeof(MODULEENTRY32);
  70. Module32Next(hSnap, &mod32);
  71.  
  72. DWORD modHandle = (DWORD)mod32.modBaseAddr;
  73.  
  74. unsigned char mem1 = 0x85;
  75. unsigned char mem2 = 0x75;
  76.  
  77. for (int i = 0; i < 100000; i++)
  78. {
  79. WriteProcessMemory(processInfo.hProcess, (LPVOID)(modHandle + 0x034EC8), &mem1, 1, NULL);
  80. WriteProcessMemory(processInfo.hProcess, (LPVOID)(modHandle + 0x034F02), &mem2, 1, NULL);
  81. }
  82. }
Add Comment
Please, Sign In to add comment