diff --git a/attach-user b/attach-user new file mode 100755 index 00000000..7d999c17 --- /dev/null +++ b/attach-user @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +user=$USER + +if [ "$#" == 1 ]; then + user=$1 +fi + +proc="0" + +for pid in $(pidof hl2_linux) +do + if sudo -H -u $user kill -0 $pid + then + proc=$pid + break + fi +done + + +if [ "$proc" == "0" ] +then + echo "TF2 for $user is not running" + continue +fi + +echo Attaching to "$proc" + +FILENAME=$(realpath "bin/libcathook.so") + +echo loading "$FILENAME" to "$proc" + +sudo killall -19 steam +sudo killall -19 steamwebhelper + +sudo gdb -n -q -batch \ + -ex "attach $proc" \ + -ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \ + -ex "call \$dlopen(\"$FILENAME\", 1)" \ + -ex "call dlerror()" \ + -ex 'print (char *) $2' \ + -ex "detach" \ + -ex "quit" + +sudo killall -18 steamwebhelper +sudo killall -18 steam \ No newline at end of file diff --git a/src/headshake.cpp b/src/headshake.cpp new file mode 100644 index 00000000..8c8f28cb --- /dev/null +++ b/src/headshake.cpp @@ -0,0 +1,12 @@ +/* + * headshake.cpp + * + * Created on: Aug 2, 2017 + * Author: nullifiedcat + */ + +#include + +const std::vector headshake_pitch_deltas = { + -0.2, 0.8, -1.7, 0.8, -0.8, 0.19, -0.99, 1.9 +}; diff --git a/src/headshake.hpp b/src/headshake.hpp new file mode 100644 index 00000000..6b61018d --- /dev/null +++ b/src/headshake.hpp @@ -0,0 +1,12 @@ +/* + * headshake.hpp + * + * Created on: Aug 2, 2017 + * Author: nullifiedcat + */ + +#pragma once + + + + diff --git a/src/helpers.cpp b/src/helpers.cpp index bbd92ff3..e9434758 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -156,6 +156,7 @@ powerup_type GetPowerupOnPlayer(CachedEntity* player) { // A function to tell if a player is using a specific weapon bool HasWeapon(CachedEntity* ent, int wantedId) { + if (CE_BAD(ent)) return false; // Create a var to store the handle int *hWeapons; // Grab the handle and store it into the var @@ -172,6 +173,7 @@ bool HasWeapon(CachedEntity* ent, int wantedId) { } bool HasDarwins(CachedEntity* ent) { + if (CE_BAD(ent)) return false; // Check if player is sniper if (CE_INT(ent, netvar.iClass) != tf_sniper) return false; // Check if player is using darwins, 231 is the id for darwins danger sheild diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 089d706a..0176c423 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -225,10 +225,21 @@ bool SendNetMsg_hook(void* _this, INetMessage& msg, bool bForceReliable = false, return false; } +static CatVar die_if_vac(CV_SWITCH, "die_if_vac", "0", "Die if VAC banned"); + void Shutdown_hook(void* _this, const char* reason) { // This is a INetChannel hook - it SHOULDN'T be static because netchannel changes. const Shutdown_t original = (Shutdown_t)hooks::netchannel.GetMethod(offsets::Shutdown()); logging::Info("Disconnect: %s", reason); + if (strstr(reason, "VAC banned")) { + if (die_if_vac) { + logging::Info("VAC banned"); + *(int*)0 = 0; + exit(1); + } + } else if (strstr(reason, "VAC")) { + logging::Info("VAC error?"); + } #if IPC_ENABLED ipc::UpdateServerAddress(true); #endif diff --git a/src/interfaces.cpp b/src/interfaces.cpp index 3b7061d9..0ea76c7c 100644 --- a/src/interfaces.cpp +++ b/src/interfaces.cpp @@ -86,12 +86,14 @@ void CreateInterfaces() { HSteamPipe sp = g_ISteamClient->CreateSteamPipe(); HSteamUser su = g_ISteamClient->ConnectToGlobalUser(sp); g_IVModelRender = BruteforceInterface("VEngineModel", sharedobj::engine(), 16); + g_ISteamFriends = nullptr; IF_GAME (IsTF2()) { 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(sig_steamapi + 36); g_ISteamFriends = (ISteamFriends*)(SteamAPI_engine[1]);// - } else { + } + if (g_ISteamFriends == nullptr) { // FIXME SIGNATURE g_ISteamFriends = g_ISteamClient->GetISteamFriends(su, sp, "SteamFriends002"); }