Attach ingame maybe?
This commit is contained in:
parent
4008103b7c
commit
540ca96b9a
@ -12,6 +12,7 @@ public:
|
||||
void *GetModuleHandleSafe(const char *pszModuleName);
|
||||
uintptr_t GetClientSignature(const char *chPattern);
|
||||
uintptr_t GetEngineSignature(const char *chPattern);
|
||||
uintptr_t GetSteamAPISignature(const char *chPattern);
|
||||
uintptr_t GetVstdSignature(const char *chPattern);
|
||||
};
|
||||
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
SharedObject &steamclient();
|
||||
SharedObject &client();
|
||||
SharedObject &engine();
|
||||
SharedObject &steamapi();
|
||||
SharedObject &vstdlib();
|
||||
SharedObject &tier0();
|
||||
SharedObject &inputsystem();
|
||||
|
@ -216,6 +216,32 @@ uintptr_t CSignature::GetEngineSignature(const char *chPattern)
|
||||
return patr - (uintptr_t)(module) + moduleMap->l_addr;
|
||||
}
|
||||
//===================================================================================
|
||||
uintptr_t CSignature::GetSteamAPISignature(const char *chPattern)
|
||||
{
|
||||
// we need to do this becuase (i assume that) under the hood, dlopen only
|
||||
// loads up the sections that it needs into memory, meaning that we cannot
|
||||
// get the string table from the module.
|
||||
static int fd = open(sharedobj::steamapi().path.c_str(), O_RDONLY);
|
||||
static void *module = mmap(NULL, lseek(fd, 0, SEEK_END), PROT_READ, MAP_SHARED, fd, 0);
|
||||
static link_map *moduleMap = sharedobj::steamapi().lmap;
|
||||
|
||||
// static void *module = (void *)moduleMap->l_addr;
|
||||
|
||||
static Elf32_Shdr *textHeader = getSectionHeader(module, ".text");
|
||||
|
||||
static int textOffset = textHeader->sh_offset;
|
||||
|
||||
static int textSize = textHeader->sh_size;
|
||||
|
||||
// we need to remap the address that we got from the pattern search from our
|
||||
// mapped file to the actual memory we do this by rebasing the address
|
||||
// (subbing the mmapped one and adding the dlopened one.
|
||||
uintptr_t patr = dwFindPattern(((uintptr_t) module) + textOffset, ((uintptr_t) module) + textOffset + textSize, chPattern);
|
||||
if (!patr)
|
||||
return NULL;
|
||||
return patr - (uintptr_t)(module) + moduleMap->l_addr;
|
||||
}
|
||||
//===================================================================================
|
||||
uintptr_t CSignature::GetVstdSignature(const char *chPattern)
|
||||
{
|
||||
// we need to do this becuase (i assume that) under the hood, dlopen only
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "core/sharedobj.hpp"
|
||||
#include <thread>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
@ -76,6 +77,8 @@ template <typename T> T *BruteforceInterface(std::string name, sharedobj::Shared
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern "C" typedef HSteamUser (*GetHSteamUser_t)();
|
||||
|
||||
void CreateInterfaces()
|
||||
{
|
||||
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib());
|
||||
@ -88,8 +91,24 @@ void CreateInterfaces()
|
||||
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
|
||||
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
|
||||
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
|
||||
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
|
||||
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
|
||||
uintptr_t steampipe_sig = gSignatures.GetSteamAPISignature("8D 83 ? ? ? ? 89 34 24 89 44 24 ? E8 ? ? ? ? 89 C6") + 0xE7;
|
||||
typedef HSteamPipe (*GetSteamPipe)();
|
||||
GetSteamPipe GetSteamPipe_fn = GetSteamPipe(steampipe_sig);
|
||||
HSteamPipe sp = GetSteamPipe_fn();
|
||||
if (!sp)
|
||||
{
|
||||
logging::Info("Creating new Steam Pipe...");
|
||||
sp = g_ISteamClient->CreateSteamPipe();
|
||||
}
|
||||
logging::Info("Inited Steam Pipe");
|
||||
GetHSteamUser_t func = (GetHSteamUser_t)(GetHSteamUser_t) dlsym(sharedobj::steamapi().lmap, "SteamAPI_GetHSteamUser");
|
||||
HSteamUser su = func();
|
||||
if (!su)
|
||||
{
|
||||
logging::Info("Connecting to Steam User");
|
||||
g_ISteamClient->ConnectToGlobalUser(sp);
|
||||
}
|
||||
logging::Info("Inited Steam User");
|
||||
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine(), 16);
|
||||
g_ISteamFriends = nullptr;
|
||||
g_IEngineVGui = BruteforceInterface<IEngineVGui>("VEngineVGui", sharedobj::engine());
|
||||
@ -101,16 +120,25 @@ void CreateInterfaces()
|
||||
"C7 04 24 ? ? ? ? E8 ? ? ? ? C9 C3");
|
||||
logging::Info("SteamAPI: 0x%08x", sig_steamapi);
|
||||
void **SteamAPI_engine = *reinterpret_cast<void ***>(sig_steamapi + 36);
|
||||
g_ISteamFriends = (ISteamFriends *) (SteamAPI_engine[2]); //
|
||||
logging::Info("A");
|
||||
g_ISteamFriends = (ISteamFriends *) (SteamAPI_engine[2]);
|
||||
logging::Info("A");
|
||||
}
|
||||
if (g_ISteamFriends == nullptr)
|
||||
{
|
||||
logging::Info("A");
|
||||
// FIXME SIGNATURE
|
||||
g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
|
||||
logging::Info("A");
|
||||
}
|
||||
g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase ***>((uintptr_t) 11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
|
||||
logging::Info("B");
|
||||
//g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase ***>((uintptr_t) 11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
|
||||
g_GlobalVars = **reinterpret_cast<CGlobalVarsBase ***>(gSignatures.GetClientSignature("8B 15 ? ? ? ? F3 0F 10 88 D0 08 00 00") + 2);
|
||||
logging::Info("A");
|
||||
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client());
|
||||
logging::Info("A");
|
||||
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client());
|
||||
logging::Info("A");
|
||||
IF_GAME(IsTF2())
|
||||
{
|
||||
// g_IMoveHelper =
|
||||
|
@ -91,6 +91,7 @@ void LoadAllSharedObjects()
|
||||
steamclient().Load();
|
||||
client().Load();
|
||||
engine().Load();
|
||||
steamapi().Load();
|
||||
vstdlib().Load();
|
||||
tier0().Load();
|
||||
inputsystem().Load();
|
||||
@ -113,6 +114,11 @@ SharedObject &steamclient()
|
||||
static SharedObject obj("steamclient.so", true);
|
||||
return obj;
|
||||
}
|
||||
SharedObject &steamapi()
|
||||
{
|
||||
static SharedObject obj("libsteam_api.so", false);
|
||||
return obj;
|
||||
}
|
||||
SharedObject &client()
|
||||
{
|
||||
static SharedObject obj("client.so", true);
|
||||
@ -164,5 +170,6 @@ SharedObject &libsdl()
|
||||
static SharedObject obj("libSDL2-2.0.so.0", false);
|
||||
return obj;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace sharedobj
|
||||
|
@ -146,7 +146,7 @@ void critical_error_handler(int signum)
|
||||
void hack::Initialize()
|
||||
{
|
||||
::signal(SIGSEGV, &critical_error_handler);
|
||||
//::signal(SIGABRT, &my_signal_handler);
|
||||
::signal(SIGABRT, &critical_error_handler);
|
||||
time_injected = time(nullptr);
|
||||
/*passwd *pwd = getpwuid(getuid());
|
||||
char *logname = strfmt("/tmp/cathook-game-stdout-%s-%u.log", pwd->pw_name,
|
||||
|
@ -221,9 +221,12 @@ void CreateMove()
|
||||
SendAutoBalanceRequest();
|
||||
|
||||
// Simple No-Push through cvars
|
||||
if (teammatesPushaway)
|
||||
{
|
||||
if (*nopush_enabled == teammatesPushaway->GetBool())
|
||||
teammatesPushaway->SetValue(!nopush_enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_VISUALS
|
||||
|
@ -19,6 +19,11 @@ namespace hooked_methods
|
||||
|
||||
DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
|
||||
{
|
||||
if (!isHackActive())
|
||||
{
|
||||
return original::Paint(this_, mode);;
|
||||
}
|
||||
|
||||
if (!g_IEngine->IsInGame())
|
||||
g_Settings.bInvalid = true;
|
||||
|
||||
|
Reference in New Issue
Block a user