Skip to content

Commit 1b0c42a

Browse files
authored
Upload up-to-date external
1 parent 6c6e993 commit 1b0c42a

14 files changed

+1085
-0
lines changed

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CMakeFiles/*
2+
.idea/*
3+
cmake_install.cmake
4+
*.txt
5+
!CMakeLists.txt
6+
!nologs-branch.md
7+
*.log
8+
lolpls
9+
csgo_external
10+
.vscode/

CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cmake_minimum_required(VERSION 2.8.4)
2+
project(csgo_external)
3+
4+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++11 -Wunused")
5+
set(EXECUTABLE_OUTPUT_PATH ./build)
6+
7+
file(GLOB SOURCE_FILES *.cpp)
8+
add_executable(csgo_external ${SOURCE_FILES})
9+
target_link_libraries(csgo_external "-lX11 -lconfig++")

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or
4+
distribute this software, either in source code form or as a compiled
5+
binary, for any purpose, commercial or non-commercial, and by any
6+
means.
7+
8+
In jurisdictions that recognize copyright laws, the author or authors
9+
of this software dedicate any and all copyright interest in the
10+
software to the public domain. We make this dedication for the benefit
11+
of the public at large and to the detriment of our heirs and
12+
successors. We intend this dedication to be an overt act of
13+
relinquishment in perpetuity of all present and future rights to this
14+
software under copyright law.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.
23+
24+
For more information, please refer to <http://unlicense.org>
25+

colors.h

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef __COLORS_H_
2+
#define __COLORS_H_
3+
4+
/*---- Color definitions ----*/
5+
#define RESET "\x1B[0m"
6+
#define RED "\x1B[31m"
7+
#define GREEN "\x1B[32m"
8+
#define YELLOW "\x1B[33m"
9+
#define BLUE "\x1B[34m"
10+
#define MAGENTA "\x1B[35m"
11+
#define CYAN "\x1B[36m"
12+
#define WHITE "\x1B[37m"
13+
14+
#define BOLD "\x1B[1m"
15+
#define UNDERLINE "\x1B[4m"
16+
17+
#endif

csgo-external-title

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
██████ ████████ ████████ ███████ ████████ ██ ██
2+
██░░░░██ ██░░░░░░ ██░░░░░░██ ██░░░░░██ ░██░░░░░ ░██ ░██
3+
██ ░░ ░██ ██ ░░ ██ ░░██ ░██ ██ ██ ██████ █████ ██████ ███████ ██████ ░██
4+
░██ ░█████████░██ ░██ ░██ █████░███████ ░░██ ██ ░░░██░ ██░░░██░░██░░█░░██░░░██ ░░░░░░██ ░██
5+
░██ ░░░░░░░░██░██ █████░██ ░██░░░░░ ░██░░░░ ░░███ ░██ ░███████ ░██ ░ ░██ ░██ ███████ ░██
6+
░░██ ██ ░██░░██ ░░░░██░░██ ██ ░██ ██░██ ░██ ░██░░░░ ░██ ░██ ░██ ██░░░░██ ░██
7+
░░██████ ████████ ░░████████ ░░███████ ░████████ ██ ░░██ ░░██ ░░██████░███ ███ ░██░░████████ ███
8+
░░░░░░ ░░░░░░░░ ░░░░░░░░ ░░░░░░░ ░░░░░░░░ ░░ ░░ ░░ ░░░░░░ ░░░ ░░░ ░░ ░░░░░░░░ ░░░
9+

