From d1ec3d3bb3a87a08e1c9348ca6e482549ebde664 Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 2 Jan 2019 17:46:05 +1300 Subject: fixed bug and idk i really dont wanna work on this anymore holy fuck --- cheat/internal_rewrite/extra.cpp | 9 ++++--- cheat/internal_rewrite/extra.hpp | 2 +- cheat/internal_rewrite/internal_rewrite.vcxproj | 2 +- csgo-loader/csgo-client/Client.cpp | 6 ++++- csgo-loader/csgo-client/Security/Encryption.cpp | 30 +++++++++++++++++++++- .../csgo-client/Security/SyscallManager.cpp | 4 +++ csgo-loader/csgo-server/Security/Encryption.cpp | 2 +- csgo-loader/csgo-server/Server.cpp | 7 ++--- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/cheat/internal_rewrite/extra.cpp b/cheat/internal_rewrite/extra.cpp index 2cffb39..66aba08 100644 --- a/cheat/internal_rewrite/extra.cpp +++ b/cheat/internal_rewrite/extra.cpp @@ -87,7 +87,7 @@ namespace features // emplace new record netchan_record_t record{ - g_csgo.m_globals->m_realtime, + g_csgo.m_globals->m_curtime, netchan->m_nInReliableState, netchan->m_nInSequenceNr }; @@ -99,7 +99,7 @@ namespace features // clear outdated records for( size_t i{ }; i < m_net_records.size( ); ++i ) { - const float delta = g_csgo.m_globals->m_realtime - m_net_records.at( i ).m_realtime; + const float delta = g_csgo.m_globals->m_curtime - m_net_records.at( i ).m_curtime; // 200ms is the max we can fake anyway.. // hnn this might be why it's so fucked :/ @@ -109,6 +109,9 @@ namespace features } void c_extra::add_latency( INetChannel* channel ) { + if(!g_settings.misc.net_fakelag()) + return; + auto nci = g_csgo.m_engine( )->GetNetChannelInfo( ); float in_latency = nci->GetLatency( 0 ); @@ -118,7 +121,7 @@ namespace features if( g_ctx.m_local && g_ctx.m_local->is_valid( ) ) { // god this is autistic for( auto& it : m_net_records ) { - const float delta = g_csgo.m_globals->m_realtime - it.m_realtime; + const float delta = g_csgo.m_globals->m_curtime - it.m_curtime; if( delta >= latency ) { // apply latency diff --git a/cheat/internal_rewrite/extra.hpp b/cheat/internal_rewrite/extra.hpp index 5c7d5f4..f3ab837 100644 --- a/cheat/internal_rewrite/extra.hpp +++ b/cheat/internal_rewrite/extra.hpp @@ -9,7 +9,7 @@ namespace features // i'm gay struct netchan_record_t { - float m_realtime; + float m_curtime; int32_t m_reliable; int32_t m_sequence; }; diff --git a/cheat/internal_rewrite/internal_rewrite.vcxproj b/cheat/internal_rewrite/internal_rewrite.vcxproj index f75393b..3d30b5a 100644 --- a/cheat/internal_rewrite/internal_rewrite.vcxproj +++ b/cheat/internal_rewrite/internal_rewrite.vcxproj @@ -46,7 +46,7 @@ 15.0 {140DEC51-B0E7-4289-BB6F-79686422318E} internal_rewrite - 10.0.17134.0 + 10.0.17763.0 csgo diff --git a/csgo-loader/csgo-client/Client.cpp b/csgo-loader/csgo-client/Client.cpp index 10e8012..52a288d 100644 --- a/csgo-loader/csgo-client/Client.cpp +++ b/csgo-loader/csgo-client/Client.cpp @@ -32,10 +32,12 @@ int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow) { - WRAP_IF_DEBUG(Utils::OpenConsole()); + (Utils::OpenConsole()); /////////////////////////////////////////////////////////////// + VMProtectBeginUltra("EntryPoint"); + /////////////////////////////////////////////////////////////// // Create a thread to handle UI. @@ -79,6 +81,8 @@ int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow) /////////////////////////////////////////////////////////////// + VMProtectEnd(); + /////////////////////////////////////////////////////////////// } diff --git a/csgo-loader/csgo-client/Security/Encryption.cpp b/csgo-loader/csgo-client/Security/Encryption.cpp index 6cf2f7f..00b0fee 100644 --- a/csgo-loader/csgo-client/Security/Encryption.cpp +++ b/csgo-loader/csgo-client/Security/Encryption.cpp @@ -144,6 +144,8 @@ namespace Wrapper ByteArray::size_type Aes256::encrypt_start(const ByteArray::size_type plain_length, ByteArray& encrypted) { + VMProtectBegin("AESEncryptStart"); + m_remainingLength = plain_length; // Generate salt @@ -168,6 +170,8 @@ namespace Wrapper // Reset buffer m_buffer_pos = 0; + VMProtectEnd(); + return encrypted.size(); } @@ -261,6 +265,8 @@ namespace Wrapper { unsigned char j; + VMProtectBegin("AESDecryptStart"); + m_remainingLength = encrypted_length; // Reset salt @@ -273,6 +279,8 @@ namespace Wrapper m_decryptInitialized = false; + VMProtectEnd(); + return m_remainingLength; } @@ -306,6 +314,8 @@ namespace Wrapper void Aes256::check_and_decrypt_buffer(ByteArray& plain) { + VMProtectBegin("AESDecryptBuffer"); + if(!m_decryptInitialized && m_buffer_pos == m_salt.size() + 1) { unsigned char j; @@ -337,6 +347,8 @@ namespace Wrapper m_buffer_pos = 0; } + + VMProtectEnd(); } ByteArray::size_type Aes256::decrypt_end(ByteArray& plain) @@ -372,6 +384,8 @@ namespace Wrapper { unsigned char i; + VMProtectBegin("AESExpandKey"); + m_rkey[0] = m_rkey[0] ^ sbox[m_rkey[29]] ^ (*rc); m_rkey[1] = m_rkey[1] ^ sbox[m_rkey[30]]; m_rkey[2] = m_rkey[2] ^ sbox[m_rkey[31]]; @@ -397,12 +411,16 @@ namespace Wrapper m_rkey[i + 2] = m_rkey[i + 2] ^ m_rkey[i - 2]; m_rkey[i + 3] = m_rkey[i + 3] ^ m_rkey[i - 1]; } + + VMProtectEnd(); } void Aes256::expand_dec_key(unsigned char* rc) { unsigned char i; + VMProtectBegin("AESExpandKey"); + for(i = 28; i > 16; i -= 4) { m_rkey[i + 0] = m_rkey[i + 0] ^ m_rkey[i - 4]; @@ -429,6 +447,8 @@ namespace Wrapper m_rkey[1] = m_rkey[1] ^ sbox[m_rkey[30]]; m_rkey[2] = m_rkey[2] ^ sbox[m_rkey[31]]; m_rkey[3] = m_rkey[3] ^ sbox[m_rkey[28]]; + + VMProtectEnd(); } void Aes256::sub_bytes(unsigned char* buffer) @@ -519,6 +539,8 @@ namespace Wrapper { unsigned char i, a, b, c, d, e; + VMProtectBeginUltra("AESMixColumn"); + for(i = 0; i < 16; i += 4) { a = buffer[i]; @@ -533,12 +555,16 @@ namespace Wrapper buffer[i + 2] ^= e ^ rj_xtime(c^d); buffer[i + 3] ^= e ^ rj_xtime(d^a); } + + VMProtectEnd(); } void Aes256::mix_columns_inv(unsigned char* buffer) { unsigned char i, a, b, c, d, e, x, y, z; + VMProtectBeginUltra("AESMixColumn"); + for(i = 0; i < 16; i += 4) { a = buffer[i]; @@ -555,6 +581,8 @@ namespace Wrapper buffer[i + 2] ^= x ^ rj_xtime(c^d); buffer[i + 3] ^= y ^ rj_xtime(d^a); } + + VMProtectEnd(); } inline unsigned char rj_xtime(unsigned char x) @@ -569,7 +597,7 @@ namespace Wrapper if(!CryptAcquireContextA(&m_CryptProvider, nullptr, nullptr, PROV_RSA_AES, 0)) { if(!CryptAcquireContextA(&m_CryptProvider, nullptr, nullptr, PROV_RSA_AES, CRYPT_NEWKEYSET)) - INFO_ASSERT(STR("Critical failure\nContact an admin with the following code: %08x"), GetLastError()); + INFO_ASSERT(STR("Critical failure\nContact an admin with the following code: 0x%08x"), GetLastError()); } uint8_t RandomBytes[32]; diff --git a/csgo-loader/csgo-client/Security/SyscallManager.cpp b/csgo-loader/csgo-client/Security/SyscallManager.cpp index 9bb1302..d6bace2 100644 --- a/csgo-loader/csgo-client/Security/SyscallManager.cpp +++ b/csgo-loader/csgo-client/Security/SyscallManager.cpp @@ -127,6 +127,8 @@ namespace Wrapper return false; // Loop each exported symbol. + VMProtectBeginUltra("SyscallFind"); + for(uint32_t n{}; n < ExportDirectory->NumberOfNames; ++n) { uint32_t NameRva = Names[n]; @@ -151,6 +153,8 @@ namespace Wrapper } } + VMProtectEnd(); + if(m_Syscalls.empty()) return false; diff --git a/csgo-loader/csgo-server/Security/Encryption.cpp b/csgo-loader/csgo-server/Security/Encryption.cpp index b42b4ab..e9195e5 100644 --- a/csgo-loader/csgo-server/Security/Encryption.cpp +++ b/csgo-loader/csgo-server/Security/Encryption.cpp @@ -570,7 +570,7 @@ namespace Wrapper { if(!CryptAcquireContextA(&m_CryptProvider, nullptr, nullptr, PROV_RSA_AES, CRYPT_NEWKEYSET)) { - printf("Failed to initialise encryption provider.\n"); + printf("[ E! ] Failed to initialise encryption provider (%08x).\n", GetLastError()); return; } } diff --git a/csgo-loader/csgo-server/Server.cpp b/csgo-loader/csgo-server/Server.cpp index eeeb2b3..580c17a 100644 --- a/csgo-loader/csgo-server/Server.cpp +++ b/csgo-loader/csgo-server/Server.cpp @@ -1,9 +1,6 @@ #include -void ConnectionHandler(Networking::TCPConnection &Connection) -{ - -} +void ConnectionHandler(Networking::TCPConnection &Connection) { } int __stdcall WinMain(HINSTANCE, HINSTANCE, char*, int) { @@ -26,7 +23,7 @@ int __stdcall WinMain(HINSTANCE, HINSTANCE, char*, int) } if(!Result) - printf("[ !! ] Failed to initialise server. (%08lx)\n", WSAGetLastError()); + printf("[ E! ] Failed to initialise server. (%08lx)\n", WSAGetLastError()); system("pause"); } \ No newline at end of file -- cgit v1.2.3