1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream>
#include <windows.h>
#include <tlHelp32.h>
using namespace std;
bool InjectDLL(DWORD ProcessId);
char FileToInject[] = "ACube.dll";
char ProccessName[];
typedef HINSTANCE (*fploadLibrary)(char*);
int main () {
DWORD processId = NULL;
PROCESSENTRY32 pe32 = (sizeof(PROCESSENTRY32));
HANDLE hProcSnap;
cout << "Enter the victim process name!" << endl;
cin << ProccessName[];
while(!processID) {
system("CLS");
cout << "Searching for" << ProcessName << "..." << endl;
cout << "Make sure your game is running" << endl;
hProcSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if(Process32First(hProcSnap, &pe32){
do{
if(strcmp(pe32.szExeFile, ProcessName) == 0) {
processId = pe32.th32ProcessId;
break;
}
}while(Process32Next(hProcSnap, &pe32));
}
while (!InjectDLL(ProcessId)) {
system("CLS");
cout << "DLL Failed to inject!" << endl;
Sleep(1000);
}
cout << "Dll injection successful!!!" << endl;
cout << "Closing this in 5 seconds." << endl;
CloseHandle(hProcSnap);
Sleep(1000);
}
bool InjectDLL(DWORD ProcessId) {
HANDLE hProc;
LPVOID paramAddr;
HINSTANCE hDLL = LoadLibrary("KERNEL32");
hProc = OpenProcess (OPEN_ALL_ACCESS, false, ProcessId);
char DllPath[250] = "C:\\HACKS\\";
strcat(DllPath, FileToInject);
paramAddr = VirtualAllocEx(hProc,0,strlen(DllPath)+1,MEM_COMMIT,PAGE_READWRITE);
bool MemWrite = WriteProcessMemory(hProc,paramAddr,DllPath,strlen(DllPath)+1,NULL);
CreateRemoteThread(hProc,0,0,(LPTHREAD_START_ROUTINE)LoadLibrary,paramAddr,0,0);
CloseHandle(hProc);
return MemWrite;
}
|