hack.cpp

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#include "hack.h"
2+
3+
struct iovec g_remote[1024], g_local[1024];
4+
struct hack::GlowObjectDefinition_t g_glow[1024];
5+
6+
int count = 0;
7+
unsigned char spotted = 1;
8+
9+
10+
void hack::Glow(double colors[12], remote::Handle* csgo, remote::MapModuleMemoryRegion* client) {
11+
if (!csgo || !client)
12+
return;
13+
14+
// Reset
15+
bzero(g_remote, sizeof(g_remote));
16+
bzero(g_local, sizeof(g_local));
17+
bzero(g_glow, sizeof(g_glow));
18+
19+
hack::CGlowObjectManager manager;
20+
21+
if (!csgo->Read((void*) csgo->m_addressOfGlowPointer, &manager, sizeof(hack::CGlowObjectManager))) {
22+
Logger::error ("Failed to read glowClassAddress");
23+
throw 1;
24+
return;
25+
}
26+
27+
size_t count = manager.m_GlowObjectDefinitions.Count;
28+
29+
void* data_ptr = (void*) manager.m_GlowObjectDefinitions.DataPtr;
30+
31+
if (!csgo->Read(data_ptr, g_glow, sizeof(hack::GlowObjectDefinition_t) * count)) {
32+
Logger::error ("Failed to read m_GlowObjectDefinitions");
33+
throw 1;
34+
return;
35+
}
36+
37+
size_t writeCount = 0;
38+
unsigned long localPlayer = 0;
39+
unsigned int teamNumber = 0;
40+
41+
csgo->Read((void*) csgo->m_addressOfLocalPlayer, &localPlayer, sizeof(long));
42+
if (localPlayer != 0)
43+
csgo->Read((void*) (localPlayer+0x128), &teamNumber, sizeof(int));
44+
45+
for (unsigned int i = 0; i < count; i++) {
46+
if (g_glow[i].m_pEntity != NULL) {
47+
Entity ent;
48+
49+
if (csgo->Read(g_glow[i].m_pEntity, &ent, sizeof(Entity))) {
50+
if (ent.m_iTeamNum != 2 && ent.m_iTeamNum != 3) {
51+
g_glow[i].m_bRenderWhenOccluded = 0;
52+
g_glow[i].m_bRenderWhenUnoccluded = 0;
53+
continue;
54+
}
55+
56+
bool entityInCrossHair = false;
57+
58+
if (localPlayer != 0) {
59+
if (ent.m_iTeamNum != teamNumber) {
60+
unsigned int crossHairId = 0;
61+
unsigned int entityId = 0;
62+
unsigned int attack = 0x5;
63+
unsigned int release = 0x4;
64+
csgo->Read((void*) (localPlayer+0xBBD8), &crossHairId, sizeof(int)); // 0xB390 => 0xB3A0 => 0xB398 => 0xBBD8// +0x7C avec m_bhasdefuser
65+
csgo->Read((void*) (g_glow[i].m_pEntity + 0x94), &entityId, sizeof(int));
66+
67+
unsigned int iAlt1Status = 0 ;
68+
csgo->Read((void*) (csgo->m_addressOfAlt1), &iAlt1Status, sizeof(int));
69+
if (crossHairId == entityId) {
70+
entityInCrossHair = true;
71+
72+
unsigned int shooting;
73+
csgo->Read((void*) (csgo->m_addressOfForceAttack), &shooting, sizeof(int));
74+
75+
if (iAlt1Status == 0x5 && shooting != attack) {
76+
usleep(100);
77+
csgo->Write((void*) (csgo->m_addressOfForceAttack), &attack, sizeof(int));
78+
usleep(100);
79+
csgo->Write((void*) (csgo->m_addressOfForceAttack), &release, sizeof(int));
80+
}
81+
}
82+
}
83+
}
84+
85+
csgo->Write((void*) ((unsigned long) g_glow[i].m_pEntity + 0xECD), &spotted, sizeof(unsigned char));
86+
87+
if (g_glow[i].m_bRenderWhenOccluded == 1)
88+
continue;
89+
90+
g_glow[i].m_bRenderWhenOccluded = 1;
91+
g_glow[i].m_bRenderWhenUnoccluded = 0;
92+
93+
if (ent.m_iTeamNum == 2 || ent.m_iTeamNum == 3) {
94+
if (teamNumber == ent.m_iTeamNum) {
95+
g_glow[i].m_flGlowRed = colors[8];
96+
g_glow[i].m_flGlowGreen = colors[9];
97+
g_glow[i].m_flGlowBlue = colors[10];
98+
g_glow[i].m_flGlowAlpha = colors[11];
99+
} else {
100+
g_glow[i].m_flGlowRed = entityInCrossHair ? colors[4] : colors[0];
101+
g_glow[i].m_flGlowGreen = entityInCrossHair ? colors[5] : colors[1];
102+
g_glow[i].m_flGlowBlue = entityInCrossHair ? colors[6] : colors[2];
103+
g_glow[i].m_flGlowAlpha = entityInCrossHair ? colors[7] : colors[3];
104+
}
105+
}
106+
}
107+
}
108+
109+
if (csgo->m_bShouldGlow) {
110+
size_t bytesToCutOffEnd = sizeof(hack::GlowObjectDefinition_t) - g_glow[i].writeEnd();
111+
size_t bytesToCutOffBegin = (size_t) g_glow[i].writeStart();
112+
size_t totalWriteSize = (sizeof(hack::GlowObjectDefinition_t) - (bytesToCutOffBegin + bytesToCutOffEnd));
113+
114+
g_remote[writeCount].iov_base =
115+
((uint8_t*) data_ptr + (sizeof(hack::GlowObjectDefinition_t) * i)) + bytesToCutOffBegin;
116+
g_local[writeCount].iov_base = ((uint8_t*) &g_glow[i]) + bytesToCutOffBegin;
117+
g_remote[writeCount].iov_len = g_local[writeCount].iov_len = totalWriteSize;
118+
119+
writeCount++;
120+
}
121+
}
122+
123+
process_vm_writev(csgo->GetPid(), g_local, writeCount, g_remote, writeCount, 0);
124+
}

hack.h

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#ifndef __HACK_H_
2+
#define __HACK_H_
3+
4+
#include <X11/Xlib.h>
5+
#include <X11/Xutil.h>
6+
7+
#include <X11/keysym.h>
8+
#include <X11/keysymdef.h>
9+
10+
#include <X11/extensions/XTest.h>
11+
12+
#include <chrono>
13+
#include <thread>
14+
#include <stddef.h>
15+
16+
#include "remote.h"
17+
#include "types.h"
18+
#include "logger.h"
19+
20+
using namespace std;
21+
22+
#define TEAM_SPECTATOR 1
23+
24+
#define LIFE_ALIVE 0 // alive
25+
#define LIFE_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
26+
#define LIFE_DEAD 2 // dead. lying still.
27+
#define LIFE_RESPAWNABLE 3
28+
#define LIFE_DISCARDBODY 4
29+
30+
#define MAX_TRAIL_LENGTH 30
31+
#define MAX_PLAYER_NAME_LENGTH 128
32+
33+
namespace hack {
34+
template<class T> class CUtlVector {
35+
public:
36+
T* DataPtr; // 0000 (054612C0)
37+
unsigned int Max; // 0004 (054612C4)
38+
unsigned int unk02; // 0008 (054612C8)
39+
unsigned int Count; // 000C (054612CC)
40+
unsigned int DataPtrBack; // 0010 (054612D0)
41+
};
42+
43+
struct GlowObjectDefinition_t {
44+
bool ShouldDraw( int nSlot ) const {
45+
return m_pEntity && ( m_nSplitScreenSlot == -1 || m_nSplitScreenSlot == nSlot ) && ( m_bRenderWhenOccluded || m_bRenderWhenUnoccluded );
46+
}
47+
48+
bool IsUnused() const {
49+
return m_nNextFreeSlot != GlowObjectDefinition_t::ENTRY_IN_USE;
50+
}
51+
52+
long writeStart() {
53+
return (long(&(this)->m_flGlowRed) - long(this));
54+
}
55+
56+
long writeEnd() {
57+
return (long(&(this)->unk2) - long(this));
58+
}
59+
60+
void* m_pEntity;
61+
float m_flGlowRed;
62+
float m_flGlowGreen;
63+
float m_flGlowBlue;
64+
float m_flGlowAlpha;
65+
uint8_t unk0[16];
66+
bool m_bRenderWhenOccluded : 8;
67+
bool m_bRenderWhenUnoccluded : 8;
68+
bool m_bFullBloomRender : 8;
69+
unsigned char unk1;
70+
int m_nFullBloomStencilTestValue;
71+
int m_nSplitScreenSlot;
72+
int m_nNextFreeSlot;
73+
unsigned char unk2[4];
74+
75+
static const int END_OF_FREE_LIST = -1;
76+
static const int ENTRY_IN_USE = -2;
77+
}; // sizeof() == 0x34
78+
79+
class CGlowObjectManager
80+
{
81+
public:
82+
CUtlVector<GlowObjectDefinition_t> m_GlowObjectDefinitions; // 0000
83+
int m_nFirstFreeSlot; // 0014 (054612D4)
84+
unsigned int unk1; // 0018 (054612D8)
85+
unsigned int unk2; // 001C (054612DC)
86+
unsigned int unk3; // 0020 (054612E0)
87+
unsigned int unk4; // 0024 (054612E4)
88+
unsigned int unk5; // 0028 (054612E8)
89+
};
90+
91+
92+
93+
extern void Glow(double colors[12], remote::Handle* csgo, remote::MapModuleMemoryRegion* client);
94+
extern void Bhop(remote::Handle* csgo, remote::MapModuleMemoryRegion* client, Display* display);
95+
};
96+
97+
#endif

logger.cpp

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#include "logger.h"
2+
3+
std::string g_cwd;
4+
5+
void Logger::init() {
6+
char cwd[PATH_MAX];
7+
8+
if (getcwd(cwd, PATH_MAX) == NULL) {
9+
g_cwd = "~";
10+
}
11+
12+
g_cwd = cwd;
13+
g_cwd.append("/");
14+
15+
#if LOGGER_CLEAR_ON_START
16+
std::ofstream file(g_cwd + "hack.log", std::ios::out | std::ios::app);
17+
// Clear the log file every time we start the hack
18+
file.clear ();
19+
#endif
20+
21+
normal ("Log path -> " + g_cwd);
22+
}
23+
24+
void Logger::Log (std::string str) {
25+
std::ofstream file(g_cwd + "hack.log", std::ios::out | std::ios::app);
26+
27+
str.append("\r\n");
28+
29+
if (file.good()) {
30+
file << str;
31+
}
32+
33+
file.close();
34+
}
35+
36+
void Logger::normal(std::string str) {
37+
Log (std::string("[LOG] ") + str);
38+
std::cout << LOG_TITLE << RESET << str << RESET << std::endl;
39+
}
40+
41+
void Logger::address (std::string str, unsigned long address) {
42+
std::stringstream ss;
43+
ss << std::hex << address;
44+
45+
Log (std::string("[ADDRESS] ") + str + ss.str ());
46+
std::cout << ADDRESS_TITLE << RESET << str << BOLD CYAN " [" MAGENTA "0x" << std::hex << address << CYAN "]" << RESET << std::endl;
47+
}
48+
49+
void Logger::warning (std::string str) {
50+
Log (std::string("[WARNING] ") + str);
51+
std::cout << ERROR_TITLE << YELLOW << str << RESET << std::endl;
52+
}
53+
54+
void Logger::toggle (std::string feature, bool enabled) {
55+
std::string endi = Endi (enabled);
56+
Log (std::string("[TOGGLE] ") + feature + " " + endi);
57+
std::cout << TOGGLE_TITLE << BOLD WHITE
58+
<< feature << RESET BOLD CYAN "[ " << (enabled ? GREEN : RED)
59+
<< endi << RESET BOLD << (enabled ? " " : " ") << CYAN << "]"
60+
<< RESET << std::endl;
61+
}
62+
63+
void Logger::error (std::string str) {
64+
Log (std::string("[ERROR] ") + str);
65+
66+
std::cout << ERROR_TITLE << RED << str << RESET << std::endl;
67+
}
68+
69+
std::string Logger::Endi (bool endi) {
70+
return endi ? "Enabled" : "Disabled";
71+
}

0 commit comments

Comments
 (0)