Исходник SendNetMsg for supremacy

Участник
Статус
Оффлайн
Регистрация
6 Апр 2021
Сообщения
343
Реакции[?]
216
Поинты[?]
122K
Код:
I wont support you with help with crashes, errors, you have to handle them yourself!
First of all you have to include minhook:

After you included minhook go into hooks.h and paste this

struct Voice_Vader
{
    char cheat_name[25];
    int make_sure;
    const char* username;
};

namespace nem_hooks {
    using SendNetMsgFn = bool( __thiscall* )( INetChannel* pNetChan, INetMessage& msg, bool bForceReliable, bool bVoice );
    inline SendNetMsgFn oSendNetMsg;
    bool __fastcall SendNetMsg( INetChannel* pNetChan, void* edx, INetMessage& msg, bool bForceReliable, bool bVoice );
}

After you pasted this go into hooks.cpp and paste this function

struct VoiceDataCustom
{
    uint32_t xuid_low{};
    uint32_t xuid_high{};
    int32_t sequence_bytes{};
    uint32_t section_number{};
    uint32_t uncompressed_sample_offset{};

    __forceinline uint8_t* get_raw_data( )
    {
        return ( uint8_t* )this;
    }
};

struct CCLCMsg_VoiceData_Legacy
{
    uint32_t INetMessage_Vtable; //0x0000
    char pad_0004[ 4 ]; //0x0004
    uint32_t CCLCMsg_VoiceData_Vtable; //0x0008
    char pad_000C[ 8 ]; //0x000C
    void* data; //0x0014
    uint32_t xuid_low{};
    uint32_t xuid_high{};
    int32_t format; //0x0020
    int32_t sequence_bytes; //0x0024
    uint32_t section_number; //0x0028
    uint32_t uncompressed_sample_offset; //0x002C
    int32_t cached_size; //0x0030

    uint32_t flags; //0x0034

    uint8_t no_stack_overflow[ 0xFF ];

    __forceinline void set_data( VoiceDataCustom* cdata )
    {
        xuid_low = cdata->xuid_low;
        xuid_high = cdata->xuid_high;
        sequence_bytes = cdata->sequence_bytes;
        section_number = cdata->section_number;
        uncompressed_sample_offset = cdata->uncompressed_sample_offset;
    }
};

struct lame_string_t

{
    char data[ 16 ]{};
    uint32_t current_len = 0;
    uint32_t max_len = 15;
};


struct CIncomingSequence {
    int InSequence;
    int ReliableState;
};

std::vector<CIncomingSequence> IncomingSequences;
#include "scan.hpp"
#include "backend/config/config_new.h"

int lastsent = 0;
bool __fastcall nem_hooks::SendNetMsg( INetChannel* pNetChan, void* edx, INetMessage& msg, bool bForceReliable, bool bVoice ) {
    if ( pNetChan != g_csgo.m_engine->GetNetChannelInfo( ) )
    return oSendNetMsg( pNetChan, msg, bForceReliable, bVoice );

    if ( msg.GetType( ) == 14 ) // Return and don't send messsage if its FileCRCCheck
        return false;

    if ( msg.GetGroup( ) == 11 ) {
#if defined(REL_)
        constexpr int EXPIRE_DURATION = 5000; // miliseconds-ish?
        bool should_send = GetTickCount( ) - lastsent > EXPIRE_DURATION;
        if ( should_send ) {
            Voice_Vader packet;
            strcpy( packet.cheat_name, xorstr_( "deathmesis.user" ) );
            packet.make_sure = 1;
            //packet.username = g_Vars.globals.c_username.c_str( );
            VoiceDataCustom data;
            memcpy( data.get_raw_data( ), &packet, sizeof( packet ) );

            CCLCMsg_VoiceData_Legacy msg;
            memset( &msg, 0, sizeof( msg ) );

            static DWORD m_construct_voice_message = ( DWORD )Memory::Scan( ( "engine.dll" ), ( "56 57 8B F9 8D 4F 08 C7 07 ? ? ? ? E8 ? ? ? ? C7" ) );

            auto func = ( uint32_t( __fastcall* )( void*, void* ) )m_construct_voice_message;
            func( ( void* )&msg, nullptr );

            // set our data
            msg.set_data( &data );

            // mad!
            lame_string_t lame_string;

            // set rest
            msg.data = &lame_string;
            msg.format = 0; // VoiceFormat_Steam
            msg.flags = 63; // all flags!

            // send it
            oSendNetMsg( pNetChan, ( INetMessage& )msg, false, true );

            lastsent = GetTickCount( );
        }
#endif

    }
    else if ( msg.GetGroup( ) == 9 ) { // group 9 is VoiceData
        // Fixing fakelag with voice
        bVoice = true;
        cfg::g_cfg->voide_data = true;
    }
    else
        cfg::g_cfg->voide_data = false;

    return oSendNetMsg( pNetChan, msg, bForceReliable, bVoice );
}

To hook this go into hooks.cpp
void Hooks::init( ) {
    MH_Initialize( );
    MH_CreateHook( pattern::find( PE::GetModule( HASH( "engine.dll" ) ), XOR( "55 8B EC 56 8B F1 8B 86 ? ? ? ? 85 C0 74 24 48 83 F8 02 77 2C 83 BE ? ? ? ? ? 8D 8E ? ? ? ? 74 06 32 C0 84 C0 EB 10 E8 ? ? ? ? 84 C0 EB 07 83 BE ? ? ? ? ? 0F 94 C0 84 C0 74 07 B0 01 5E 5D C2 0C 00" ) ), &nem_hooks::SendNetMsg, reinterpret_cast< void** >( &nem_hooks::oSendNetMsg ) );
    MH_EnableHook( MH_ALL_HOOKS );
}
scan.hpp:
#pragma once
#include "includes.h"

namespace Memory
{

    std::uintptr_t Scan( const std::string& image_name, const std::string& signature );

}
scan.cpp:
#include "scan.hpp"
#define IS_IN_RANGE( value, max, min ) ( value >= max && value <= min )
#define GET_BITS( value ) ( IS_IN_RANGE( value, '0', '9' ) ? ( value - '0' ) : ( ( value & ( ~0x20 ) ) - 'A' + 0xA ) )
#define GET_BYTE( value ) ( GET_BITS( value[0] ) << 4 | GET_BITS( value[1] ) )

namespace Memory
{

    std::uintptr_t Scan( const std::string& image_name, const std::string& signature )
    {
        auto image = GetModuleHandleA( image_name.c_str( ) );

        if ( !image )
        {

            return 0u;
        }

        auto image_base = ( std::uintptr_t )( image );
        auto image_dos_hdr = ( IMAGE_DOS_HEADER* )( image_base );

        if ( image_dos_hdr->e_magic != IMAGE_DOS_SIGNATURE )
        {

            return 0u;
        }

        auto image_nt_hdrs = ( IMAGE_NT_HEADERS* )( image_base + image_dos_hdr->e_lfanew );

        if ( image_nt_hdrs->Signature != IMAGE_NT_SIGNATURE )
        {

            return 0u;
        }

        auto scan_begin = ( std::uint8_t* )( image_base );
        auto scan_end = ( std::uint8_t* )( image_base + image_nt_hdrs->OptionalHeader.SizeOfImage );

        std::uint8_t* scan_result = nullptr;
        std::uint8_t* scan_data = ( std::uint8_t* )( signature.c_str( ) );

        for ( auto current = scan_begin; current < scan_end; current++ )
        {
            if ( *( std::uint8_t* )scan_data == '\?' || *current == GET_BYTE( scan_data ) )
            {
                if ( !scan_result )
                    scan_result = current;

                if ( !scan_data[ 2 ] )
                    return ( std::uintptr_t )( scan_result );

                scan_data += ( *( std::uint16_t* )scan_data == '\?\?' || *( std::uint8_t* )scan_data != '\?' ) ? 3 : 2;

                if ( !*scan_data )
                    return ( std::uintptr_t )( scan_result );
            }
            else if ( scan_result )
            {
                current = scan_result;
                scan_data = ( std::uint8_t* )( signature.c_str( ) );
                scan_result = nullptr;
            }
        }



        return 0u;
    }

    std::uintptr_t Scan( const DWORD base_addr, const std::string& signature )
    {
        if ( !base_addr )
        {

            return 0u;
        }

        auto image_base = ( std::uintptr_t )( base_addr );
        auto image_dos_hdr = ( IMAGE_DOS_HEADER* )( image_base );

        if ( image_dos_hdr->e_magic != IMAGE_DOS_SIGNATURE )
        {

            return 0u;
        }

        auto image_nt_hdrs = ( IMAGE_NT_HEADERS* )( image_base + image_dos_hdr->e_lfanew );

        if ( image_nt_hdrs->Signature != IMAGE_NT_SIGNATURE )
        {

            return 0u;
        }

        auto scan_begin = ( std::uint8_t* )( image_base );
        auto scan_end = ( std::uint8_t* )( image_base + image_nt_hdrs->OptionalHeader.SizeOfImage );

        std::uint8_t*scan_result = nullptr;
        std::uint8_t* scan_data = ( std::uint8_t* )( signature.c_str( ) );

        for ( auto current = scan_begin; current < scan_end; current++ )
        {
            if ( *( std::uint8_t* )scan_data == '\?' || *current == GET_BYTE( scan_data ) )
            {
                if ( !scan_result )
                    scan_result = current;

                if ( !scan_data[ 2 ] )
                    return ( std::uintptr_t )( scan_result );

                scan_data += ( *( std::uint16_t* )scan_data == '\?\?' || *( std::uint8_t* )scan_data != '\?' ) ? 3 : 2;

                if (!*scan_data)
                    return ( std::uintptr_t )( scan_result );
            }
            else if (scan_result)
            {
                current = scan_result;
                scan_data = ( std::uint8_t* )( signature.c_str( ) );
                scan_result = nullptr;
            }
        }



        return 0u;
    }

}
 
Последнее редактирование:
Сверху Снизу