diff options
| -rw-r--r-- | client/client.vcxproj | 9 | ||||
| -rw-r--r-- | client/client_windows.cpp | 73 | ||||
| -rw-r--r-- | client/connect.hpp | 60 | ||||
| -rw-r--r-- | client/strings.hpp | 2 | ||||
| -rw-r--r-- | internal_rewrite/internal_rewrite.vcxproj | 7 | ||||
| -rw-r--r-- | internal_rewrite/ragebot_antiaim.cpp | 6 | ||||
| -rw-r--r-- | internal_rewrite/settings.hpp | 1 | ||||
| -rw-r--r-- | internal_rewrite/ui.h | 1 | ||||
| -rw-r--r-- | server/client.cpp | 49 | ||||
| -rw-r--r-- | server/client.hpp | 2 | ||||
| -rw-r--r-- | server/server.cpp | 20 | ||||
| -rw-r--r-- | server/server.hpp | 3 | ||||
| -rw-r--r-- | server/server.vcxproj | 3 | ||||
| -rw-r--r-- | server/server_windows.cpp | 2 |
14 files changed, 208 insertions, 30 deletions
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 @@ <ProjectGuid>{E877E475-A428-4FBC-AF71-378AFB92B706}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>client</RootNamespace>
- <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -46,6 +46,7 @@ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
+ <SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='pHit|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -66,6 +67,7 @@ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
+ <SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='pHit|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@@ -150,7 +152,7 @@ <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions> _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
@@ -186,8 +188,9 @@ <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
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 <stdlib.h>
#include <string.h>
#include <iostream>
+#include <winternl.h>
#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
diff --git a/internal_rewrite/internal_rewrite.vcxproj b/internal_rewrite/internal_rewrite.vcxproj index e961825..ec68f0f 100644 --- a/internal_rewrite/internal_rewrite.vcxproj +++ b/internal_rewrite/internal_rewrite.vcxproj @@ -46,7 +46,7 @@ <VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{140DEC51-B0E7-4289-BB6F-79686422318E}</ProjectGuid>
<RootNamespace>internal_rewrite</RootNamespace>
- <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<ProjectName>moneybot</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
@@ -82,6 +82,7 @@ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
+ <SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
@@ -300,6 +301,7 @@ <PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.hpp</PrecompiledHeaderFile>
<ExceptionHandling>false</ExceptionHandling>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
@@ -330,11 +332,12 @@ <RuntimeTypeInfo>false</RuntimeTypeInfo>
<LanguageStandard>stdcpplatest</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>false</GenerateDebugInformation>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
diff --git a/internal_rewrite/ragebot_antiaim.cpp b/internal_rewrite/ragebot_antiaim.cpp index bb9507f..beff445 100644 --- a/internal_rewrite/ragebot_antiaim.cpp +++ b/internal_rewrite/ragebot_antiaim.cpp @@ -550,6 +550,12 @@ namespace features }
aim_angle.y -= 180.f;
}
+ else {
+ int jitter = g_settings.rage.edge_dtc_real_jitter;
+ if (jitter) {
+ aim_angle.y += math::random_number< float >(-jitter, jitter);
+ }
+ }
m_cmd->m_viewangles.y = aim_angle.clamp( ).y;
return true;
diff --git a/internal_rewrite/settings.hpp b/internal_rewrite/settings.hpp index 9da7ec2..6880bff 100644 --- a/internal_rewrite/settings.hpp +++ b/internal_rewrite/settings.hpp @@ -270,6 +270,7 @@ namespace data con_var< bool > edge_detection{ &holder_, fnv( "rage_edge_dtc" ), 0 };
con_var< int > edge_dtc_jitter{ &holder_, fnv( "rage_edge_dtc_jitter" ), 0 };
+ con_var< int > edge_dtc_real_jitter{ &holder_, fnv("rage_edge_dtc_real_jitter"), 0 };
con_var< bool > break_lby_edge{ &holder_, fnv( "rage_break_lby_edge" ) };
con_var< int > edge_dtc_normal{ &holder_, fnv( "rage_edge_dtc_normal" ), 0 };
diff --git a/internal_rewrite/ui.h b/internal_rewrite/ui.h index f524f1b..0c36bc1 100644 --- a/internal_rewrite/ui.h +++ b/internal_rewrite/ui.h @@ -430,6 +430,7 @@ namespace ui )->set_cond( [ ]( ) { return g_settings.rage.break_lby; } );
edge_form->add_item( std::make_shared< ui::c_slider< int > >( 0, 0, 140, 0, 90, xors( "fake jitter" ), &g_settings.rage.edge_dtc_jitter ) );
+ edge_form->add_item(std::make_shared< ui::c_slider< int > >(0, 0, 140, 0, 90, xors("real jitter"), &g_settings.rage.edge_dtc_real_jitter));
}
auto lby_form = std::make_shared< ui::c_form >( 0, 0, 215, 106, xors( "lby breaker" ), 106 ); {
diff --git a/server/client.cpp b/server/client.cpp index 37f20a2..8039e65 100644 --- a/server/client.cpp +++ b/server/client.cpp @@ -2,7 +2,7 @@ std::vector< byte > server::c_client::receive_message( ) { std::vector< uint8_t > ret; - char buffer[ BUFFER_SIZE ]; + char buffer[ BUFFER_SIZE ]{ }; int received = 0; while( true ) { @@ -27,28 +27,59 @@ std::vector< byte > server::c_client::receive_message( ) { } bool server::c_client::send_message( byte* 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; } - int result = send( m_socket, ( char* )new_buffer, length + 1, 0 ); + int result = send( m_socket, ( char* )buffer.get( ), length + 1, 0 ); if( result == -1 ) { +#if WIN32 printf( "error sending message to %s: %d\n", get_ip( ), WSAGetLastError( ) ); +#else + printf( "error sending message to %s\n", + get_ip( ) ); +#endif + return false; + } + + return true; +} + +bool server::c_client::send_message( 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 result = send( m_socket, ( char* )buffer.get( ), length + 1, 0 ); + if ( result == -1 ) { +#if WIN32 + printf( "error sending message to %s: %d\n", + get_ip( ), WSAGetLastError( ) ); +#else + printf( "error sending message to %s\n", + get_ip( ) ); +#endif return false; } - free( new_buffer ); return true; } diff --git a/server/client.hpp b/server/client.hpp index a3dcd78..40ba1a5 100644 --- a/server/client.hpp +++ b/server/client.hpp @@ -16,6 +16,7 @@ #include <cstdlib>
#include <string>
#include <fstream>
+#include <memory>
#include "util.hpp"
@@ -50,6 +51,7 @@ namespace server std::vector< byte > receive_message( );
bool send_message( byte* msg, size_t length );
+ bool send_message( const char* );
//handles messages, hwid etc
void handle_buffer( byte* msg );
diff --git a/server/server.cpp b/server/server.cpp index 805239c..2c46489 100644 --- a/server/server.cpp +++ b/server/server.cpp @@ -1,8 +1,10 @@ #include "server.hpp"
int server::c_server::init( ) {
- if( WSAStartup( MAKEWORD( 2, 2 ), &m_sock_data ) )// windows
+#if WIN32
+ if( WSAStartup( MAKEWORD( 2, 2 ), &m_sock_data ) ) // windows
return 1;
+#endif
m_socket = socket( AF_INET, SOCK_STREAM, 0 );
if( m_socket == INVALID_SOCKET )
@@ -21,21 +23,31 @@ void server::c_server::listen( ) { ::listen( m_socket, 5 );
sockaddr_in client_address{ };
- client_address.sin_port = htons( PORT_NUM );
+
+ // not needed, this is set in accept, values are input.
+ // client_address.sin_port = htons( PORT_NUM );
int len = sizeof( client_address );
SOCKET result = accept( m_socket, ( sockaddr* )( &client_address ), &len );
if( result == INVALID_SOCKET ) {
printf( "socket error accepting a connection\n" );
- return;
+ return;
}
printf( "incoming connection from: %s\n", inet_ntoa( client_address.sin_addr ) );
- m_clients.push_back( std::make_shared< c_client >( result, client_address.sin_addr ) );
+
+ // connection established.
+ std::lock_guard lock( m_mutex );
+ auto client = std::make_shared< c_client >( result, client_address.sin_addr );
+
+ client->send_message( "hello" );
+
+ m_clients.push_back( client );
}
void server::c_server::client_loop( ) {
if( m_clients.size( ) ) {
+ std::lock_guard lock( m_mutex );
for( auto it = m_clients.begin( ); it != m_clients.end( ); ++it ) {
if( !( *it )->handle( ) ) {
printf( "%s disconnected\n", ( *it )->get_ip( ) );
diff --git a/server/server.hpp b/server/server.hpp index 8bd017e..1770a05 100644 --- a/server/server.hpp +++ b/server/server.hpp @@ -1,6 +1,7 @@ #pragma once
#include <vector>
#include <memory>
+#include <mutex>
#include "client.hpp"
@@ -11,6 +12,8 @@ namespace server
{
class c_server {
+ std::mutex m_mutex;
+ // vectors are NOT thread safe.
std::vector< std::shared_ptr< c_client > > m_clients;
WSADATA m_sock_data{ };
diff --git a/server/server.vcxproj b/server/server.vcxproj index e37c277..15d8173 100644 --- a/server/server.vcxproj +++ b/server/server.vcxproj @@ -31,7 +31,7 @@ <ProjectGuid>{F0038E32-6DE8-47B7-BC86-8A2274B24406}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>server</RootNamespace>
- <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -46,6 +46,7 @@ <PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
+ <SpectreMitigation>false</SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='pHit|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
diff --git a/server/server_windows.cpp b/server/server_windows.cpp index a593d1b..bbe0b73 100644 --- a/server/server_windows.cpp +++ b/server/server_windows.cpp @@ -24,11 +24,13 @@ int main( ) { int result = g_server.init( );
if( !result ) {
+ // thread unsafe.
listen_thread = std::thread( [ ]( ) { while( 1 ) { g_server.listen( ); } } );
listen_thread.detach( );
while( 1 ) {
g_server.client_loop( );
+ Sleep( 1 );
}
}
else
|
