Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "Inject.h"
  3.  
  4. #define DLL_NAME "your.dll" //имя длл
  5.  
  6. #define JUNKS \
  7. __asm _emit 0x03 \
  8. __asm _emit 0x01 \
  9. __asm _emit 0x03 \
  10. __asm _emit 0x04 \
  11. __asm _emit 0x05 \
  12. __asm _emit 0x06 \
  13. __asm _emit 0x07 \
  14. __asm _emit 0x08 \
  15. __asm _emit 0x09 \
  16.  
  17.  
  18. #define _JUNK_BLOCK(s) __asm jmp s JUNKS __asm s:
  19.  
  20.  
  21. /////////////////////////////////////////////////////////////////////////////////////
  22. // INJECTOR CODE //
  23. /////////////////////////////////////////////////////////////////////////////////////
  24.  
  25. DWORD Process(char* ProcessName)
  26. {
  27. _JUNK_BLOCK(jmp_label1)
  28. HANDLE hPID = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  29.  
  30. _JUNK_BLOCK(jmp_label2)
  31. PROCESSENTRY32 ProcEntry;
  32.  
  33. _JUNK_BLOCK(jmp_label3)
  34. ProcEntry.dwSize = sizeof(ProcEntry);
  35.  
  36. _JUNK_BLOCK(jmp_label4)
  37. do
  38. {
  39. _JUNK_BLOCK(jmp_label5)
  40. if (!strcmp(ProcEntry.szExeFile, ProcessName))
  41. {
  42. _JUNK_BLOCK(jmp_label6)
  43. DWORD dwPID = ProcEntry.th32ProcessID;
  44.  
  45. _JUNK_BLOCK(jmp_label7)
  46. CloseHandle(hPID);
  47.  
  48. _JUNK_BLOCK(jmp_label8)
  49. return dwPID;
  50. }
  51.  
  52. _JUNK_BLOCK(jmp_label9)
  53. } while (Process32Next(hPID, &ProcEntry));
  54.  
  55. _JUNK_BLOCK(jmp_label10)
  56. }
  57.  
  58. int inject()
  59.  
  60. _JUNK_BLOCK(jmp_label11)
  61. DWORD dwProcess;
  62.  
  63. _JUNK_BLOCK(jmp_label12)
  64. char myDLL[MAX_PATH];
  65.  
  66. _JUNK_BLOCK(jmp_label13)
  67. GetFullPathName(DLL_NAME, MAX_PATH, myDLL, 0);
  68.  
  69. _JUNK_BLOCK(jmp_label4)
  70. dwProcess = Process("csgo.exe");
  71.  
  72. _JUNK_BLOCK(jmp_label15)
  73. HANDLE hProcess = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, FALSE, dwProcess);
  74.  
  75. _JUNK_BLOCK(jmp_label16)
  76. LPVOID allocatedMem = VirtualAllocEx(hProcess, NULL, sizeof(myDLL), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
  77.  
  78. _JUNK_BLOCK(jmp_label17)
  79. WriteProcessMemory(hProcess, allocatedMem, myDLL, sizeof(myDLL), NULL);
  80.  
  81. _JUNK_BLOCK(jmp_label18)
  82. CreateRemoteThread(hProcess, 0, 0, (LPTHREAD_START_ROUTINE)LoadLibrary, allocatedMem, 0, 0);
  83.  
  84. _JUNK_BLOCK(jmp_label19)
  85. CloseHandle(hProcess);
  86.  
  87. _JUNK_BLOCK(jmp_label20)
  88. return 0;
  89.  
  90. _JUNK_BLOCK(jmp_label21)
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement