killsay xd
This commit is contained in:
parent
47d19babff
commit
1371277468
@ -41,6 +41,7 @@
|
||||
<option id="gnu.cpp.compiler.option.other.pic.920050344" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1848710724" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="/home/nullifiedcat/source-sdk-2013-master/mp/src/public"/>
|
||||
<listOptionValue builtIn="false" value="/home/nullifiedcat/cathook/imgui"/>
|
||||
<listOptionValue builtIn="false" value="/home/nullifiedcat/source-sdk-2013-master/mp/src/mathlib"/>
|
||||
<listOptionValue builtIn="false" value="/home/nullifiedcat/source-sdk-2013-master/mp/src/common"/>
|
||||
<listOptionValue builtIn="false" value="/home/nullifiedcat/source-sdk-2013-master/mp/src/public/tier1"/>
|
||||
@ -51,7 +52,7 @@
|
||||
<listOptionValue builtIn="false" value="TF2"/>
|
||||
<listOptionValue builtIn="false" value="__DRM_ENABLED=false"/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.debugging.other.1695695237" superClass="gnu.cpp.compiler.option.debugging.other" useByScannerDiscovery="false" value="-ggdb" valueType="string"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.other.1695695237" name="Other debugging flags" superClass="gnu.cpp.compiler.option.debugging.other" useByScannerDiscovery="false" value="-ggdb" valueType="string"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.236333340" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.1506529605" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
|
||||
|
@ -28,23 +28,7 @@
|
||||
#include "conditions.h"
|
||||
#include "ipc/ipcctl.h"
|
||||
|
||||
#include "hacks/Aimbot.h"
|
||||
#include "hacks/AntiAim.h"
|
||||
#include "hacks/AutoHeal.h"
|
||||
#include "hacks/AutoReflect.h"
|
||||
#include "hacks/Bunnyhop.h"
|
||||
#include "hacks/ESP.h"
|
||||
#include "hacks/Airstuck.h"
|
||||
#include "hacks/AntiDisguise.h"
|
||||
#include "hacks/AutoSticky.h"
|
||||
#include "hacks/AutoStrafe.h"
|
||||
#include "hacks/FollowBot.h"
|
||||
#include "hacks/HuntsmanCompensation.h"
|
||||
#include "hacks/Misc.h"
|
||||
#include "hacks/SpyAlert.h"
|
||||
#include "hacks/Trigger.h"
|
||||
#include "hacks/IHack.h"
|
||||
#include "hacks/Glow.h"
|
||||
#include "hacks/hacklist.h"
|
||||
#include "glowobjects.h"
|
||||
|
||||
#include "drm.h"
|
||||
|
@ -22,23 +22,7 @@
|
||||
|
||||
#include <steam/isteamuser.h>
|
||||
// All Hacks
|
||||
#include "hacks/IHack.h"
|
||||
|
||||
#include "hacks/Aimbot.h"
|
||||
#include "hacks/Airstuck.h"
|
||||
#include "hacks/AntiAim.h"
|
||||
#include "hacks/AntiDisguise.h"
|
||||
#include "hacks/AutoHeal.h"
|
||||
#include "hacks/AutoReflect.h"
|
||||
#include "hacks/AutoSticky.h"
|
||||
#include "hacks/AutoStrafe.h"
|
||||
#include "hacks/Bunnyhop.h"
|
||||
#include "hacks/ESP.h"
|
||||
#include "hacks/FollowBot.h"
|
||||
#include "hacks/HuntsmanCompensation.h"
|
||||
#include "hacks/Misc.h"
|
||||
#include "hacks/SpyAlert.h"
|
||||
#include "hacks/Trigger.h"
|
||||
#include "hacks/hacklist.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "sharedobj.h"
|
||||
@ -84,6 +68,7 @@ void hack::InitHacks() {
|
||||
ADD_HACK(HuntsmanCompensation);
|
||||
ADD_HACK(SpyAlert);
|
||||
ADD_HACK(Glow);
|
||||
ADD_HACK(KillSay);
|
||||
}
|
||||
|
||||
ConCommand* hack::c_Cat = 0;
|
||||
@ -104,6 +89,7 @@ void hack::CC_Cat(const CCommand& args) {
|
||||
|
||||
void hack::Initialize() {
|
||||
logging::Initialize();
|
||||
srand(time(0));
|
||||
prctl(PR_SET_DUMPABLE,0,42,42,42);
|
||||
logging::Info("Build: " __DATE__ " " __TIME__);
|
||||
logging::Info("Loading shared objects...");
|
||||
@ -221,4 +207,5 @@ void hack::Shutdown() {
|
||||
DELETE_HACK(HuntsmanCompensation);
|
||||
DELETE_HACK(SpyAlert);
|
||||
DELETE_HACK(Glow);
|
||||
DELETE_HACK(KillSay);
|
||||
}
|
||||
|
104
cathook/src/hacks/KillSay.cpp
Normal file
104
cathook/src/hacks/KillSay.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
/*
|
||||
* KillSay.cpp
|
||||
*
|
||||
* Created on: Jan 19, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "KillSay.h"
|
||||
#include "../common.h"
|
||||
#include "../sdk.h"
|
||||
#include <pwd.h>
|
||||
|
||||
DEFINE_HACK_SINGLETON(KillSay);
|
||||
|
||||
const char* KillSay::GetName() { return "KILLSAY"; }
|
||||
|
||||
void KillSayEventListener::FireGameEvent(IGameEvent* event) {
|
||||
if (!g_phKillSay->v_bEnabled->GetBool()) return;
|
||||
SEGV_BEGIN;
|
||||
const char* msg = g_phKillSay->ComposeKillSay(event);
|
||||
if (msg) {
|
||||
g_phKillSay->PushStack(msg);
|
||||
delete msg;
|
||||
}
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
const char* KillSay::ComposeKillSay(IGameEvent* event) {
|
||||
if (m_nKillSays == 0) return 0;
|
||||
int vid = event->GetInt("userid");
|
||||
int kid = event->GetInt("attacker");
|
||||
if (interfaces::engineClient->GetPlayerForUserID(kid) != interfaces::engineClient->GetLocalPlayer()) return 0;
|
||||
char* msg = strfmt("%s", m_KillSays[rand() % m_nKillSays]);
|
||||
player_info_s info;
|
||||
interfaces::engineClient->GetPlayerInfo(interfaces::engineClient->GetPlayerForUserID(vid), &info);
|
||||
ReplaceString(msg, "%name%", info.name);
|
||||
return msg;
|
||||
}
|
||||
|
||||
KillSay::KillSay() {
|
||||
v_bEnabled = CREATE_CV(CV_SWITCH, "killsay", "0", "KillSay");
|
||||
v_sFileName = CREATE_CV(CV_STRING, "killsay_file", "killsays.txt", "Killsay file (~/.cathook/)");
|
||||
m_Stack = new char256[KILLSAY_STACK_SIZE];
|
||||
CreateConCommand("cat_killsay_reload", CC_KillSay_ReloadFile, "Reload KillSay");
|
||||
m_nStackTop = -1;
|
||||
m_fLastSay = 0.0f;
|
||||
m_nKillSays = 0;
|
||||
interfaces::eventManager->AddListener(&m_Listener, "player_death", false);
|
||||
}
|
||||
|
||||
void CC_KillSay_ReloadFile(const CCommand& args) {
|
||||
SAFE_CALL(g_phKillSay->LoadFile());
|
||||
}
|
||||
|
||||
void KillSay::LoadFile() {
|
||||
uid_t uid = geteuid();
|
||||
passwd* pw = getpwuid(uid);
|
||||
if (!pw) {
|
||||
logging::Info("can't get the username!");
|
||||
return;
|
||||
}
|
||||
char* filename = strfmt("/home/%s/.cathook/%s", pw->pw_name, v_sFileName->m_pConVar->GetString());
|
||||
FILE* file = fopen(filename, "r");
|
||||
if (!file) {
|
||||
logging::Info("Could not open the file: %s", filename);
|
||||
delete filename;
|
||||
return;
|
||||
}
|
||||
delete filename;
|
||||
for (m_nKillSays = 0; m_nKillSays < KILLSAY_ARRAY_MAX_SIZE; m_nKillSays++) {
|
||||
if(fgets(m_KillSays[m_nKillSays], KILLSAY_MAX_LENGTH, file)) {
|
||||
m_KillSays[m_nKillSays][strlen(m_KillSays[m_nKillSays]) - 1] = '\0';
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
||||
void KillSay::PushStack(const char* text) {
|
||||
if (m_nStackTop == KILLSAY_STACK_SIZE - 1) return;
|
||||
strncpy(m_Stack[++m_nStackTop].data, text, 255);
|
||||
logging::Info("Pushed, new stacktop: %i", m_nStackTop);
|
||||
}
|
||||
|
||||
char256* KillSay::PopStack() {
|
||||
if (m_nStackTop < 0) return 0;
|
||||
return &m_Stack[m_nStackTop--];
|
||||
}
|
||||
|
||||
bool KillSay::CreateMove(void*, float, CUserCmd*) {
|
||||
if (m_nStackTop <= 0) return true;
|
||||
if (interfaces::gvars->realtime - m_fLastSay < 1.0f) return true;
|
||||
char256* killsay = PopStack();
|
||||
if (!killsay) return true;
|
||||
char* cmd = strfmt("say \"%s\"", killsay->data);
|
||||
interfaces::engineClient->ServerCmd(cmd, true);
|
||||
delete cmd;
|
||||
m_fLastSay = interfaces::gvars->realtime;
|
||||
return true;
|
||||
}
|
||||
void KillSay::PaintTraverse(void*, unsigned int, bool, bool) {}
|
||||
void KillSay::LevelInit(const char*) {
|
||||
m_fLastSay = 0.0f;
|
||||
m_nStackTop = -1;
|
||||
}
|
||||
void KillSay::LevelShutdown() {}
|
51
cathook/src/hacks/KillSay.h
Normal file
51
cathook/src/hacks/KillSay.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* KillSay.h
|
||||
*
|
||||
* Created on: Jan 19, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifndef HACKS_KILLSAY_H_
|
||||
#define HACKS_KILLSAY_H_
|
||||
|
||||
#include "IHack.h"
|
||||
|
||||
#include "../fixsdk.h"
|
||||
#include <igameevents.h>
|
||||
|
||||
#define KILLSAY_STACK_SIZE 64
|
||||
#define KILLSAY_ARRAY_MAX_SIZE 256
|
||||
#define KILLSAY_MAX_LENGTH 256
|
||||
|
||||
struct char256 { char data[256]; };
|
||||
|
||||
class KillSayEventListener : public IGameEventListener2 {
|
||||
virtual void FireGameEvent(IGameEvent* event);
|
||||
};
|
||||
|
||||
class KillSay : public IHack {
|
||||
public:
|
||||
DECLARE_HACK_METHODS();
|
||||
KillSay();
|
||||
void PushStack(const char* text);
|
||||
char256* PopStack();
|
||||
const char* ComposeKillSay(IGameEvent* evt);
|
||||
void LoadFile();
|
||||
|
||||
CatVar* v_bEnabled;
|
||||
CatVar* v_sFileName;
|
||||
|
||||
char m_KillSays[KILLSAY_ARRAY_MAX_SIZE][KILLSAY_MAX_LENGTH];
|
||||
int m_nKillSays;
|
||||
KillSayEventListener m_Listener;
|
||||
float m_fLastSay;
|
||||
char256* m_Stack;
|
||||
int m_nStackTop;
|
||||
};
|
||||
|
||||
//void CC_PushKillsayDBG(const CCommand& args);
|
||||
void CC_KillSay_ReloadFile(const CCommand& args);
|
||||
|
||||
DECLARE_HACK_SINGLETON(KillSay);
|
||||
|
||||
#endif /* HACKS_KILLSAY_H_ */
|
@ -259,7 +259,9 @@ Misc::Misc() {
|
||||
c_DisconnectVAC = CreateConCommand(CON_PREFIX "disconnect_vac", CC_DisonnectVAC, "Disconnect (VAC)");
|
||||
v_bInfoSpam = CreateConVar(CON_PREFIX "info_spam", "0", "Info spam");
|
||||
v_bFastCrouch = CreateConVar(CON_PREFIX "fakecrouch", "0", "Fast crouch");
|
||||
//v_bDumpEventInfo = CreateConVar(CON_PREFIX "debug_event_info", "0", "Show event info");
|
||||
CreateConCommand(CON_PREFIX "set", CC_SetValue, "Set ConVar value (if third argument is 1 the ^'s will be converted into newlines)");
|
||||
//interfaces::eventManager->AddListener(&listener, "player_death", false);
|
||||
}
|
||||
|
||||
int sa_switch = 0;
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
ConCommand* c_Name;
|
||||
ConVar* v_bInfoSpam;
|
||||
ConVar* v_bFastCrouch;
|
||||
//ConVar* v_bDumpEventInfo;
|
||||
ConCommand* c_DumpItemAttributes;
|
||||
ConCommand* c_SayLine;
|
||||
ConCommand* c_Shutdown;
|
||||
|
@ -24,5 +24,6 @@
|
||||
#include "SpyAlert.h"
|
||||
#include "Trigger.h"
|
||||
#include "Glow.h"
|
||||
#include "KillSay.h"
|
||||
|
||||
#endif /* HACKS_HACKLIST_H_ */
|
||||
|
@ -30,6 +30,27 @@ void EndConVars() {
|
||||
ConVar_Register();
|
||||
}
|
||||
|
||||
// StackOverflow copypasta xddd
|
||||
void ReplaceString(char* target, char* what, char* with_what) {
|
||||
char buffer[1024] = { 0 };
|
||||
char *insert_point = &buffer[0];
|
||||
const char *tmp = target;
|
||||
size_t needle_len = strlen(what);
|
||||
size_t repl_len = strlen(with_what);
|
||||
while (1) {
|
||||
const char *p = strstr(tmp, what);
|
||||
if (p == NULL) {
|
||||
strcpy(insert_point, tmp);
|
||||
break;
|
||||
}
|
||||
memcpy(insert_point, tmp, p - tmp);
|
||||
insert_point += p - tmp;
|
||||
memcpy(insert_point, with_what, repl_len);
|
||||
insert_point += repl_len;
|
||||
tmp = p + needle_len;
|
||||
}
|
||||
strcpy(target, buffer);
|
||||
}
|
||||
|
||||
bool IsPlayerInvulnerable(CachedEntity* player) {
|
||||
return (HasCondition(player, TFCond_Ubercharged) || HasCondition(player, TFCond_UberchargedCanteen)
|
||||
|
@ -70,6 +70,7 @@ bool IsVectorVisible(Vector a, Vector b);
|
||||
relation GetRelation(CachedEntity* ent); // TODO new relations
|
||||
bool IsSentryBuster(CachedEntity* ent);
|
||||
char* strfmt(const char* fmt, ...);
|
||||
void ReplaceString(char* target, char* what, char* with_what);
|
||||
// TODO move that to weaponid.h
|
||||
bool IsAmbassador(CachedEntity* ent);
|
||||
|
||||
|
@ -83,6 +83,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
SAFE_CALL(CREATE_MOVE(Glow));
|
||||
//SAFE_CALL(CREATE_MOVE(FollowBot));
|
||||
SAFE_CALL(CREATE_MOVE(Misc));
|
||||
SAFE_CALL(CREATE_MOVE(KillSay));
|
||||
// PROF_END("Hacks processing");
|
||||
if (time_replaced) interfaces::gvars->curtime = curtime_old;
|
||||
}
|
||||
|
@ -124,6 +124,11 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (g_Settings.bNoZoom->GetBool()) {
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
RemoveCondition(g_pLocalPlayer->entity, condition::TFCond_Zoomed);
|
||||
}
|
||||
}
|
||||
#if GUI_ENABLED == true
|
||||
g_pGUI->UpdateKeys();
|
||||
g_pGUI->Draw();
|
||||
|
45
cathook/src/hooks/SwapWindow.cpp
Normal file
45
cathook/src/hooks/SwapWindow.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* SwapWindow.cpp
|
||||
*
|
||||
* Created on: Jan 19, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
/*#include "others.h"
|
||||
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui/imgui_impl_sdl.h"
|
||||
|
||||
unsigned int* swapwindow_ptr = 0;
|
||||
unsigned int swapwindow_orig = 0;
|
||||
|
||||
void SwapWindow_hook(SDL_Window* window) {
|
||||
static void (*oSDL_GL_SwapWindow) (SDL_Window*) = reinterpret_cast<void(*)(SDL_Window*)>(swapwindow_orig);
|
||||
|
||||
// Store OpenGL contexts.
|
||||
static SDL_GLContext original_context = SDL_GL_GetCurrentContext();
|
||||
static SDL_GLContext user_context = NULL;
|
||||
|
||||
// Perform first-time initialization.
|
||||
if (!user_context) {
|
||||
// Create a new context for our rendering.
|
||||
user_context = SDL_GL_CreateContext(window);
|
||||
ImGui_ImplSdl_Init(window);
|
||||
}
|
||||
|
||||
// Switch to our context.
|
||||
SDL_GL_MakeCurrent(window, user_context);
|
||||
|
||||
// Perform UI rendering.
|
||||
ImGui_ImplSdl_NewFrame(window);
|
||||
|
||||
ImGui::Text("Hello, world!");
|
||||
ImGui::Render();
|
||||
|
||||
// Swap back to the game context.
|
||||
SDL_GL_MakeCurrent(window, original_context);
|
||||
|
||||
// Call the original function.
|
||||
oSDL_GL_SwapWindow(window);
|
||||
ImGui_ImplSdl_NewFrame(window);
|
||||
}*/
|
@ -8,6 +8,8 @@
|
||||
#ifndef HOOKEDMETHODS_H_
|
||||
#define HOOKEDMETHODS_H_
|
||||
|
||||
class SDL_Window;
|
||||
|
||||
typedef bool(CreateMove_t)(void*, float, CUserCmd*);
|
||||
typedef void(PaintTraverse_t)(void*, unsigned int, bool, bool);
|
||||
typedef bool(CanPacket_t)(void*);
|
||||
@ -19,6 +21,7 @@ typedef bool(DispatchUserMessage_t)(void*, int, bf_read&);
|
||||
typedef void(FrameStageNotify_t)(void*, int);
|
||||
typedef void(LevelInit_t)(void*, const char*);
|
||||
typedef void(LevelShutdown_t)(void*);
|
||||
typedef void(SwapWindow_t)(SDL_Window*);
|
||||
|
||||
#include "CreateMove.h"
|
||||
#include "PaintTraverse.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
class INetMessage;
|
||||
class CViewSetup;
|
||||
class bf_read;
|
||||
class SDL_Window;
|
||||
|
||||
bool CanPacket_hook(void*);
|
||||
int IN_KeyEvent_hook(void*, int, int, const char*);
|
||||
@ -21,5 +22,9 @@ bool DispatchUserMessage_hook(void*, int, bf_read&);
|
||||
void FrameStageNotify_hook(void*, int);
|
||||
void LevelInit_hook(void*, const char*);
|
||||
void LevelShutdown_hook(void*);
|
||||
void SwapWindow_hook(SDL_Window* window);
|
||||
|
||||
//extern unsigned int* swapwindow_ptr;
|
||||
//extern unsigned int swapwindow_orig;
|
||||
|
||||
#endif /* OTHERS_H_ */
|
||||
|
@ -145,3 +145,20 @@ const char *NET_SetConVar::ToString(void) const
|
||||
return "(NULL)";
|
||||
}
|
||||
|
||||
bool NET_StringCmd::WriteToBuffer( bf_write &buffer )
|
||||
{
|
||||
buffer.WriteUBitLong( GetType(), 6 );
|
||||
return buffer.WriteString( m_szCommand ? m_szCommand : " NET_StringCmd NULL" );
|
||||
}
|
||||
|
||||
bool NET_StringCmd::ReadFromBuffer( bf_read &buffer )
|
||||
{
|
||||
m_szCommand = m_szCommandBuffer;
|
||||
return buffer.ReadString(m_szCommandBuffer, sizeof(m_szCommandBuffer) );
|
||||
}
|
||||
|
||||
const char *NET_StringCmd::ToString(void) const
|
||||
{
|
||||
return "STRINGCMD";
|
||||
}
|
||||
|
||||
|
@ -185,4 +185,21 @@ public:
|
||||
//CUtlVector<cvar_t> m_ConVars;
|
||||
};
|
||||
|
||||
class NET_StringCmd : public CNetMessage
|
||||
{
|
||||
DECLARE_NET_MESSAGE( StringCmd );
|
||||
|
||||
int GetGroup() const { return INetChannelInfo::STRINGCMD; }
|
||||
|
||||
NET_StringCmd() { m_szCommand = NULL; };
|
||||
NET_StringCmd(const char *cmd) { m_szCommand = cmd; };
|
||||
|
||||
public:
|
||||
const char *m_szCommand; // execute this command
|
||||
|
||||
private:
|
||||
char m_szCommandBuffer[1024]; // buffer for received messages
|
||||
|
||||
};
|
||||
|
||||
#endif /* NETMESSAGE_H_ */
|
||||
|
Reference in New Issue
Block a user