Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <Windows.h>
- #include <stdio.h>
- #include <string>
- #include <fstream>
- using namespace std;
- /*Simple Injector for CS: GO*/
- DWORD get_pid(LPCSTR window_name)
- {
- HWND hwnd;
- DWORD pid;
- hwnd = FindWindowA(NULL, window_name);
- while (hwnd == NULL)
- {
- hwnd = FindWindowA(NULL, window_name);
- Sleep(100);
- }
- GetWindowThreadProcessId(hwnd, &pid);
- if (pid == NULL)
- {
- return NULL;
- }
- else
- {
- return pid;
- }
- }
- int main()
- {
- SetConsoleTitle("CS:GO DLL Injector v1.0");
- while (true)
- {
- cout << "Counter-Strike: Global Offensive DLL Injector. "; cout << "Author: Michal L."; cout << " 1337" << endl;
- cout << "============================================================================================================" << endl;
- string path;
- LPCSTR dllpath;
- cout << "DLL path: (with double left slashes)!" << endl;
- cout << "If you have problems with invalid path and you are sure your path is valid!" << endl;
- cout << "& You have any specyfic character in your username." << endl;
- cout << "Just give this dll into disk: (example) C:\\x.dll or create folder on C or another disc for less mess:" << endl;
- cout << "(example!) C:\\anyfolder\\cheat.dll" << endl;
- cout << "Your path to dll file: " << endl;
- std::getline(std::cin, path);
- dllpath = path.c_str();
- cout << dllpath << endl;
- fstream check;
- check.open(dllpath, ios::in);
- if (check.good())
- {
- cout << "Waiting for CS: GO..." << endl;
- DWORD pid = get_pid("Counter-Strike: Global Offensive");
- cout << "Ready for injection." << endl;
- HANDLE hprocess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
- LPVOID pdll = VirtualAllocEx(hprocess, 0, strlen(dllpath) + 1, MEM_COMMIT, PAGE_READWRITE);
- WriteProcessMemory(hprocess, pdll, (LPVOID)dllpath, strlen(dllpath) + 1, 0);
- HANDLE loadthread = CreateRemoteThread(hprocess, 0, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandleA("Kernel32.dll"), "LoadLibraryA"), pdll, 0, 0);
- WaitForSingleObject(loadthread, INFINITE);
- VirtualFreeEx(hprocess, pdll, strlen(dllpath) + 1, MEM_RELEASE);
- cout << "Succesfully injected!" << endl;
- check.close();
- Sleep(3000);
- exit(0);
- }
- else
- {
- check.close();
- cout << "Invalid path!" << endl;
- Sleep(1500);
- system("cls");
- }
- }
- getchar();
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement