From aaff2a3d8c99194d71125b4458d365b346facd1f Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 16:23:15 +0300 Subject: [PATCH 1/7] Crit hack is now a CV_KEY, not a CV_SWITCH. --- src/crits.cpp | 10 +++++++--- src/crits.h | 1 + src/hacks/Misc.cpp | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/crits.cpp b/src/crits.cpp index ce0cc8a6..bceedcba 100644 --- a/src/crits.cpp +++ b/src/crits.cpp @@ -15,15 +15,19 @@ std::unordered_map command_number_mod {}; int* g_PredictionRandomSeed = nullptr; +bool CritKeyDown() { + return g_IInputSystem->IsButtonDown(static_cast((int)hacks::shared::misc::crit_hack)); +} + bool AllowAttacking() { - if (!(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true; + if (!(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && !hacks::shared::misc::crit_suppress) return true; bool crit = IsAttackACrit(g_pUserCmd); LoadSavedState(); - if (hacks::shared::misc::crit_suppress && !(hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) { + if (hacks::shared::misc::crit_suppress && !(CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee))) { if (crit && !IsPlayerCritBoosted(LOCAL_E)) { return false; } - } else if ((hacks::shared::misc::crit_hack || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) { + } else if ((CritKeyDown() || ((GetWeaponMode(LOCAL_E) == weapon_melee) && hacks::shared::misc::crit_melee)) && RandomCrits() && WeaponCanCrit() && (g_pLocalPlayer->weapon()->m_iClassID != g_pClassID->CTFKnife)) { if (!crit) return false; } return true; diff --git a/src/crits.h b/src/crits.h index 84a9986f..e783478c 100644 --- a/src/crits.h +++ b/src/crits.h @@ -24,6 +24,7 @@ struct crithack_saved_state { void Load(IClientEntity* entity); }; +bool CritKeyDown(); bool AllowAttacking(); bool RandomCrits(); bool WeaponCanCrit(); diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index 0caaa235..d2b25c0f 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -219,7 +219,7 @@ void CreateMove() { void Draw() { if (crit_info && CE_GOOD(LOCAL_W)) { - if (crit_hack) { + if (CritKeyDown()) { AddCenterString("FORCED CRITS!", colors::red); } if (TF2) { @@ -319,7 +319,7 @@ void Schema_Reload() { CatVar debug_info(CV_SWITCH, "debug_info", "0", "Debug info", "Shows some debug info in-game"); CatVar flashlight_spam(CV_SWITCH, "flashlight", "0", "Flashlight spam", "HL2DM flashlight spam"); CatVar crit_info(CV_SWITCH, "crit_info", "0", "Show crit info"); // TODO separate -CatVar crit_hack(CV_SWITCH, "crit_hack", "0", "Crithack"); +CatVar crit_hack(CV_KEY, "crit_hack", "0", "Crit Key"); CatVar crit_melee(CV_SWITCH, "crit_melee", "0", "Melee crits"); CatVar crit_suppress(CV_SWITCH, "crit_suppress", "0", "Disable random crits", "Can help saving crit bucket for forced crits"); CatVar anti_afk(CV_SWITCH, "anti_afk", "0", "Anti-AFK", "Sends random commands to prevent being kicked from server"); From d77556d5c95a35e8478dba9507313533e3814586 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 18:15:13 +0300 Subject: [PATCH 2/7] add cat_spoof + cat_pure_bypass --- src/cvarspoof.h | 18 ------------------ src/gui/ncc/Menu.cpp | 1 + src/hooks/PaintTraverse.cpp | 16 +++++++++++++++- src/sconvars.cpp | 38 +++++++++++++++++++++++++++++++++++++ src/sconvars.hpp | 30 +++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 19 deletions(-) delete mode 100644 src/cvarspoof.h create mode 100644 src/sconvars.cpp create mode 100644 src/sconvars.hpp diff --git a/src/cvarspoof.h b/src/cvarspoof.h deleted file mode 100644 index f46eff91..00000000 --- a/src/cvarspoof.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * cvarspoof.h - * - * Created on: Dec 3, 2016 - * Author: nullifiedcat - */ - -#ifndef CVARSPOOF_H_ -#define CVARSPOOF_H_ - -// TODO - -class SpoofedConVar { -public: - SpoofedConVar(const char* name); -}; - -#endif /* CVARSPOOF_H_ */ diff --git a/src/gui/ncc/Menu.cpp b/src/gui/ncc/Menu.cpp index e4d9ce28..eb879bed 100644 --- a/src/gui/ncc/Menu.cpp +++ b/src/gui/ncc/Menu.cpp @@ -458,6 +458,7 @@ static const std::string list_tf2 = R"( ] "Miscellaneous" [ "Miscellaneous" + "pure_bypass" "antidisguise" "no_arms" "no_hats" diff --git a/src/hooks/PaintTraverse.cpp b/src/hooks/PaintTraverse.cpp index c6241978..0c7f4e89 100644 --- a/src/hooks/PaintTraverse.cpp +++ b/src/hooks/PaintTraverse.cpp @@ -11,12 +11,16 @@ #include "hookedmethods.h" #include "../gui/GUI.h" #include "../segvcatch/segvcatch.h" +#include "../copypasted/CSignature.h" #include "../profiler.h" CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1", "Clean screenshots", "Don't draw visuals while taking a screenshot"); CatVar disable_visuals(CV_SWITCH, "no_visuals", "0", "Disable ALL drawing", "Completely hides cathook"); CatVar no_zoom(CV_SWITCH, "no_zoom", "0", "Disable scope", "Disables black scope overlay"); CatVar info_text(CV_SWITCH, "info", "1", "Show info", "Show cathook version in top left corner"); +CatVar pure_bypass(CV_SWITCH, "pure_bypass", "0", "Pure Bypass", "Bypass sv_pure"); +void* pure_orig = nullptr; +void** pure_addr = nullptr; void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { #if DEBUG_SEGV == true @@ -31,7 +35,17 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) { textures_loaded = true; hacks::tf::radar::Init(); } - + if (pure_bypass) { + if (!pure_addr) { + pure_addr = *reinterpret_cast(gSignatures.GetEngineSignature("55 89 E5 83 EC 18 A1 ? ? ? ? 89 04 24 E8 0D FF FF FF A1 ? ? ? ? 85 C0 74 08 89 04 24 E8 ? ? ? ? C9 C3") + 7); + } + if (*pure_addr) + pure_orig = *pure_addr; + *pure_addr = (void*)0; + } else if (pure_orig) { + *pure_addr = pure_orig; + pure_orig = (void*)0; + } static unsigned long panel_focus = 0; static unsigned long panel_scope = 0; static unsigned long panel_top = 0; diff --git a/src/sconvars.cpp b/src/sconvars.cpp new file mode 100644 index 00000000..903c64b7 --- /dev/null +++ b/src/sconvars.cpp @@ -0,0 +1,38 @@ +/* + * sconvars.cpp + * + * Created on: May 1, 2017 + * Author: nullifiedcat + */ + +#include "sconvars.hpp" + +namespace sconvar { + +std::vector convars; + +SpoofedConVar::SpoofedConVar(ConVar* var) : original(var) { + int flags = var->m_nFlags; + const char* name = var->m_pszName; + char* s_name = strfmt("q_%s", name); + var->m_pszName = s_name; + var->m_nFlags = 0; + ConVar* svar = new ConVar(name, var->m_pszDefaultValue, flags, var->m_pszHelpString, var->m_bHasMin, var->m_fMinVal, var->m_bHasMax, var->m_fMaxVal, var->m_fnChangeCallback); + g_ICvar->RegisterConCommand(svar); + spoof = svar; +} + +CatCommand spoof_convar("spoof", "Spoof ConVar", [](const CCommand& args) { + if (args.ArgC() < 2) { + logging::Info("Invalid call"); + return; + } + ConVar* var = g_ICvar->FindVar(args.Arg(1)); + if (!var) { + logging::Info("Not found"); + return; + } + convars.push_back(new SpoofedConVar(var)); +}); + +} diff --git a/src/sconvars.hpp b/src/sconvars.hpp new file mode 100644 index 00000000..e4338185 --- /dev/null +++ b/src/sconvars.hpp @@ -0,0 +1,30 @@ +/* + * sconvars.hpp + * + * Created on: May 1, 2017 + * Author: nullifiedcat + */ + +#ifndef SCONVARS_HPP_ +#define SCONVARS_HPP_ + +#include "common.h" + +/* + * HECK off F1ssi0N + * I won't make NETWORK HOOKS to deal with this SHIT + */ + +namespace sconvar { + +class SpoofedConVar { +public: + SpoofedConVar(ConVar* var); +public: + ConVar* original; + ConVar* spoof; +}; + +} + +#endif /* SCONVARS_HPP_ */ From ec48906f19e17320defbf09d9fe6ecd5873183d3 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 20:17:21 +0300 Subject: [PATCH 3/7] engine prediction dummy functions --- src/entitycache.cpp | 2 +- src/helpers.cpp | 2 +- src/hooks/CreateMove.cpp | 25 ++++++++ src/interfaces.cpp | 4 ++ src/interfaces.h | 2 + src/sdk.h | 2 + src/sdk/igamemovement.h | 131 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 src/sdk/igamemovement.h diff --git a/src/entitycache.cpp b/src/entitycache.cpp index 37e0e967..4c18afa1 100644 --- a/src/entitycache.cpp +++ b/src/entitycache.cpp @@ -195,7 +195,7 @@ bool CachedEntity::IsVisible() { matrix3x4_t* CachedEntity::GetBones() { if (!m_bBonesSetup) { - m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, 0); // gvars->curtime + m_bBonesSetup = RAW_ENT(this)->SetupBones(m_Bones, MAXSTUDIOBONES, 0x100, g_GlobalVars->curtime); // gvars->curtime } return m_Bones; } diff --git a/src/helpers.cpp b/src/helpers.cpp index 47701613..4b05cbed 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -41,7 +41,7 @@ void EndConVars() { RegisterCatVars(); RegisterCatCommands(); if (hConVarsFile) { - fprintf(hConVarsFile, "\nexec cat_autoexec\n"); + //fprintf(hConVarsFile, "\nexec cat_autoexec\n"); fprintf(hConVarsFile, "cat_killsay_reload\ncat_spam_reload\n"); fclose(hConVarsFile); } diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 4394a5f6..8dea7664 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -37,6 +37,31 @@ static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump", CatVar jointeam(CV_SWITCH, "fb_autoteam", "1", "Joins player team automatically (NYI)"); CatVar joinclass(CV_STRING, "fb_autoclass", "spy", "Class that will be picked after joining a team (NYI)"); +namespace engine_prediction { + +float o_curtime; +float o_frametime; + +void Start() { + o_curtime = g_GlobalVars->curtime; + o_frametime = g_GlobalVars->frametime; + *g_PredictionRandomSeed = MD5_PseudoRandom(g_pUserCmd->command_number) & 0x7FFFFFFF; + g_GlobalVars->curtime = CE_INT(LOCAL_E, netvar.nTickBase) * g_GlobalVars->interval_per_tick; + g_GlobalVars->frametime = g_GlobalVars->interval_per_tick; + g_IGameMovement->StartTrackPredictionErrors((CBasePlayer*)(RAW_ENT(LOCAL_E))); + + CMoveData data; + +} + +void End() { + *g_PredictionRandomSeed = -1; + g_GlobalVars->curtime = o_curtime; + g_GlobalVars->frametime = o_frametime; +} + +} + bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { SEGV_BEGIN; diff --git a/src/interfaces.cpp b/src/interfaces.cpp index f2fec726..88133c18 100644 --- a/src/interfaces.cpp +++ b/src/interfaces.cpp @@ -46,6 +46,7 @@ IVDebugOverlay* g_IVDebugOverlay = nullptr; IMaterialSystemFixed* g_IMaterialSystem = nullptr; IVRenderView* g_IVRenderView = nullptr; IMaterialSystem* g_IMaterialSystemHL = nullptr; +IMoveHelperServer* g_IMoveHelperServer = nullptr; template T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start) { @@ -103,6 +104,9 @@ void CreateInterfaces() { g_pScreenSpaceEffects = **(IScreenSpaceEffectManager***)(gSignatures.GetClientSignature("FF 52 14 E9 E0 FE FF FF 8D 76 00 A1 ? ? ? ? 8B 5D F4 8B 75 F8 8B 7D FC 8B 10 C7 45 0C ? ? ? ? 89 45 08 8B 42 1C 89 EC 5D FF E0") + 12); g_ppScreenSpaceRegistrationHead = *(CScreenSpaceEffectRegistration***)(gSignatures.GetClientSignature("E8 ? ? ? ? 8B 10 C7 44 24 04 ? ? ? ? 89 04 24 FF 52 28 85 C0 75 4B 8B 35 ? ? ? ? 85 F6 74 31 90 8B 5E 04 85 DB 74 22 8B 03 89 1C 24") + 27); } + if (TF2) { + //g_IMoveHelper = *(reinterpret_cast(gSignatures.GetClientSignature("? ? ? ? 8B 10 89 04 24 FF 52 28 0F B7 CF 8B 10 89 4C 24 04 89 04 24 FF 52 1C 8B 13 89 1C 24 89 44 24 04 FF 92 74 05 00 00 8D 95 C8 FE FF FF C7 44 24 08 00 00 00 00"))); + } if (TF2) g_IInput = **(reinterpret_cast((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10"))); else if (TF2C) g_IInput = **(reinterpret_cast((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10"))); else if (HL2DM) g_IInput = **(reinterpret_cast((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10"))); diff --git a/src/interfaces.h b/src/interfaces.h index e585c8a3..d47544c9 100644 --- a/src/interfaces.h +++ b/src/interfaces.h @@ -47,6 +47,7 @@ class IVModelRender; class IVRenderView; class IMaterialSystemFixed; class IMaterialSystem; +class IMoveHelperServer; extern ISteamClient* g_ISteamClient; extern ISteamFriends* g_ISteamFriends; @@ -73,6 +74,7 @@ extern IMaterialSystemFixed* g_IMaterialSystem; extern IMaterialSystem* g_IMaterialSystemHL; extern IVModelRender* g_IVModelRender; extern IVRenderView* g_IVRenderView; +extern IMoveHelperServer* g_IMoveHelperServer; template T* BruteforceInterface(std::string name, sharedobj::SharedObject* object, int start = 0); diff --git a/src/sdk.h b/src/sdk.h index da879884..34ff558e 100644 --- a/src/sdk.h +++ b/src/sdk.h @@ -51,10 +51,12 @@ #include #include #include +#include #include "sdk/in_buttons.h" #include "sdk/imaterialsystemfixed.h" #include "sdk/ScreenSpaceEffects.h" #include "sdk/iinput.h" +#include "sdk/igamemovement.h" #endif /* SDK_H_ */ diff --git a/src/sdk/igamemovement.h b/src/sdk/igamemovement.h new file mode 100644 index 00000000..4d3d4682 --- /dev/null +++ b/src/sdk/igamemovement.h @@ -0,0 +1,131 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// $NoKeywords: $ +//=============================================================================// + +#if !defined( IGAMEMOVEMENT_H ) +#define IGAMEMOVEMENT_H + +#ifdef _WIN32 +#pragma once +#endif + +class CBasePlayer; + +#include "mathlib/vector.h" +#include "interface.h" +//#include "imovehelper.h" +#include "const.h" + +//----------------------------------------------------------------------------- +// Name of the class implementing the game movement. +//----------------------------------------------------------------------------- + +#define INTERFACENAME_GAMEMOVEMENT "GameMovement001" + +//----------------------------------------------------------------------------- +// Forward declarations. +//----------------------------------------------------------------------------- + +class IMoveHelper; + +//----------------------------------------------------------------------------- +// Purpose: Encapsulated input parameters to player movement. +//----------------------------------------------------------------------------- + +class CMoveData +{ +public: + bool m_bFirstRunOfFunctions : 1; + bool m_bGameCodeMovedPlayer : 1; + + CBaseHandle m_nPlayerHandle; // edict index on server, client entity handle on client + + int m_nImpulseCommand; // Impulse command issued. + QAngle m_vecViewAngles; // Command view angles (local space) + QAngle m_vecAbsViewAngles; // Command view angles (world space) + int m_nButtons; // Attack buttons. + int m_nOldButtons; // From host_client->oldbuttons; + float m_flForwardMove; + float m_flSideMove; + float m_flUpMove; + + float m_flMaxSpeed; + float m_flClientMaxSpeed; + + // Variables from the player edict (sv_player) or entvars on the client. + // These are copied in here before calling and copied out after calling. + Vector m_vecVelocity; // edict::velocity // Current movement direction. + QAngle m_vecAngles; // edict::angles + QAngle m_vecOldAngles; + +// Output only + float m_outStepHeight; // how much you climbed this move + Vector m_outWishVel; // This is where you tried + Vector m_outJumpVel; // This is your jump velocity + + // Movement constraints (radius 0 means no constraint) + Vector m_vecConstraintCenter; + float m_flConstraintRadius; + float m_flConstraintWidth; + float m_flConstraintSpeedFactor; + + void SetAbsOrigin( const Vector &vec ); + const Vector &GetAbsOrigin() const; + +private: + Vector m_vecAbsOrigin; // edict::origin +}; + +inline const Vector &CMoveData::GetAbsOrigin() const +{ + return m_vecAbsOrigin; +} + +#if !defined( CLIENT_DLL ) && defined( _DEBUG ) +// We only ever want this code path on the server side in a debug build +// and you have to uncomment the code below and rebuild to have the test operate. +//#define PLAYER_GETTING_STUCK_TESTING + +#endif + +#if !defined( PLAYER_GETTING_STUCK_TESTING ) + +// This is implemented with a more exhaustive test in gamemovement.cpp. We check if the origin being requested is +// inside solid, which it never should be +inline void CMoveData::SetAbsOrigin( const Vector &vec ) +{ + m_vecAbsOrigin = vec; +} + +#endif + + +//----------------------------------------------------------------------------- +// Purpose: The basic player movement interface +//----------------------------------------------------------------------------- + +abstract_class IGameMovement +{ +public: + virtual ~IGameMovement( void ) {} + + // Process the current movement command + virtual void ProcessMovement( CBasePlayer *pPlayer, CMoveData *pMove ) = 0; + virtual void StartTrackPredictionErrors( CBasePlayer *pPlayer ) = 0; + virtual void FinishTrackPredictionErrors( CBasePlayer *pPlayer ) = 0; + virtual void DiffPrint( PRINTF_FORMAT_STRING char const *fmt, ... ) = 0; + + // Allows other parts of the engine to find out the normal and ducked player bbox sizes + virtual Vector GetPlayerMins( bool ducked ) const = 0; + virtual Vector GetPlayerMaxs( bool ducked ) const = 0; + virtual Vector GetPlayerViewOffset( bool ducked ) const = 0; + +}; + + +#endif // IGAMEMOVEMENT_H From ff2e7e3d4f6de4a0fcde4f056eedc3a7686d01e9 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 20:23:42 +0300 Subject: [PATCH 4/7] fixed autoshoot --- src/hacks/Aimbot.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index ff1e5ba6..b074327d 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -471,7 +471,8 @@ bool ShouldAim(CUserCmd* cmd) { if (zoomed_only) { if (g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifle || g_pLocalPlayer->weapon()->m_iClassID == g_pClassID->CTFSniperRifleDecap) { - return false; + // confused_nigga.jpg + return g_pLocalPlayer->bZoomed; } } if (only_can_shoot) { From ae80783ed3e5f9ba8472465e3f29e39a7b078de9 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Mon, 1 May 2017 20:54:08 +0300 Subject: [PATCH 5/7] add default killsay/spam and install script --- .project | 9 +++++++++ install-resources.sh | 14 ++++++++++++++ res/killsays.txt | 3 +++ res/spam.txt | 4 ++++ 4 files changed, 30 insertions(+) create mode 100755 install-resources.sh create mode 100644 res/killsays.txt create mode 100644 res/spam.txt diff --git a/.project b/.project index a32a4bd5..88424d90 100644 --- a/.project +++ b/.project @@ -52,6 +52,15 @@ 1.0-location-matches-false-false-res/bin + + 1493660654417 + res + 29 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-true-false-* + + 1489692029191 src diff --git a/install-resources.sh b/install-resources.sh new file mode 100755 index 00000000..f472d783 --- /dev/null +++ b/install-resources.sh @@ -0,0 +1,14 @@ +if [ ! -d "~/.cathook" ]; then + mkdir ~/.cathook +fi + +if [ ! -f "~/.cathook/killsays.txt" ]; then + cp res/killsays.txt ~/.cathook +fi + +if [ ! -f "~/.cathook/spam.txt" ]; then + cp res/spam.txt ~/.cathook +fi + +echo Default killsay/spam files installed, EDIT THEM! +gnome-open ~/.cathook \ No newline at end of file diff --git a/res/killsays.txt b/res/killsays.txt new file mode 100644 index 00000000..dadfbe8f --- /dev/null +++ b/res/killsays.txt @@ -0,0 +1,3 @@ +REPLACE CONTENTS OF THIS FILE WITH ACUTAL KILLSAYS. +Usable killsay macros: +%team% %class% %killer% %name% %myteam% %myclass% \n diff --git a/res/spam.txt b/res/spam.txt new file mode 100644 index 00000000..fbfb9a12 --- /dev/null +++ b/res/spam.txt @@ -0,0 +1,4 @@ +cathook - free tf2 cheat! +get cathook: discord.gg/7bu3AFw +GNU/Linux is the best OS! +cathook - more fun than a ball of yarn! \ No newline at end of file From d4e1c330e8e9edce3f5bbe34a44f2c1b95d194df Mon Sep 17 00:00:00 2001 From: mpmjcvuut Date: Mon, 1 May 2017 20:07:10 +0100 Subject: [PATCH 6/7] Nitpicking Signed-off-by: mpmjcvuut --- README.md | 2 +- TODO | 2 +- attach | 24 ++++++++++++------------ attach-backtrace | 26 +++++++++++++------------- detach | 26 +++++++++++++------------- install-resources.sh | 18 ++++++++++-------- makefile | 6 +++--- reattach | 5 ++--- res/.gitignore | 0 res/convert.sh | 10 +++++----- update | 4 +++- 11 files changed, 63 insertions(+), 60 deletions(-) delete mode 100644 res/.gitignore diff --git a/README.md b/README.md index 4d622a26..7f0c43c7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Ubuntu (and probably Debian) users can run this script: sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install libc6-dev gcc-6 g++-6 g++-6-multilib gdb -y && git clone --recursive https://github.com/nullifiedcat/cathook && cd cathook && make -j4 ``` -**Errors while installing?** +**Errors while installing?** `/usr/include/c++/5/string:38:28: fatal error: bits/c++config.h: No such file or directory` - You don't have g++6 or g++6 multilib installed correctly diff --git a/TODO b/TODO index 45290e6f..6e1921f0 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,7 @@ inspect shit TTS noise spam team name spam (pre round team name spam thing) -insta taunt (taunts for like .5 ms and then you can do it again lithium has it) +insta taunt (taunts for like .5 ms and then you can do it again lithium has it) auto vacc namesteal autovote diff --git a/attach b/attach index 5d2d2608..29d457f6 100755 --- a/attach +++ b/attach @@ -1,35 +1,35 @@ -#!/bin/bash +#!/usr/bin/env bash -line=`pidof hl2_linux` +line=$(pidof hl2_linux) arr=($line) inst=$1 -if [ $# == 0 ]; then - inst=0 +if [ $# == 0 ]; then + inst=0 fi if [ ${#arr[@]} == 0 ]; then - echo tf2 isn\'t running! - exit + echo TF2 isn\'t running! + exit fi if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit + echo wrong index! + exit fi proc=${arr[$inst]} -echo Running instances: ${arr[@]} -echo Attaching to $proc +echo Running instances: "${arr[@]}" +echo Attaching to "$proc" #sudo ./detach $inst bin/libcathook.so -if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then +if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then echo already loaded exit fi -echo loading $(realpath bin/libcathook.so) to $proc +echo loading "$(realpath bin/libcathook.so)" to "$proc" gdb -n -q -batch \ -ex "attach $proc" \ -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ diff --git a/attach-backtrace b/attach-backtrace index 84e164db..52616dbf 100755 --- a/attach-backtrace +++ b/attach-backtrace @@ -1,35 +1,35 @@ -#!/bin/bash +#!/usr/bin/env bash -line=`pidof hl2_linux` +line=$(pidof hl2_linux) arr=($line) inst=$1 -if [ $# == 0 ]; then - inst=0 +if [ $# == 0 ]; then + inst=0 fi if [ ${#arr[@]} == 0 ]; then - echo tf2 isn\'t running! - exit + echo tf2 isn\'t running! + exit fi if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit + echo wrong index! + exit fi proc=${arr[$inst]} -echo Running instances: ${arr[@]} -echo Attaching to $proc +echo Running instances: "${arr[@]}" +echo Attaching to "$proc" sudo ./detach $inst bin/libcathook.so -if grep -q $(realpath bin/libcathook.so) /proc/$proc/maps; then +if grep -q "$(realpath bin/libcathook.so)" /proc/"$proc"/maps; then echo already loaded exit fi -echo loading $(realpath bin/libcathook.so) to $proc +echo loading "$(realpath bin/libcathook.so)" to "$proc" gdb -n -q -batch \ -ex "attach $proc" \ -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ @@ -38,4 +38,4 @@ gdb -n -q -batch \ -ex 'print (char *) $2' \ -ex "catch syscall exit exit_group" \ -ex "continue" \ - -ex "backtrace" \ No newline at end of file + -ex "backtrace" diff --git a/detach b/detach index 2545fc8d..c1f22a32 100755 --- a/detach +++ b/detach @@ -1,37 +1,37 @@ -#!/bin/bash +#!/usr/bin/env bash -line=`pidof hl2_linux` +line=$(pidof hl2_linux) arr=($line) inst=$1 -if [ $# == 0 ]; then - inst=0 +if [ $# == 0 ]; then + inst=0 fi if [ ${#arr[@]} == 0 ]; then - echo tf2 isn\'t running! - exit + echo TF2 isn\'t running! + exit fi if [ $inst -gt ${#arr[@]} ] || [ $inst == ${#arr[@]} ]; then - echo wrong index! - exit + echo wrong index! + exit fi -echo Running instances: ${arr[@]} -echo Detaching from ${arr[$1]} +echo Running instances: "${arr[@]}" +echo Detaching from "${arr[$1]}" -if grep -q $(realpath bin/libcathook.so) /proc/${arr[$1]}/maps; then +if grep -q "$(realpath bin/libcathook.so)" /proc/"${arr[$1]}"/maps; then gdb -n -q -batch \ -ex "attach ${arr[$1]}" \ -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ -ex "set \$dlclose = (int(*)(void*)) dlclose" \ -ex "set \$library = \$dlopen(\"$(realpath bin/libcathook.so)\", 6)" \ -ex "print \$library" \ - -ex "sharedlibrary ." \ + -ex "sharedlibrary ." \ -ex "call \$dlclose(\$library)" \ -ex "call \$dlclose(\$library)" \ -ex "detach" echo "Detached" else - echo "not found!" + echo "not found!" fi diff --git a/install-resources.sh b/install-resources.sh index f472d783..7523a5eb 100755 --- a/install-resources.sh +++ b/install-resources.sh @@ -1,14 +1,16 @@ -if [ ! -d "~/.cathook" ]; then - mkdir ~/.cathook +#!/usr/bin/env bash + +if [ ! -d "$HOME/.cathook" ]; then + mkdir "$HOME"/.cathook fi -if [ ! -f "~/.cathook/killsays.txt" ]; then - cp res/killsays.txt ~/.cathook +if [ ! -f "$HOME/.cathook/killsays.txt" ]; then + cp res/killsays.txt "$HOME"/.cathook fi -if [ ! -f "~/.cathook/spam.txt" ]; then - cp res/spam.txt ~/.cathook +if [ ! -f "$HOME/.cathook/spam.txt" ]; then + cp res/spam.txt "$HOME"/.cathook fi -echo Default killsay/spam files installed, EDIT THEM! -gnome-open ~/.cathook \ No newline at end of file +echo "Default killsay/spam files installed, EDIT THEM!" +xdg-open "$HOME"/.cathook diff --git a/makefile b/makefile index 2143f0cd..9d601e73 100644 --- a/makefile +++ b/makefile @@ -29,10 +29,10 @@ CXXFLAGS += -DGIT_COMMIT_HASH="\"$(GIT_COMMIT_HASH)\"" -DGIT_COMMIT_DATE="\"$(GI all: mkdir -p $(TARGET_DIR) $(MAKE) $(TARGET) - + .cpp.o: $(CXX) $(CXXFLAGS) -c $< -o $@ - + %.d: %.cpp $(CXX) -M $(CXXFLAGS) $< > $@ @@ -43,7 +43,7 @@ clean: find src -type f -name '*.o' -delete find src -type f -name '*.d' -delete rm -rf ./bin - + ifneq ($(MAKECMDGOALS), clean) -include $(DEPENDS) endif diff --git a/reattach b/reattach index de1852f0..d385fb8d 100755 --- a/reattach +++ b/reattach @@ -1,4 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash -sudo ./detach $1 -sudo ./attach $1 \ No newline at end of file +sudo ./detach "$1" && sudo ./attach "$1" diff --git a/res/.gitignore b/res/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/res/convert.sh b/res/convert.sh index 45f7f528..74158ff5 100755 --- a/res/convert.sh +++ b/res/convert.sh @@ -1,5 +1,5 @@ -#!/bin/sh -convert $1.png -depth 8 -format rgba $1.rgba -mv $1.rgba $1 -objcopy --input binary --output elf32-i386 --binary-architecture i386 $1 $1.o -mv $1.o bin/$1.o \ No newline at end of file +#!/usr/bin/env bash +convert "$1".png -depth 8 -format rgba "$1".rgba +mv "$1".rgba "$1" +objcopy --input binary --output elf32-i386 --binary-architecture i386 "$1" "$1".o +mv "$1".o bin/"$1".o diff --git a/update b/update index a0b91a55..9f2f95e3 100755 --- a/update +++ b/update @@ -1,4 +1,6 @@ +#!/usr/bin/env bash + git pull origin master && \ git submodule update --remote --recursive && \ make clean && \ -make -j4 \ No newline at end of file +make -j4 From d56eab0438197e8ff8a7b232c3ec55a98e4f8906 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Tue, 2 May 2017 00:06:43 +0300 Subject: [PATCH 7/7] Add Auto-Vaccinator --- src/hacks/AutoHeal.cpp | 139 ++++++++++++++++++++++++++++++++++++++++- src/netvars.cpp | 1 + src/netvars.h | 1 + 3 files changed, 140 insertions(+), 1 deletion(-) diff --git a/src/hacks/AutoHeal.cpp b/src/hacks/AutoHeal.cpp index f5d55674..1ac25e73 100644 --- a/src/hacks/AutoHeal.cpp +++ b/src/hacks/AutoHeal.cpp @@ -23,6 +23,107 @@ static CatVar pop_uber_auto(CV_SWITCH, "autoheal_uber", "1", "AutoUber", "Use ub static CatVar pop_uber_percent(CV_FLOAT, "autoheal_uber_health", "30", "Pop uber if health% <", "When under a percentage of health, use ubercharge"); static CatVar share_uber(CV_SWITCH, "autoheal_share_uber", "1", "Share ubercharge", "Aimbot will attempt to share uber charge with un-ubered players"); +int vaccinator_change_stage = 0; +int vaccinator_change_ticks = 0; +int vaccinator_ideal_resist = 0; + +int BulletDangerValue(CachedEntity* patient) { + // Find zoomed in snipers in other team + bool any_zoomed_snipers = false; + for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + if (!ent->m_bEnemy) continue; + if (g_pPlayerResource->GetClass(ent) != tf_sniper) continue; + if (CE_BYTE(ent, netvar.iLifeState)) continue; + if (!HasCondition(ent, TFCond_Zoomed)) continue; + any_zoomed_snipers = true; + // TODO VisCheck from patient. + if (!IsEntityVisible(ent, head)) continue; + return 2; + } + return any_zoomed_snipers; +} + +int FireDangerValue(CachedEntity* patient) { + // Find nearby pyros + for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + if (!ent->m_bEnemy) continue; + if (g_pPlayerResource->GetClass(ent) != tf_pyro) continue; + if (CE_BYTE(ent, netvar.iLifeState)) continue; + if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 300.0f * 300.0f) continue; + IClientEntity* pyro_weapon = g_IEntityList->GetClientEntity(CE_INT(ent, netvar.hActiveWeapon) & 0xFFF); + return (pyro_weapon && pyro_weapon->GetClientClass()->m_ClassID == g_pClassID->CTFFlameThrower) ? 2 : 0; + } + if (HasCondition(patient, TFCond_OnFire)) { + return 1; + } + return 0; +} + +int BlastDangerValue(CachedEntity* patient) { + // Find crit rockets/pipes nearby + for (int i = 32; i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + if (CE_BAD(ent)) continue; + if (!ent->m_bEnemy) continue; + if (ent->m_Type != ENTITY_PROJECTILE) continue; + if (patient->m_vecOrigin.DistToSqr(ent->m_vecOrigin) > 420.0f * 420.0f) continue; + // TODO Velocity checking + return ((ent->m_bCritProjectile || (patient->m_iHealth < 80)) ? 2 : 1); + } + return 0; +} + +int CurrentResistance() { + if (LOCAL_W->m_iClassID != g_pClassID->CWeaponMedigun) return 0; + return CE_INT(LOCAL_W, netvar.m_nChargeResistType); +} + +int OptimalResistance(CachedEntity* patient, bool* shouldPop) { + int bd = BlastDangerValue(patient), + fd = FireDangerValue(patient), + hd = BulletDangerValue(patient); + if (shouldPop) { + if (bd > 1 || fd > 1 || hd > 1) *shouldPop = true; + } + if (!hd && !fd && !bd) return -1; + if (hd >= fd && hd >= bd) return 0; + if (bd >= fd && bd >= hd) return 1; + if (fd >= hd && fd >= bd) return 2; + return -1; +} + +void SetResistance(int resistance) { + vaccinator_ideal_resist = resistance; + int cur = CurrentResistance(); + if (resistance == cur) return; + if (resistance > cur) vaccinator_change_stage = resistance - cur; + else vaccinator_change_stage = 3 - cur + resistance; +} + +void DoResistSwitching() { + if (!vaccinator_change_stage) return; + if (CurrentResistance() == vaccinator_ideal_resist) { + vaccinator_change_ticks = 0; + vaccinator_change_stage = 0; + return; + } + if (g_pUserCmd->buttons & IN_RELOAD) { + vaccinator_change_ticks = 8; + return; + } + else { + if (vaccinator_change_ticks <= 0) { + g_pUserCmd->buttons |= IN_RELOAD; + vaccinator_change_stage--; + vaccinator_change_ticks = 8; + } else { + vaccinator_change_ticks--; + } + } +} + int force_healing_target { 0 }; static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with SteamID (ONCE. Use for easy airstuck med setup)", [](const CCommand& args) { @@ -42,6 +143,16 @@ static CatCommand heal_steamid("autoheal_heal_steamid", "Heals a player with Ste } }); +static CatCommand vaccinator_bullet("vacc_bullet", "Bullet Vaccinator", []() { + SetResistance(0); +}); +static CatCommand vaccinator_blast("vacc_blast", "Blast Vaccinator", []() { + SetResistance(1); +}); +static CatCommand vaccinator_fire("vacc_fire", "Fire Vaccinator", []() { + SetResistance(2); +}); + bool IsPopped() { CachedEntity* weapon = g_pLocalPlayer->weapon(); if (CE_BAD(weapon) || weapon->m_iClassID != g_pClassID->CWeaponMedigun) return false; @@ -73,7 +184,25 @@ bool ShouldPop() { return ShouldChargePlayer(LOCAL_E->m_IDX); } +bool IsVaccinator() { + // DefIDX: 998 + return CE_INT(LOCAL_W, netvar.iItemDefinitionIndex) == 998; +} + +static CatVar auto_vacc(CV_SWITCH, "auto_vacc", "0", "Auto Vaccinator", "Pick resistance for incoming damage types"); + void CreateMove() { + bool pop = false; + if (IsVaccinator() && auto_vacc) { + DoResistSwitching(); + int my_opt = OptimalResistance(LOCAL_E, &pop); + if (my_opt >= 0 && my_opt != CurrentResistance()) { + SetResistance(my_opt); + } + if (pop && CurrentResistance() == my_opt) { + g_pUserCmd->buttons |= IN_ATTACK2; + } + } if (!enabled && !force_healing_target) return; if (GetWeaponMode(g_pLocalPlayer->entity) != weapon_medigun) return; if (force_healing_target) { @@ -103,7 +232,15 @@ void CreateMove() { AimAt(g_pLocalPlayer->v_Eye, out, g_pUserCmd); if (silent) g_pLocalPlayer->bUseSilentAngles = true; if (!m_iNewTarget && (g_GlobalVars->tickcount % 300)) g_pUserCmd->buttons |= IN_ATTACK; - if (pop_uber_auto && ShouldPop()) g_pUserCmd->buttons |= IN_ATTACK2; + if (IsVaccinator() && CE_GOOD(target) && auto_vacc) { + int opt = OptimalResistance(target, &pop); + if (!pop && opt != -1) SetResistance(opt); + if (pop && CurrentResistance() == opt) { + g_pUserCmd->buttons |= IN_ATTACK2; + } + } else { + if (pop_uber_auto && ShouldPop()) g_pUserCmd->buttons |= IN_ATTACK2; + } return; } diff --git a/src/netvars.cpp b/src/netvars.cpp index 24912ad0..5460ec7e 100644 --- a/src/netvars.cpp +++ b/src/netvars.cpp @@ -36,6 +36,7 @@ void NetVars::Init() { this->bDistributed = gNetvars.get_offset("DT_CurrencyPack", "m_bDistributed"); this->_condition_bits = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_ConditionList", "_condition_bits"); this->m_flStealthNoAttackExpire = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "tfsharedlocaldata", "m_flStealthNoAttackExpire"); + this->m_nChargeResistType = gNetvars.get_offset("DT_WeaponMedigun", "m_nChargeResistType"); } if (TF2 || TF2C) { this->res_iMaxHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxHealth"); diff --git a/src/netvars.h b/src/netvars.h index ed12eb6b..9c1f58ba 100644 --- a/src/netvars.h +++ b/src/netvars.h @@ -124,6 +124,7 @@ public: offset_t m_bReadyToBackstab; offset_t m_Collision; offset_t res_iTeam; + offset_t m_nChargeResistType; }; extern NetVars netvar;