Skip to content

Instantly share code, notes, and snippets.

@cristeigabriel
Last active March 25, 2023 19:58
Show Gist options
  • Save cristeigabriel/8df05a787932b85b8e6358173752133f to your computer and use it in GitHub Desktop.
Save cristeigabriel/8df05a787932b85b8e6358173752133f to your computer and use it in GitHub Desktop.
[C++] CS2 Lua VM structure for leak, address
class IScriptVM {
public:
virtual ~IScriptVM() = 0;
};
class CLuaVM : public IScriptVM {
public:
virtual ~CLuaVM() = 0; // vftable
virtual bool __fastcall Initialize() = 0;
virtual void Ignore1() = 0;
virtual void _() = 0;
virtual void Ignore2() = 0;
virtual const char* VMScriptType() = 0; // @note; "Lua"
virtual uintptr_t __fastcall VMScriptHandle() = 0; // @note; In our context, `m_luaVM`
virtual void nullsub_1() = 0;
virtual void Ignore3() = 0;
virtual void __fastcall InitializeIO() = 0; // @note; Initializes IO, opens stdin, stdout, adds the io library
virtual void Ignore4() = 0; // @note; returns 0
virtual void Ignore5() = 0; // @note; Does something with VM
virtual void Ignore6() = 0; // @note; Calls some Vfunc
virtual void Ignore7() = 0;
virtual void Ignore8() = 0;
virtual int64_t __fastcall DebugScript(const char *script, const char* symbol) = 0;
virtual void Ignore9() = 0;
virtual void Ignore10() = 0;
virtual void Ignore11() = 0;
virtual void Ignore12() = 0;
virtual void Ignore13() = 0;
virtual void Ignore14() = 0;
virtual void Ignore15() = 0;
virtual void Ignore16() = 0;
virtual void Ignore17() = 0;
virtual void Ignore18() = 0;
virtual void Ignore19() = 0;
virtual void Ignore20() = 0;
virtual void Ignore21() = 0;
virtual void Ignore22() = 0;
virtual void Ignore23() = 0;
virtual void Ignore24() = 0;
virtual void Ignore25() = 0;
virtual void Ignore26() = 0;
virtual void Ignore27() = 0;
virtual void Ignore28() = 0;
virtual void Ignore29() = 0;
virtual void Ignore30() = 0;
virtual void Ignore31() = 0;
virtual void Ignore32() = 0;
virtual void Ignore33() = 0;
virtual uintptr_t __fastcall CreateKeyValues(...) = 0;
virtual void Ignore34() = 0;
virtual void Ignore35() = 0;
virtual void Ignore36() = 0;
virtual void Ignore37() = 0;
virtual void Ignore38() = 0;
virtual void Ignore39() = 0;
virtual void Ignore40() = 0;
virtual void Ignore41() = 0;
virtual void Ignore42() = 0;
virtual void Ignore43() = 0;
virtual void Ignore44() = 0;
virtual void Ignore45() = 0;
virtual void Ignore46() = 0;
virtual void Ignore47() = 0;
virtual void Ignore48() = 0;
virtual void Ignore49() = 0;
virtual DECLSPEC_NORETURN void __fastcall WriteStr(const char* str) = 0; // @note; no formatting, `str` is passed to formatter.
// Calls `_debugbreak` if called when debugging.
// I think it's buffered.
virtual void Ignore50() = 0;
virtual void Ignore51() = 0;
virtual int64_t __fastcall LoadAndCompileScriptFile(const char *str_file_system, const char *path_id_probably, int64_t* ret) = 0;
virtual void Ignore52() = 0;
virtual void Ignore53() = 0;
uintptr_t m_luaVM; // @note; probably literal list of objects.
// Initialized in `Initialize`
};
static_assert(_offsetof(CLuaVM, m_luaVM) == (0 + sizeof(uintptr_t)) /* right after vftable */);
enum {
text = 0x1000,
script_engine = 0x1521B20 + text,
};
@swoopae
Copy link

swoopae commented Mar 25, 2023

how to inject

@cristeigabriel
Copy link
Author

)))) blyat

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