From f0424e31f233776a93d13caa98a4422385aedcd0 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 26 Nov 2018 21:49:09 +0000 Subject: fuck niggas --- client/client.vcxproj | 9 ++++-- client/client_windows.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++-- client/connect.hpp | 60 +++++++++++++++++++++++++++++++++----- client/strings.hpp | 2 +- 4 files changed, 130 insertions(+), 14 deletions(-) (limited to 'client') diff --git a/client/client.vcxproj b/client/client.vcxproj index 209390e..5fd04ba 100644 --- a/client/client.vcxproj +++ b/client/client.vcxproj @@ -31,7 +31,7 @@ {E877E475-A428-4FBC-AF71-378AFB92B706} Win32Proj client - 10.0.16299.0 + 10.0.17763.0 @@ -46,6 +46,7 @@ v141 true Unicode + false Application @@ -66,6 +67,7 @@ v141 true Unicode + false Application @@ -150,7 +152,7 @@ true true true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp17 @@ -186,8 +188,9 @@ true true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true + stdcpplatest true diff --git a/client/client_windows.cpp b/client/client_windows.cpp index 76bd776..77fb949 100644 --- a/client/client_windows.cpp +++ b/client/client_windows.cpp @@ -3,15 +3,44 @@ #include #include #include +#include #pragma comment( lib, "ws2_32.lib" ) #include "connect.hpp" +/* + 1. Connect + 2. Send hello message + 3. Receive hello message from server, + 4. Enter and send username + 5. Enter and send password + 6. Send and let server check hardware id. + 7. Recieve list of games. + 8. Select game and send to server + 9. Receive space of dll. + 10. Allocate space for dll. + 11. Send base address of dll. + 12. Server does relocations. + 13. Server sends dll + 14. Client Manual maps dll + 15. Send game module list and possibly PE headers + 16. Server sends back needed module base addresses and possibly size. + 17. Call DLLMain with correct parameters (Included Base Addresses) + 18. In cheat DLLMain set up base addresses and do cheat stuff. +*/ + + + + +// note below is just pseudo unprotected code... +// will make not retarded soon. int main( ) { - std::string ip; - std::cin >> ip; + // TEMPORARY, WE NEED TO ENCRYPT IP STRING SO WE DON'T HAVE DDOS NOOBS. + std::string ip = "192.168.0.8"; + // std::cin >> ip; + // START. client::c_connect c( ip.c_str( ) ); if( !c.setup( ) ) return 1; @@ -19,7 +48,42 @@ int main( ) { if( !c.connect( ) ) return 2; + c.send_msg( "hello" ); + + auto msg = c.get_string( ); + if ( msg != xors( "hello" ) ) { + std::cout << "connection failed." << std::endl; + return 0; + } + + std::string username{ }, password{ }; + std::cout << "Enter your username" << std::endl << "> "; + std::cin >> username; + + c.send_msg( username.c_str( ) ); + msg = c.get_string( ); + if ( msg != xors( "correct username" ) ) { + std::cout << "incorrect username" << std::endl; + return 0; // remember to close connection on server when bad values were sent. + } + + std::cout << "Enter your password" << std::endl << "> "; + std::cin >> password; + c.send_msg( password.c_str( ) ); + if ( c.get_string( ) != xors( "correct password" ) ) { + std::cout << "incorrect password"; + return 0; // remember to close connection on server when bad values were sent. + } + + + + + + + + + /* const char* yes = "hello server"; char buf[ 255 ]; memcpy( buf, yes, strlen( yes ) ); @@ -39,8 +103,11 @@ int main( ) { printf( "\n" ); c.send_msg( ( uint8_t* )( buf ), strlen( yes ) ); + */ + + // c.~c_connect( ); + - c.~c_connect( ); system( "pause" ); return 0; } diff --git a/client/connect.hpp b/client/connect.hpp index 8b36687..5720d4f 100644 --- a/client/connect.hpp +++ b/client/connect.hpp @@ -80,6 +80,31 @@ namespace client buf[ i ] ^= key; } + std::string get_string( ) { + std::string ret{ }; + char buffer[ BUFFER_SIZE ]; + + + while ( true ) { + int received = recv( m_socket, buffer, BUFFER_SIZE, 0 ); + if ( received < 0 ) + break; + + for ( int i{ }; i < received; ++i ) + ret.push_back( buffer[ i ] ); + + if ( received < BUFFER_SIZE ) + break; + } + + if ( ret.size( ) ) { + decode_buffer( ( uint8_t* )ret.data( ), ret.size( ) ); + ret.erase( ret.begin( ) ); + } + + return ret; + } + std::vector< uint8_t > get_msg( ) { std::vector< uint8_t > ret; char buffer[ BUFFER_SIZE ]; @@ -105,21 +130,42 @@ namespace client } void send_msg( const uint8_t* msg, size_t length ) { - auto new_buffer = ( uint8_t* )( malloc( length + 1 ) ); + auto buffer = std::make_unique< uint8_t[ ] >( length + 1 ); auto key = util::random_number( 0, 255 ) & 0xff; - new_buffer[ 0 ] = key; - memcpy( new_buffer + 1, + buffer[ 0 ] = key; + memcpy( buffer.get( ) + 1, msg, length ); - for( size_t i = 1; i < length + 1; ++i ) { - new_buffer[ i ] ^= key; + for( size_t i = 1; i <= length; ++i ) { + buffer[ i ] ^= key; } - send( m_socket, ( char* )new_buffer, length + 1, 0 ); + int ret = send( m_socket, ( char* )buffer.get( ), length + 1, 0 ); + if ( ret == SOCKET_ERROR ) { + printf( xors( "error sending message error code: %d" ), WSAGetLastError( ) ); + } + } + + void send_msg( const char* msg ) { + auto length = strlen( msg ); + auto buffer = std::make_unique< uint8_t[ ] >( length + 1 ); + auto key = util::random_number( 0, 255 ) & 0xff; - free( new_buffer ); + buffer[ 0 ] = key; + memcpy( buffer.get( ) + 1, + msg, + length ); + + for ( size_t i = 1; i <= length; ++i ) { + buffer[ i ] ^= key; + } + + int ret = send( m_socket, ( char* )buffer.get( ), length + 1, 0 ); + if ( ret == SOCKET_ERROR ) { + printf( xors( "error sending message error code: %d" ), WSAGetLastError( ) ); + } } private: diff --git a/client/strings.hpp b/client/strings.hpp index 382ddb2..b5dba75 100644 --- a/client/strings.hpp +++ b/client/strings.hpp @@ -152,7 +152,7 @@ constexpr size_t strlen_ct( const char* const str ) { return out; } -#if 0 +#if TRUE #define xors_raw( s ) ( strenc::XorString< strenc::strlen_ct( s ), __COUNTER__ >( s, std::make_index_sequence< sizeof( s ) - 1>() ) ) #define xors( s ) ( strenc::XorString< strenc::strlen_ct( s ), __COUNTER__ >( s, std::make_index_sequence< sizeof( s ) - 1>() ).decrypt() ) #else -- cgit v1.2.3