perfect FakeName

This commit is contained in:
nullifiedcat 2017-05-03 21:10:19 +03:00
parent 563062140b
commit c48f616991
6 changed files with 24 additions and 56 deletions

View File

@ -167,10 +167,16 @@ void hack::Initialize() {
hooks::hkInput->Init((void*)g_IInput, 0);
hooks::hkInput->HookMethod((void*)GetUserCmd_hook, hooks::offGetUserCmd);
hooks::hkInput->Apply();
logging::Info("Before hacking: %s", g_ISteamFriends->GetPersonaName());
hooks::hkIVModelRender = new hooks::VMTHook();
hooks::hkIVModelRender->Init(g_IVModelRender, 0);
hooks::hkIVModelRender->HookMethod((void*)DrawModelExecute_hook, hooks::offDrawModelExecute);
hooks::hkIVModelRender->Apply();
hooks::hkSteamFriends = new hooks::VMTHook();
hooks::hkSteamFriends->Init(g_ISteamFriends, 0);
hooks::hkSteamFriends->HookMethod((void*)GetFriendPersonaName_hook, hooks::offGetFriendPersonaName);
hooks::hkSteamFriends->Apply();
logging::Info("After hacking: %s", g_ISteamFriends->GetPersonaName());
// Sadly, it doesn't work as expected :(
/*hooks::hkBaseClientState = new hooks::VMTHook();
hooks::hkBaseClientState->Init((void*)g_IBaseClientState, 0);

View File

@ -74,6 +74,7 @@ void hooks::VMTHook::Apply() {
//hooks::VMTHook* hooks::hkCTFPlayer = nullptr;
hooks::VMTHook* hooks::hkInput = nullptr;
hooks::VMTHook* hooks::hkSteamFriends = nullptr;
hooks::VMTHook* hooks::hkBaseClientState = nullptr;
hooks::VMTHook* hooks::hkBaseClientState8 = nullptr;
hooks::VMTHook* hooks::hkClientMode = 0;

View File

@ -43,6 +43,7 @@ extern VMTHook* hkInput;
extern VMTHook* hkIVModelRender;
extern VMTHook* hkBaseClientState;
extern VMTHook* hkBaseClientState8;
extern VMTHook* hkSteamFriends;
constexpr unsigned int offGetUserCmd = 8;
constexpr unsigned int offShouldDraw = 136;
@ -50,6 +51,7 @@ constexpr unsigned int offDrawModelExecute = 19;
constexpr unsigned int offGetClientName = 44;
constexpr unsigned int offProcessSetConVar = 4;
constexpr unsigned int offProcessGetCvarValue = 29;
constexpr unsigned int offGetFriendPersonaName = 7;
extern unsigned int offHandleInputEvent;
extern unsigned int offPaintTraverse;
extern unsigned int offCreateMove;

View File

@ -35,6 +35,10 @@ bool ProcessGetCvarValue_hook(CBaseClientState* _this, SVC_GetCvarValue* msg);
//void CInput__CreateMove_hook(void*, int sequence_number, float input_sample_frametime, bool active);
bool CanInspect_hook(IClientEntity*);
const unsigned int offCanInspect = 512;
typedef const char*(GetFriendPersonaName_t)(ISteamFriends*, CSteamID);
const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID);
void BeginFrame_hook(IStudioRender*);
CUserCmd* GetUserCmd_hook(IInput*, int);
void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix);

View File

@ -166,6 +166,13 @@ static CatVar glow_enabled(CV_SWITCH, "glow_old_enabled", "0", "Enable", "Make s
static CatVar glow_alpha(CV_FLOAT, "glow_old_alpha", "1", "Alpha", "Glow Transparency", 0.0f, 1.0f);
static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles");
const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) {
if ((force_name.convar->m_StringLength > 2) && steamID == g_ISteamUser->GetSteamID()) {
return force_name.GetString();
}
return ((GetFriendPersonaName_t*)(hooks::hkSteamFriends->GetMethod(hooks::offGetFriendPersonaName)))(_this, steamID);
}
void FrameStageNotify_hook(void* thisptr, int stage) {
SEGV_BEGIN;
if (!g_IEngine->IsInGame()) g_Settings.bInvalid = true;
@ -183,29 +190,6 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
}
}
}
if (stage == FRAME_NET_UPDATE_START) {
static int next_name_change = 0;
if (next_name_change <= 0 || need_name_change) {
need_name_change = true;
next_name_change = 0;
} else next_name_change--;
if (force_name.convar->m_StringLength > 2 && need_name_change) {
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
need_name_change = false;
}
next_name_change = 60 * 100;
}
static ConVar* name_cv = g_ICvar->FindVar("name");
//name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
if (glow_enabled) {
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {
@ -328,22 +312,6 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
//if (TF) LEVEL_INIT(SpyAlert);
chat_stack::Reset();
hacks::shared::spam::Reset();
need_name_change = true;
if (force_name.convar->m_StringLength > 2) {
//static ConVar* name_cv = g_ICvar->FindVar("name");
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
}
bool CanInspect_hook(IClientEntity*) { return true; }
@ -356,21 +324,5 @@ void LevelShutdown_hook(void* thisptr) {
hacks::shared::aimbot::Reset();
chat_stack::Reset();
hacks::shared::spam::Reset();
need_name_change = true;
if (force_name.convar->m_StringLength > 2) {
//static ConVar* name_cv = g_ICvar->FindVar("name");
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
logging::Info("Sending new name");
NET_SetConVar setname("name", force_name.GetString());
setname.SetNetChannel(ch);
setname.SetReliable(false);
ch->SendNetMsg(setname, false);
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
}

View File

@ -87,7 +87,10 @@ void CreateInterfaces() {
HSteamPipe sp = g_ISteamClient->CreateSteamPipe();
HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp);
g_IVModelRender = BruteforceInterface<IVModelRender>("VEngineModel", sharedobj::engine, 16);
g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
uintptr_t sig_steamapi = gSignatures.GetEngineSignature("55 0F 57 C0 89 E5 83 EC 18 F3 0F 11 05 ? ? ? ? F3 0F 11 05 ? ? ? ? F3 0F 10 05 ? ? ? ? C7 04 24 ? ? ? ? F3 0F 11 05 ? ? ? ? F3 0F 11 05 ? ? ? ? E8 ? ? ? ? C7 44 24 08 ? ? ? ? C7 44 24 04 ? ? ? ? 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[1]);//g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002");
g_GlobalVars = **(reinterpret_cast<CGlobalVarsBase***>((uintptr_t)11 + gSignatures.GetClientSignature("55 89 E5 83 EC ? 8B 45 08 8B 15 ? ? ? ? F3 0F 10")));
g_IPrediction = BruteforceInterface<IPrediction>("VClientPrediction", sharedobj::client);
g_IGameMovement = BruteforceInterface<IGameMovement>("GameMovement", sharedobj::client);