Welcome to hackvshack.net Forum!
Download Free HvH CS2/CS:GO Cheats, CFG, LUA/JS Scripts, and More!
Register

C++ Exploit Hide speaking in voice exploit release - credit to nucleargotbeamed

halapa

Rookie HvHer
User ID:
288129
Messages:
31
Reactions:
7
Badges:
4
REP:
−0/0+
Level:
37
Makes your name not show up when speaking in voice useful for trolling ig.
Sigs are likely outdated

Credit to someone on discord

#include "features/voice.h"
#include "core/config.h"
#include "core/keybinds.h"

#include "utils/memory.h"
#include "utils/pattern.h"

#include <MinHook.h>
#include <atomic>
#include <algorithm>
#include <array>

namespace voice {

using audiofn = char(*)(u64, u64, u64, int);
using encodefn = int(*)(void*, const float*, int, u8*, int);
static audiofn originalaudio = nullptr;
static encodefn originalencode = nullptr;
static u64 address = 0;
static u64 encodeaddress = 0;
static std::atomic<bool> stopping = false;
static ULONGLONG retry = 0;

static void patchlevel(u64 message) {
__try {
if (!inrange(message, 0x54) || *reinterpret_cast<int*>(message + 0x38) != 2)
return;
*reinterpret_cast<float*>(message + 0x50) = -90.f;
*reinterpret_cast<u32*>(message + 0x10) |= 0x80;
} __except (EXCEPTION_EXECUTE_HANDLER) {
}
}

static char hookedaudio(u64 message, u64 description, u64 data, int size) {
char result = originalaudio(message, description, data, size);
if (result && !stopping && keybinds::active(keybinds::voice))
patchlevel(message);
return result;
}

static int encode(void* encoder, const float* input, int frames, u8* output, int size) {
int gain = std::clamp(config.voicegain.load(), 1, 10);
if (stopping || gain == 1 || frames != 480 || !input)
return originalencode(encoder, input, frames, output, size);
std::array<float, 480> samples;
__try {
for (int i = 0; i < frames; i++) {
float sample = input[i];
samples[i] = std::isfinite(sample) ? std::clamp(sample * gain, -1.0f, 1.0f) : 0.0f;
}
} __except (EXCEPTION_EXECUTE_HANDLER) {
return originalencode(encoder, input, frames, output, size);
}
return originalencode(encoder, samples.data(), frames, output, size);
}

static bool installgain() {
HMODULE engine = GetModuleHandleA("engine2.dll");
auto found = engine ? GetProcAddress(engine, "opus_encode_float") : nullptr;
if (!found)
return false;
void* target = reinterpret_cast<void*>(found);
if (MH_CreateHook(target, reinterpret_cast<void*>(&encode), reinterpret_cast<void**>(&originalencode)) != MH_OK)
return false;
if (MH_EnableHook(target) != MH_OK) {
MH_RemoveHook(target);
originalencode = nullptr;
return false;
}
encodeaddress = reinterpret_cast<u64>(found);
return true;
}

static bool install() {
HMODULE client = GetModuleHandleA("client.dll");
u64 found = client ? findpattern(client, "40 53 56 48 83 EC 28 83 3A 00 4D 8B D8 4D 63 D1 48 8B F2 48 8B D9 0F 84 ? ? ? ?") : 0;
if (!found)
return false;
void* target = reinterpret_cast<void*>(found);
if (MH_CreateHook(target, reinterpret_cast<void*>(&hookedaudio), reinterpret_cast<void**>(&originalaudio)) != MH_OK)
return false;
if (MH_EnableHook(target) != MH_OK) {
MH_RemoveHook(target);
originalaudio = nullptr;
return false;
}
address = found;
return true;
}

void init() {
stopping = false;
run();
}

void run() {
if (stopping || GetTickCount64() < retry)
return;
retry = GetTickCount64() + 1000;
if (!address && config.voice)
install();
if (!encodeaddress && config.voicegain > 1)
installgain();
}

Pov
void shutdown() {
stopping = true;
if (address)
MH_DisableHook(reinterpret_cast<void*>(address));
if (encodeaddress)
MH_DisableHook(reinterpret_cast<void*>(encodeaddress));
}

}

Pov:
View attachment 369670.mp4
 
  • Like
Reactions: eythsdfh
Properly formatted:
C++:
Expand Collapse Copy
#include "features/voice.h"
#include "core/config.h"
#include "core/keybinds.h"
#include "utils/memory.h"
#include "utils/pattern.h"

#include <MinHook.h>
#include <atomic>
#include <algorithm>
#include <array>

namespace voice {

using audiofn = char(*)(u64, u64, u64, int);
using encodefn = int(*)(void*, const float*, int, u8*, int);
static audiofn originalaudio = nullptr;
static encodefn originalencode = nullptr;
static u64 address = 0;
static u64 encodeaddress = 0;
static std::atomic<bool> stopping = false;
static ULONGLONG retry = 0;

static void patchlevel(u64 message) {
    __try {
        if (!inrange(message, 0x54) || *reinterpret_cast<int*>(message + 0x38) != 2)
            return;
        *reinterpret_cast<float*>(message + 0x50) = -90.f;
        *reinterpret_cast<u32*>(message + 0x10) |= 0x80;
    } __except (EXCEPTION_EXECUTE_HANDLER) {
    }
}

static char hookedaudio(u64 message, u64 description, u64 data, int size) {
    char result = originalaudio(message, description, data, size);
    if (result && !stopping && keybinds::active(keybinds::voice))
        patchlevel(message);
    return result;
}

static int encode(void* encoder, const float* input, int frames, u8* output, int size) {
    int gain = std::clamp(config.voicegain.load(), 1, 10);
    if (stopping || gain == 1 || frames != 480 || !input)
        return originalencode(encoder, input, frames, output, size);
    std::array<float, 480> samples;
    __try {
        for (int i = 0; i < frames; i++) {
            float sample = input[i];
            samples[i] = std::isfinite(sample) ? std::clamp(sample * gain, -1.0f, 1.0f) : 0.0f;
        }
    } __except (EXCEPTION_EXECUTE_HANDLER) {
        return originalencode(encoder, input, frames, output, size);
    }
    return originalencode(encoder, samples.data(), frames, output, size);
}

static bool installgain() {
    HMODULE engine = GetModuleHandleA("engine2.dll");
    auto found = engine ? GetProcAddress(engine, "opus_encode_float") : nullptr;
    if (!found)
        return false;
    void* target = reinterpret_cast<void*>(found);
    if (MH_CreateHook(target, reinterpret_cast<void*>(&encode), reinterpret_cast<void**>(&originalencode)) != MH_OK)
        return false;
    if (MH_EnableHook(target) != MH_OK) {
        MH_RemoveHook(target);
        originalencode = nullptr;
        return false;
    }
    encodeaddress = reinterpret_cast<u64>(found);
    return true;
}

static bool install() {
    HMODULE client = GetModuleHandleA("client.dll");
    u64 found = client ? findpattern(client, "40 53 56 48 83 EC 28 83 3A 00 4D 8B D8 4D 63 D1 48 8B F2 48 8B D9 0F 84 ? ? ? ?") : 0;
    if (!found)
        return false;
    void* target = reinterpret_cast<void*>(found);
    if (MH_CreateHook(target, reinterpret_cast<void*>(&hookedaudio), reinterpret_cast<void**>(&originalaudio)) != MH_OK)
        return false;
    if (MH_EnableHook(target) != MH_OK) {
        MH_RemoveHook(target);
        originalaudio = nullptr;
        return false;
    }
    address = found;
    return true;
}

void init() {
    stopping = false;
    run();
}

void run() {
    if (stopping || GetTickCount64() < retry)
        return;
    retry = GetTickCount64() + 1000;
    if (!address && config.voice)
        install();
    if (!encodeaddress && config.voicegain > 1)
        installgain();
}

void shutdown() {
    stopping = true;
    if (address)
        MH_DisableHook(reinterpret_cast<void*>(address));
    if (encodeaddress)
        MH_DisableHook(reinterpret_cast<void*>(encodeaddress));
}

}
 
  • Like
Reactions: elycode