Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save urmommine/273f75ba831adac1e5a054eafda9966d to your computer and use it in GitHub Desktop.

Select an option

Save urmommine/273f75ba831adac1e5a054eafda9966d to your computer and use it in GitHub Desktop.
//Just paste in your main.cpp
//compile
#define WIN_LEAN_AND_MEAN
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
DWORD get_proc_id(const char* proc_name)
{
DWORD proc_id = 0;
auto* const h_snap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (h_snap != INVALID_HANDLE_VALUE)
{
PROCESSENTRY32 proc_entry;
proc_entry.dwSize = sizeof(proc_entry);
if (Process32First(h_snap, &proc_entry))
{
do
{
if (!_stricmp(proc_entry.szExeFile, proc_name))
{
proc_id = proc_entry.th32ProcessID;
break;
}
} while (Process32Next(h_snap, &proc_entry));
}
}
CloseHandle(h_snap);
return proc_id;
}
int main()
{
const char* dll_path = R"(C:\Cheat\your cheat.dll)"; //insert ur dll path
const char* proc_name = "csgo.exe";
DWORD proc_id = 0;
while (!proc_id)
{
proc_id = get_proc_id(proc_name);
Sleep(30);
}
auto* const h_proc = OpenProcess(PROCESS_ALL_ACCESS, 0, proc_id);
if (h_proc && h_proc != INVALID_HANDLE_VALUE)
{
const LPVOID nt_open_file = GetProcAddress(LoadLibraryW(L"ntdll"), "NtOpenFile");
if (nt_open_file)
{
char original_bytes[5];
memcpy(original_bytes, nt_open_file, 5);
WriteProcessMemory(h_proc, nt_open_file, original_bytes, 5, nullptr);
}
auto* loc = VirtualAllocEx(h_proc, nullptr, MAX_PATH, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
WriteProcessMemory(h_proc, loc, dll_path, strlen(dll_path) + 1, nullptr);
auto* const h_thread = CreateRemoteThread(h_proc, nullptr, 0, reinterpret_cast<LPTHREAD_START_ROUTINE>(LoadLibraryA), loc, 0, nullptr);
if (h_thread) CloseHandle(h_thread);
}
if (h_proc) CloseHandle(h_proc);
return 0;
}
Copy link
Copy Markdown

ghost commented Jun 29, 2020

nice job
how could I put this in https://github.com/danielkrupinski/curiuminjector-csgo ?

I use a modified version and it would be easier for me to add the code there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment