FIX Spam, HWID DRM!
This commit is contained in:
parent
fc6a5dda2c
commit
fc52c41ebf
@ -1,6 +1,6 @@
|
||||
CC=g++
|
||||
CFLAGS=-std=c++1y -DTF2 -O3 -w -c -shared -Wall -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC
|
||||
CFLAGS+=-D__DRM_STEAMID='$(DRM_STEAMID)' -D__DRM_NAME='"$(DRM_NAME)"' -D__DRM_EXPIRES='$(DRM_EXPIRES)' -D__DRM_STEAMID_S='"$(DRM_STEAMID)"'
|
||||
CFLAGS+=-D__DRM_HWID_0='$(HWID_0)' -D__DRM_HWID_1='$(HWID_1)' -D__DRM_HWID_2='$(HWID_2)' -D__DRM_HWID_3='$(HWID_3)' -D__DRM_NAME='"$(DRM_NAME)"' -D__DRM_EXPIRES='$(DRM_EXPIRES)'
|
||||
CINCLUDES=-I../../ssdk/public -I../../ssdk/mathlib -I../../ssdk/common -I../../ssdk/public/tier1 -I../../ssdk/public/tier0
|
||||
LDFLAGS=-m32 -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=0 -shared
|
||||
LDLIBS=-Bstatic -lvstdlib -lstdc++ -lc -ltier0
|
||||
|
@ -8,8 +8,6 @@
|
||||
#ifndef DRM_H_
|
||||
#define DRM_H_
|
||||
|
||||
//#include "autogen/autogen.h"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#ifndef __DRM_ENABLED
|
||||
@ -19,47 +17,46 @@
|
||||
|
||||
#define __QUIT_SEGV (*((int*)0) = 0)
|
||||
|
||||
#if __DRM_STEAMID == 76561198307538553 || __DRM_ENABLED == false //TODO!!
|
||||
#if __DRM_ENABLED == false
|
||||
#define _DEVELOPER true
|
||||
#else
|
||||
#define _DEVELOPER false
|
||||
#endif
|
||||
|
||||
#ifndef __DRM_STEAMID
|
||||
#define __DRM_STEAMID 0
|
||||
#define __DRM_STEAMID_S "UNDEFINED"
|
||||
#ifndef __DRM_HWID_0
|
||||
#define __DRM_HWID_0 0x7fa8d247bb8389e7
|
||||
#define __DRM_HWID_1 0x08ebdb1cdb642f0e
|
||||
#define __DRM_HWID_2 0xf571eeb0c17a0aed
|
||||
#define __DRM_HWID_3 0x20cea01f36f359ac
|
||||
#endif
|
||||
|
||||
#ifndef __DRM_EXPIRES
|
||||
#define __DRM_EXPIRES 0
|
||||
#endif
|
||||
#ifndef __DRM_BUILDNUMBER
|
||||
#define __DRM_BUILDNUMBER 0
|
||||
#define __DRM_BUILDNUMBER_MAX 0
|
||||
#endif
|
||||
#ifndef __DRM_NAME
|
||||
#define __DRM_NAME "UNDEFINED"
|
||||
#endif
|
||||
|
||||
#if __DRM_ENABLED != false
|
||||
#define DRM_CHECK_STEAM __DRM_STEAM
|
||||
#define DRM_CHECK_HWID __DRM_HWID
|
||||
#define DRM_CHECK_EXPIRE __DRM_EXPIRE
|
||||
#define DRM_CHECK_ENGINE __DRM_ENGINE
|
||||
#define DRM_ENFORCE __DRM_ENFORCE
|
||||
#else
|
||||
#define DRM_CHECK_STEAM
|
||||
#define DRM_CHECK_HWID
|
||||
#define DRM_CHECK_EXPIRE
|
||||
#define DRM_CHECK_ENGINE
|
||||
#define DRM_ENFORCE
|
||||
#endif
|
||||
|
||||
#define __DRM_RAND_0 548285
|
||||
#define __DRM_RAND(a, b) ((__DRM_RAND_##a << b) & 1)
|
||||
|
||||
#define __DRM_STEAM (__DRM_RAND(0, 0) ? __DRM_STEAMID != __DRM_STEAM_GET_UINT64_1 : __DRM_STEAMID != __DRM_STEAM_GET_UINT64_2)
|
||||
#define __DRM_STEAM_GET_USER (interfaces::user)
|
||||
#define __DRM_STEAM_GET_UINT64_1 __DRM_STEAM_GET_UINT64_2//(reinterpret_cast<unsigned long long>(__DRM_STEAM_GET_USER->GetSteamID()))
|
||||
#define __DRM_STEAM_GET_UINT64_2 (__DRM_STEAM_GET_USER->GetSteamID().ConvertToUint64())
|
||||
|
||||
#if __DRM_HWID_0 == 0
|
||||
#define __DRM_HWID false
|
||||
#else
|
||||
#define __DRM_HWID !(hwid::check_hwid(__DRM_HWID_0, __DRM_HWID_1, __DRM_HWID_2, __DRM_HWID_3))
|
||||
#endif
|
||||
#if __DRM_EXPIRES == 0
|
||||
#define __DRM_EXPIRE false
|
||||
#else
|
||||
@ -68,9 +65,9 @@
|
||||
#if __DRM_BUILDNUMBER == 0
|
||||
#define __DRM_ENGINE false
|
||||
#else
|
||||
#define __DRM_EXPIRE true
|
||||
#define __DRM_ENGINE true
|
||||
#endif
|
||||
|
||||
#define __DRM_ENFORCE if (DRM_CHECK_STEAM || DRM_CHECK_EXPIRE || DRM_CHECK_ENGINE) __QUIT_SEGV
|
||||
#define __DRM_ENFORCE if (DRM_CHECK_EXPIRE || DRM_CHECK_ENGINE || DRM_CHECK_HWID) __QUIT_SEGV
|
||||
|
||||
#endif /* DRM_H_ */
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "common.h"
|
||||
#include "sharedobj.h"
|
||||
#include "hooks.h"
|
||||
#include "hwid.h"
|
||||
#include "netmessage.h"
|
||||
#include "targeting/ITargetSystem.h"
|
||||
#include "profiler.h"
|
||||
@ -83,7 +84,7 @@ void hack::CC_Cat(const CCommand& args) {
|
||||
#if _DEVELOPER
|
||||
interfaces::cvar->ConsoleColorPrintf(colors::red, "[DEVELOPER BUILD]\n");
|
||||
#endif
|
||||
interfaces::cvar->ConsoleColorPrintf(colors::red, "Build for user " __DRM_NAME " (" __DRM_STEAMID_S ") (Early Access)\n");
|
||||
interfaces::cvar->ConsoleColorPrintf(colors::red, "Build for user " __DRM_NAME " (Early Access)\n");
|
||||
#ifdef __DRM_NOTES
|
||||
interfaces::cvar->ConsoleColorPrintf(colors::red, "Build notes: " __DRM_NOTES "\n");
|
||||
#endif
|
||||
@ -93,6 +94,10 @@ void hack::Initialize() {
|
||||
logging::Initialize();
|
||||
srand(time(0));
|
||||
prctl(PR_SET_DUMPABLE,0,42,42,42);
|
||||
hwid::unpack_strings();
|
||||
hwid::read_hwid_fstab();
|
||||
hwid::read_hwid_machineid();
|
||||
hwid::compute_result();
|
||||
logging::Info("Build: " __DATE__ " " __TIME__);
|
||||
logging::Info("Loading shared objects...");
|
||||
sharedobj::LoadAllSharedObjects();
|
||||
|
@ -27,6 +27,7 @@ Spam::Spam() {
|
||||
bool Spam::CreateMove(void*, float, CUserCmd*) {
|
||||
if (!v_bSpam->GetBool()) return true;
|
||||
if (interfaces::gvars->curtime - m_fLastSpam < 0.8f) return true;
|
||||
if (interfaces::gvars->curtime < m_fLastSpam) m_fLastSpam = 0.0f;
|
||||
if (m_nSpam == 0) return true;
|
||||
if (m_iCurrentIndex >= m_nSpam || m_iCurrentIndex >= SPAM_MAX_AMOUNT) m_iCurrentIndex = 0;
|
||||
char* spam = 0;
|
||||
@ -47,9 +48,12 @@ void Spam::LevelInit(const char*) {
|
||||
}
|
||||
|
||||
void Spam::PaintTraverse(void*, unsigned int, bool, bool) {}
|
||||
void Spam::LevelShutdown() {}
|
||||
void Spam::LevelShutdown() {
|
||||
m_fLastSpam = 0.0f;
|
||||
}
|
||||
|
||||
void Spam::LoadFile() {
|
||||
m_fLastSpam = 0.0f;
|
||||
uid_t uid = geteuid();
|
||||
passwd* pw = getpwuid(uid);
|
||||
if (!pw) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "../netmessage.h"
|
||||
#include "../gui/gui.h"
|
||||
#include "../hack.h"
|
||||
#include "../hwid.h"
|
||||
#include "hookedmethods.h"
|
||||
|
||||
bool CanPacket_hook(void* thisptr) {
|
||||
@ -63,7 +64,6 @@ void Shutdown_hook(void* thisptr, const char* reason) {
|
||||
|
||||
void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
SEGV_BEGIN;
|
||||
DRM_ENFORCE;
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
// Ambassador to festive ambassador changer. simple.
|
||||
if (!interfaces::engineClient->IsInGame()) g_Settings.bInvalid = true;
|
||||
@ -192,6 +192,7 @@ bool DispatchUserMessage_hook(void* thisptr, int type, bf_read& buf) {
|
||||
|
||||
void LevelInit_hook(void* thisptr, const char* newmap) {
|
||||
((LevelInit_t*) hooks::hkClientMode->GetMethod(hooks::offLevelInit))(thisptr, newmap);
|
||||
DRM_ENFORCE;
|
||||
logging::Info("LevelInit %s", newmap);
|
||||
LEVEL_INIT(Aimbot, newmap);
|
||||
LEVEL_INIT(Airstuck, newmap);
|
||||
|
107
cathook/src/hwid.cpp
Normal file
107
cathook/src/hwid.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/*
|
||||
* hwid.cpp
|
||||
*
|
||||
* Created on: Jan 22, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "hwid.h"
|
||||
#include <stdio.h>
|
||||
|
||||
unsigned char hwid::up_machineid[16] = { 0 };
|
||||
unsigned char hwid::up_fstab[11] = { 0 };
|
||||
__u32 hwid::hwid_machine[4] = { 0 };
|
||||
__u32 hwid::hwid_fstab[4] = { 0 };
|
||||
__u32 hwid::hwid_result[8] = { 0 };
|
||||
|
||||
void hwid::unpack_strings() {
|
||||
for (int i = 0; i < 15; i++) hwid::up_machineid[i] = hwid::xorstring_machineid[i] ^ hwid::xorkey_machineid[i];
|
||||
for (int i = 0; i < 10; i++) hwid::up_fstab[i] = hwid::xorstring_fstab[i] ^ hwid::xorkey_fstab[i];
|
||||
}
|
||||
|
||||
void hwid::read_hwid_machineid() {
|
||||
using namespace hwid;
|
||||
FILE* handle = fopen((const char*)up_machineid, "r");
|
||||
unsigned char nibbles[32];
|
||||
for (int i = 0; i < 32; i++) {
|
||||
char a = fgetc(handle);
|
||||
nibbles[i] = CHAR_TO_NIBBLE(a);
|
||||
}
|
||||
unsigned char bytes[16];
|
||||
for (int i = 0; i < 16; i++) {
|
||||
bytes[i] = (nibbles[i * 2] << 4 | nibbles[i * 2 + 1]);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
hwid_machine[i] = machineid_key[i] ^ (
|
||||
((bytes[i * 4] << 24)) |
|
||||
((bytes[i * 4 + 1] << 16)) |
|
||||
((bytes[i * 4 + 2] << 8)) |
|
||||
((bytes[i * 4 + 3])));
|
||||
}
|
||||
fclose(handle);
|
||||
}
|
||||
|
||||
void hwid::read_hwid_fstab() {
|
||||
FILE* handle = fopen((const char*)up_fstab, "r");
|
||||
char buf[256];
|
||||
while (fgets(buf, 256, handle)) {
|
||||
if (buf[0] == 'U') {
|
||||
unsigned char nibbles[32] = { 0 };
|
||||
int nnibbles = 0;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
char a = buf[5 + i];
|
||||
if (a == '-') continue;
|
||||
if (a == ' ') break;
|
||||
nibbles[nnibbles++] = CHAR_TO_NIBBLE(a);
|
||||
}
|
||||
unsigned char bytes[16];
|
||||
for (int i = 0; i < 16; i++) {
|
||||
bytes[i] = (nibbles[i * 2] << 4 | nibbles[i * 2 + 1]);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
hwid_fstab[i] = fstab_key[i] ^ (
|
||||
((bytes[i * 4] << 24)) |
|
||||
((bytes[i * 4 + 1] << 16)) |
|
||||
((bytes[i * 4 + 2] << 8)) |
|
||||
((bytes[i * 4 + 3])));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hwid::compute_result() {
|
||||
hwid_result[0] = (hwid_fstab[0] ^ hwid_machine[1]) - hwid_fstab[3];
|
||||
hwid_result[1] = hwid_fstab[3] % hwid_machine[3] + hwid_machine[1];
|
||||
hwid_result[2] = hwid_fstab[1] + hwid_machine[2];
|
||||
hwid_result[3] = hwid_fstab[2] ^ hwid_machine[1] * hwid_fstab[0];
|
||||
hwid_result[4] = hwid_fstab[2] ^ (hwid_machine[0] + hwid_fstab[2]);
|
||||
hwid_result[5] = hwid_fstab[3] % hwid_machine[0];
|
||||
hwid_result[6] = hwid_fstab[0] ^ (hwid_machine[2] + hwid_machine[0]);
|
||||
hwid_result[7] = hwid_fstab[1] * hwid_machine[1];
|
||||
for (int i = 0; i < 8; i++) hwid_result[i] ^= result_key[i];
|
||||
}
|
||||
|
||||
#if USER_KEYS == true
|
||||
|
||||
bool hwid::check_hwid(__u64* user) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((((__u64)hwid_result[i * 2] << 32 | (__u64)hwid_result[i * 2 + 1]) ^ user_key[i]) != user[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hwid::check_hwid(__u64 a, __u64 b, __u64 c, __u64 d) {
|
||||
__u64 user[4] = { a, b, c, d };
|
||||
return check_hwid(user);
|
||||
}
|
||||
|
||||
void hwid::create_hwid(__u64* result, __u32* source) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
result[i] = (((__u64)source[i * 2] << 32 | (__u64)source[i * 2 + 1]) ^ user_key[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
63
cathook/src/hwid.h
Normal file
63
cathook/src/hwid.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* hwid.h
|
||||
*
|
||||
* Created on: Jan 22, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifndef HWID_H_
|
||||
#define HWID_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#define USER_KEYS true
|
||||
|
||||
#define CHAR_TO_NIBBLE(x) \
|
||||
(x >= 'a' && x <= 'f') ? (x - 'a' + 0xA) : ((x >= '0' && x <= '9') ? (x - '0') : (0))
|
||||
|
||||
namespace hwid {
|
||||
|
||||
const __u32 machineid_key[] = {
|
||||
0x2ea03063, 0x20a52253,
|
||||
0x0e086f22, 0x3e3bc4db };
|
||||
|
||||
const __u32 fstab_key[] = {
|
||||
0xAC5D8791, 0x6EFD749C,
|
||||
0x5DEC7286, 0xE0A56284 };
|
||||
|
||||
const __u32 result_key[] = {
|
||||
0xC89207A6, 0x0A5F9418, 0x376B9DC8, 0xEC201BFD,
|
||||
0x5A937048, 0xC89A3DBE, 0xB570C6E8, 0xC314827F
|
||||
};
|
||||
|
||||
#if USER_KEYS == true
|
||||
const __u64 user_key[] = {
|
||||
0x5DA1379C9AFC762Ellu, 0xEB584AC0EAD17528llu,
|
||||
0x847A291317E5F2C8llu, 0x1EDA6F907ADC52B1llu };
|
||||
#endif
|
||||
|
||||
const volatile unsigned char xorstring_machineid[] = { 0x2E, 0xAF, 0x67, 0x97, 0xE2, 0x40, 0xD1, 0xC4, 0xA5, 0x58, 0x9C, 0x45, 0x76, 0x48, 0x5F };
|
||||
const volatile unsigned char xorstring_fstab[] = { 0x7C, 0xD4, 0x69, 0xFB, 0x15, 0xB6, 0x02, 0x31, 0xA1, 0x50 };
|
||||
const volatile unsigned char xorkey_machineid[] = { 0x01, 0xca, 0x13, 0xf4, 0xcd, 0x2d, 0xb0, 0xa7, 0xcd, 0x31, 0xf2, 0x20, 0x5b, 0x21, 0x3b };
|
||||
const volatile unsigned char xorkey_fstab[] = { 0x53, 0xb1, 0x1d, 0x98, 0x3a, 0xd0, 0x71, 0x45, 0xc0, 0x32 };
|
||||
|
||||
extern unsigned char up_machineid[16];
|
||||
extern unsigned char up_fstab[11];
|
||||
|
||||
extern __u32 hwid_machine[4];
|
||||
extern __u32 hwid_fstab[4];
|
||||
extern __u32 hwid_result[8];
|
||||
|
||||
void unpack_strings();
|
||||
void read_hwid_machineid();
|
||||
void read_hwid_fstab();
|
||||
void compute_result();
|
||||
#if USER_KEYS == true
|
||||
bool check_hwid(__u64*);
|
||||
bool check_hwid(__u64, __u64, __u64, __u64);
|
||||
void create_hwid(__u64*, __u32*);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif /* HWID_H_ */
|
Reference in New Issue
Block a user