summaryrefslogtreecommitdiff
path: root/loader
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
committerboris <wzn@moneybot.cc>2018-11-28 16:00:02 +1300
commit3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch)
tree26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /loader
parente4729e4393d90271a3814c7a79950a660c48325a (diff)
cleaned up
in short, the cheat and loader are now separate solutions. unused stuff was moved into the legacy solution in case anyone wants to compile it or whatever. i can change this back if you want to. also, i configured the loader to compile in x64, and have separate build types for linux and win64
Diffstat (limited to 'loader')
-rw-r--r--loader/client/client.vcxproj262
-rw-r--r--loader/client/client.vcxproj.filters12
-rw-r--r--loader/client/client_windows.cpp58
-rw-r--r--loader/client/connect.hpp282
-rw-r--r--loader/client/err.hpp22
-rw-r--r--loader/client/strings.hpp163
-rw-r--r--loader/client/util.hpp33
-rw-r--r--loader/loader.sln61
-rw-r--r--loader/server/client.cpp201
-rw-r--r--loader/server/client.hpp67
-rw-r--r--loader/server/message.hpp8
-rw-r--r--loader/server/server.cpp48
-rw-r--r--loader/server/server.hpp34
-rw-r--r--loader/server/server.vcxproj248
-rw-r--r--loader/server/server.vcxproj.filters14
-rw-r--r--loader/server/server_windows.cpp40
-rw-r--r--loader/server/util.hpp25
-rw-r--r--loader/x64/D_LinuxServer/client.ilkbin0 -> 526908 bytes
-rw-r--r--loader/x64/D_LinuxServer/server.ilkbin0 -> 372064 bytes
19 files changed, 1578 insertions, 0 deletions
diff --git a/loader/client/client.vcxproj b/loader/client/client.vcxproj
new file mode 100644
index 0000000..0e44455
--- /dev/null
+++ b/loader/client/client.vcxproj
@@ -0,0 +1,262 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="D_LinuxServer|Win32">
+ <Configuration>D_LinuxServer</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="D_LinuxServer|x64">
+ <Configuration>D_LinuxServer</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_Windows|Win32">
+ <Configuration>Release_Windows</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_Windows|x64">
+ <Configuration>Release_Windows</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="connect.hpp" />
+ <ClInclude Include="err.hpp" />
+ <ClInclude Include="strings.hpp" />
+ <ClInclude Include="util.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="client_windows.cpp" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{B03A0B07-AA28-4122-842D-1B2457F70334}</ProjectGuid>
+ <RootNamespace>client</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'">
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'">
+ <GenerateManifest>false</GenerateManifest>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableUAC>false</EnableUAC>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableUAC>false</EnableUAC>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableUAC>false</EnableUAC>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableUAC>false</EnableUAC>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/loader/client/client.vcxproj.filters b/loader/client/client.vcxproj.filters
new file mode 100644
index 0000000..b5f56db
--- /dev/null
+++ b/loader/client/client.vcxproj.filters
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClInclude Include="connect.hpp" />
+ <ClInclude Include="err.hpp" />
+ <ClInclude Include="strings.hpp" />
+ <ClInclude Include="util.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="client_windows.cpp" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/loader/client/client_windows.cpp b/loader/client/client_windows.cpp
new file mode 100644
index 0000000..1b493d6
--- /dev/null
+++ b/loader/client/client_windows.cpp
@@ -0,0 +1,58 @@
+#include <Windows.h>
+#include <stdio.h>
+#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 (use bcrypt or some shit idk)
+ 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.
+ 12a. Server does relocations.
+ 12b. Server does imports.
+ 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( ) {
+ // TEMPORARY, WE NEED TO ENCRYPT IP STRING SO WE DON'T HAVE DDOS NOOBS.
+ // or we could do char address[] = { 127, 0, 0, 1 };
+ std::string ip = "127.0.0.1";
+ // std::cin >> ip;
+
+ // START.
+ client::c_connect c( ip.c_str( ) );
+ if( !c.setup( ) )
+ return 1;
+
+ if( !c.connect( ) )
+ return 2;
+
+ c.handle( );
+
+ system( "pause" );
+
+ return 0;
+}
diff --git a/loader/client/connect.hpp b/loader/client/connect.hpp
new file mode 100644
index 0000000..ddf23a0
--- /dev/null
+++ b/loader/client/connect.hpp
@@ -0,0 +1,282 @@
+#pragma once
+
+#include <Windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fstream>
+
+#pragma comment( lib, "ws2_32.lib" )
+
+#include <vector>
+
+/* TEST */
+#include <Psapi.h>
+#include <TlHelp32.h>
+/* TEST */
+
+#include "err.hpp"
+#include "util.hpp"
+
+/*
+protocol rules:
+every msg must be xored
+first byte is the xorkey
+
+*/
+
+namespace client
+{
+ constexpr auto PORT_NUM = 6969;
+ constexpr auto BUFFER_SIZE = 255;
+
+ class c_connect {
+ public:
+ c_connect( const char* ip ) :
+ m_ip( inet_addr( ip ) ) { }
+
+ ~c_connect( ) {
+ if( m_socket )
+ closesocket( m_socket );
+
+ WSACleanup( );
+ }
+
+ bool setup( ) {
+ int code{ };
+
+ if( WSAStartup( MAKEWORD( 2, 2 ), &m_wsdata ) )
+ code = err::ERR_WSA;
+ else {
+ m_socket = socket( AF_INET, SOCK_STREAM, 0 );
+ if( m_socket == INVALID_SOCKET )
+ code = err::ERR_WSA;
+ }
+
+ if( code != err::ERR_NONE ) {
+ MessageBoxA( nullptr, err::translate_err( code ), "", MB_OK );
+ return false;
+ }
+
+ return true;
+ }
+
+ bool connect( ) {
+ sockaddr_in server_address{ };
+ int code{ };
+
+ server_address.sin_addr.s_addr = m_ip;
+ server_address.sin_port = htons( PORT_NUM );
+ server_address.sin_family = AF_INET;
+
+ code = ::connect( m_socket, ( sockaddr* )( &server_address ),
+ sizeof( server_address ) );
+
+ if( code == -1 ) {
+ MessageBoxA( nullptr, err::translate_err( err::ERR_CONNECT ), "", MB_OK );
+ return false;
+ }
+
+ return true;
+ }
+
+ void decode_buffer( uint8_t* buf, size_t length ) {
+ auto key = buf[ 0 ];
+ for( size_t i{ 1 }; i < length; ++i )
+ 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 ];
+ int received = 0;
+
+ while( true ) {
+ 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( ret.data( ), ret.size( ) );
+ ret.erase( ret.begin( ) );
+ }
+ return ret;
+ }
+
+ void send_msg( const uint8_t* msg, int length ) {
+ auto buffer = std::make_unique< uint8_t[ ] >( length + 1 );
+ uint8_t key = util::random_number( 0, 255 ) & 0xff;
+
+ buffer[ 0 ] = key;
+ memcpy( buffer.get( ) + 1,
+ msg,
+ length );
+
+ for( int 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( ) );
+ }
+ }
+
+ void send_msg( const char* msg ) {
+ auto length = strlen( msg );
+ auto buffer = std::make_unique< uint8_t[ ] >( length + 1 );
+ uint8_t key = util::random_number( 0, 255 ) & 0xff;
+
+ 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( ), (int) length + 1, 0 );
+ if ( ret == SOCKET_ERROR ) {
+ printf( xors( "error sending message error code: %d" ), WSAGetLastError( ) );
+ }
+ }
+
+
+ void send_msg( const char msg ) {
+ auto buffer = std::make_unique< uint8_t[ ] >( 2 );
+ uint8_t key = util::random_number( 0, 255 ) & 0xff;
+
+ buffer[ 0 ] = key;
+ buffer[ 1 ] = msg;
+ buffer[ 1 ] ^= buffer[ 0 ];
+
+ int ret = send( m_socket, ( char* )buffer.get( ), 2, 0 );
+ if ( ret == SOCKET_ERROR ) {
+ printf( xors( "error sending message error code: %d" ), WSAGetLastError( ) );
+ }
+ }
+
+ void handle( ) {
+
+ auto msg = get_string( );
+ if ( msg != xors( "hello" ) ) {
+ std::cout << "connection failed." << std::endl;
+ //return 0;
+ }
+
+ send_msg( "hello" );
+
+ std::string username{ }, password{ };
+ std::cout << "Enter your username" << std::endl << "> ";
+ std::cin >> username;
+
+ send_msg( username.c_str( ) );
+ msg = get_string( );
+ std::cout <<msg <<std::endl;
+ 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;
+
+ send_msg( password.c_str( ) );
+ if ( get_string( ) != xors( "correct password" ) ) {
+ std::cout << "incorrect password";
+ //return 0; // remember to close connection on server when bad values were sent.
+ }
+
+ // Receive list of games,
+ msg = get_string( );
+ std::cout << msg << std::endl;
+
+
+ std::cout << "For what game do you want to inject on?" << std::endl << "> ";
+
+ char game_id{ };
+ std::cin >> game_id;
+
+ send_msg( game_id );
+
+ // get process name.
+ msg = get_string( );
+
+ std::cout << msg << std::endl;
+
+ int process_identifier{ };
+
+ HANDLE snapshot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
+ if ( snapshot != INVALID_HANDLE_VALUE ) {
+ PROCESSENTRY32 entry{ sizeof( PROCESSENTRY32 ) };
+
+ if ( Process32First( snapshot, &entry ) ) {
+ do {
+ if ( msg == entry.szExeFile ) {
+ process_identifier = entry.th32ProcessID;
+ break;
+ }
+ } while ( Process32Next( snapshot, &entry ) );
+ }
+ }
+
+ if ( !process_identifier ) {
+ std::cout << "Could not find process." << std::endl;
+ return;
+ }
+
+ std::cout << "found" << std::endl;
+ send_msg( "found" );
+
+ auto file = get_msg( );
+ auto file_data = file.data( );
+ auto file_size = file.size( );
+
+ auto save_file = std::ofstream( "gmod.txt", std::ofstream::binary );
+ if ( save_file.is_open( ) ) {
+ save_file.write( ( const char* )file_data, file_size );
+ save_file.close( );
+ }
+
+
+ }
+
+ private:
+ SOCKET m_socket;
+ WSADATA m_wsdata;
+ int m_ip;
+ };
+} \ No newline at end of file
diff --git a/loader/client/err.hpp b/loader/client/err.hpp
new file mode 100644
index 0000000..5a6691d
--- /dev/null
+++ b/loader/client/err.hpp
@@ -0,0 +1,22 @@
+#pragma once
+#include "strings.hpp"
+
+namespace err
+{
+ enum ErrCode_t {
+ ERR_NONE = 0,
+ ERR_WSA = 1,
+ ERR_CONNECT = 2,
+ };
+
+ const char* translate_err( int code ) {
+ switch( code ) {
+ case ERR_WSA:
+ return xors( "socket error" );
+ case ERR_CONNECT:
+ return xors( "connection error" );
+ }
+
+ return xors( "unknown error" );
+ }
+} \ No newline at end of file
diff --git a/loader/client/strings.hpp b/loader/client/strings.hpp
new file mode 100644
index 0000000..b5dba75
--- /dev/null
+++ b/loader/client/strings.hpp
@@ -0,0 +1,163 @@
+//--------------------------------------------------------------------------------
+//-- XorCompileTime.hpp
+//
+// Author: frk
+// Date: 12.12.2015
+//
+//--------------------------------------------------------------------------------
+
+#pragma once
+#include <string>
+#include <array>
+#include <cstdarg>
+
+#define BEGIN_NAMESPACE( x ) namespace x {
+#define END_NAMESPACE }
+
+BEGIN_NAMESPACE( strenc )
+
+constexpr auto time = __TIME__;
+constexpr auto seed = static_cast< int >( time[ 7 ] ) + static_cast< int >( time[ 6 ] ) * 10 + static_cast< int >( time[ 4 ] ) * 60 + static_cast< int >( time[ 3 ] ) * 600 + static_cast< int >( time[ 1 ] ) * 3600 + static_cast< int >( time[ 0 ] ) * 36000;
+
+// 1988, Stephen Park and Keith Miller
+// "Random Number Generators: Good Ones Are Hard To Find", considered as "minimal standard"
+// Park-Miller 31 bit pseudo-random number generator, implemented with G. Carta's optimisation:
+// with 32-bit math and without division
+
+template < int N >
+struct RandomGenerator {
+private:
+ static constexpr unsigned a = 16807; // 7^5
+ static constexpr unsigned m = 2147483647; // 2^31 - 1
+
+ static constexpr unsigned s = RandomGenerator< N - 1 >::value;
+ static constexpr unsigned lo = a * ( s & 0xFFFF ); // Multiply lower 16 bits by 16807
+ static constexpr unsigned hi = a * ( s >> 16 ); // Multiply higher 16 bits by 16807
+ static constexpr unsigned lo2 = lo + ( ( hi & 0x7FFF ) << 16 ); // Combine lower 15 bits of hi with lo's upper bits
+ static constexpr unsigned hi2 = hi >> 15; // Discard lower 15 bits of hi
+ static constexpr unsigned lo3 = lo2 + hi;
+
+public:
+ static constexpr unsigned max = m;
+ static constexpr unsigned value = lo3 > m ? lo3 - m : lo3;
+};
+
+template <>
+struct RandomGenerator< 0 > {
+ static constexpr unsigned value = seed;
+};
+
+template < int N, int M >
+struct RandomInt {
+ static constexpr auto value = RandomGenerator< N + 1 >::value % M;
+};
+
+template < int N >
+struct RandomChar {
+ static const char value = static_cast< char >( 1 + RandomInt< N, 0x7F - 1 >::value );
+};
+
+template < size_t N, int K >
+struct XorString {
+private:
+ const char _key;
+ std::array< char, N + 1 > _encrypted;
+ bool decrypted = false;
+
+ constexpr char enc( char c ) const {
+ return c ^ _key;
+ }
+
+ char dec( char c ) const {
+ return c ^ _key;
+ }
+
+public:
+ template < size_t... Is >
+ constexpr __forceinline XorString( const char* const str, std::index_sequence< Is... > ) : _key( RandomChar< K >::value ), _encrypted{ enc( str[ Is ] )... } {
+ }
+
+ __forceinline const char* decrypt( void ) {
+ if( !decrypted ) {
+ for( size_t i = 0; i < N; ++i ) {
+ _encrypted[ i ] = dec( _encrypted[ i ] );
+ }
+ _encrypted[ N ] = '\0';
+ decrypted = true;
+ }
+
+ return _encrypted.data( );
+ }
+};
+
+//--------------------------------------------------------------------------------
+//-- Note: XorStr will __NOT__ work directly with functions like printf.
+// To work with them you need a wrapper function that takes a const char*
+// as parameter and passes it to printf and alike.
+//
+// The Microsoft Compiler/Linker is not working correctly with variadic
+// templates!
+//
+// Use the functions below or use std::cout (and similar)!
+//--------------------------------------------------------------------------------
+
+#if( 1 )
+static auto w_printf = [ ]( const char* fmt, ... ) {
+ va_list args;
+ va_start( args, fmt );
+ vprintf_s( fmt, args );
+ va_end( args );
+};
+
+static auto w_printf_s = [ ]( const char* fmt, ... ) {
+ va_list args;
+ va_start( args, fmt );
+ vprintf_s( fmt, args );
+ va_end( args );
+};
+
+static auto w_sprintf = [ ]( char* buf, const char* fmt, ... ) {
+ va_list args;
+ va_start( args, fmt );
+ vsprintf( buf, fmt, args );
+ va_end( args );
+};
+
+static auto w_sprintf_s = [ ]( char* buf, size_t buf_size, const char* fmt, ... ) {
+ va_list args;
+ va_start( args, fmt );
+ vsprintf_s( buf, buf_size, fmt, args );
+ va_end( args );
+};
+#endif
+
+//for compatibility with debug mode
+struct debug_ret {
+private:
+ const char* ret;
+
+public:
+ debug_ret( const char* str ) : ret( str ) { };
+
+ auto decrypt( ) {
+ return ret;
+ }
+};
+
+constexpr size_t strlen_ct( const char* const str ) {
+ size_t out = 1;
+
+ for( ; str[ out ] != '\0'; ++out );
+
+ return out;
+}
+
+#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
+#define xors_raw( s ) ( [ ]{ strenc::debug_ret ret{ s }; return ret; }( ) )
+#define xors( s ) ( s )
+#endif
+
+END_NAMESPACE \ No newline at end of file
diff --git a/loader/client/util.hpp b/loader/client/util.hpp
new file mode 100644
index 0000000..aabfd69
--- /dev/null
+++ b/loader/client/util.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <windows.h>
+#include "strings.hpp"
+
+#include <random>
+
+namespace util
+{
+ namespace {
+ //make a random generator and seed it with a p random number
+ static std::random_device rd;
+ static std::mt19937 gen( rd( ) );
+ }
+
+ template < typename t >
+ __forceinline t random_number( t min, t max ) {
+ if constexpr( !std::is_integral_v< t > ) {
+ std::uniform_real_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ else {
+ std::uniform_int_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ }
+
+ // okay now this is epic
+ __forceinline void raise_error(const char *error) {
+ MessageBoxA(0, error, xors("error"), MB_ICONERROR);
+ ExitProcess(0);
+ }
+} \ No newline at end of file
diff --git a/loader/loader.sln b/loader/loader.sln
new file mode 100644
index 0000000..3048c18
--- /dev/null
+++ b/loader/loader.sln
@@ -0,0 +1,61 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.106
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server\server.vcxproj", "{A6D4FCB9-F886-424C-8493-758A15CCD7A9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "client\client.vcxproj", "{B03A0B07-AA28-4122-842D-1B2457F70334}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ D_LinuxServer|x64 = D_LinuxServer|x64
+ D_LinuxServer|x86 = D_LinuxServer|x86
+ D_WindowsServer|x64 = D_WindowsServer|x64
+ D_WindowsServer|x86 = D_WindowsServer|x86
+ R_LinuxServer|x64 = R_LinuxServer|x64
+ R_LinuxServer|x86 = R_LinuxServer|x86
+ R_WindowsServer|x64 = R_WindowsServer|x64
+ R_WindowsServer|x86 = R_WindowsServer|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_LinuxServer|x64.ActiveCfg = D_LinuxServer|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_LinuxServer|x64.Build.0 = D_LinuxServer|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_LinuxServer|x86.ActiveCfg = D_LinuxServer|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_LinuxServer|x86.Build.0 = D_LinuxServer|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_WindowsServer|x64.ActiveCfg = Debug|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_WindowsServer|x64.Build.0 = Debug|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_WindowsServer|x86.ActiveCfg = Debug|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.D_WindowsServer|x86.Build.0 = Debug|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_LinuxServer|x64.ActiveCfg = Release|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_LinuxServer|x64.Build.0 = Release|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_LinuxServer|x86.ActiveCfg = Release|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_LinuxServer|x86.Build.0 = Release|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_WindowsServer|x64.ActiveCfg = Release_Windows|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_WindowsServer|x64.Build.0 = Release_Windows|x64
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_WindowsServer|x86.ActiveCfg = Release_Windows|Win32
+ {A6D4FCB9-F886-424C-8493-758A15CCD7A9}.R_WindowsServer|x86.Build.0 = Release_Windows|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_LinuxServer|x64.ActiveCfg = D_LinuxServer|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_LinuxServer|x64.Build.0 = D_LinuxServer|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_LinuxServer|x86.ActiveCfg = D_LinuxServer|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_LinuxServer|x86.Build.0 = D_LinuxServer|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_WindowsServer|x64.ActiveCfg = Debug|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_WindowsServer|x64.Build.0 = Debug|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_WindowsServer|x86.ActiveCfg = Debug|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.D_WindowsServer|x86.Build.0 = Debug|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_LinuxServer|x64.ActiveCfg = Release|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_LinuxServer|x64.Build.0 = Release|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_LinuxServer|x86.ActiveCfg = Release|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_LinuxServer|x86.Build.0 = Release|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_WindowsServer|x64.ActiveCfg = Release_Windows|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_WindowsServer|x64.Build.0 = Release_Windows|x64
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_WindowsServer|x86.ActiveCfg = Release_Windows|Win32
+ {B03A0B07-AA28-4122-842D-1B2457F70334}.R_WindowsServer|x86.Build.0 = Release_Windows|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {3F3309B9-EA04-4C25-BF7B-37B736370BF1}
+ EndGlobalSection
+EndGlobal
diff --git a/loader/server/client.cpp b/loader/server/client.cpp
new file mode 100644
index 0000000..8e7d3d3
--- /dev/null
+++ b/loader/server/client.cpp
@@ -0,0 +1,201 @@
+#include "client.hpp"
+#include "server.hpp"
+
+/*
+std::vector< byte > server::c_client::receive_message( ) {
+ std::vector< uint8_t > ret;
+ char buffer[ BUFFER_SIZE ]{ };
+ int received = 0;
+
+ while( true ) {
+ 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( ret.data( ), ret.size( ) );
+ ret.push_back( 0 );
+ ret.erase( ret.begin( ) );
+ }
+
+ return ret;
+}
+*/
+
+void server::c_client::kill( ) {
+ closesocket( m_socket );
+ printf( "%s disconnected\n", get_ip( ) );
+}
+
+std::string server::c_client::get_msg( ) {
+ std::string ret{ };
+ char buffer[ BUFFER_SIZE ]{ };
+ int received = 0;
+
+ while ( true ) {
+ 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.push_back( 0 ); somehow broke things :/
+ ret.erase( ret.begin( ) );
+ }
+
+ return ret;
+}
+
+bool server::c_client::send_msg( byte* msg, size_t length ) {
+ auto buffer = std::make_unique< uint8_t[ ] >( length + 1 );
+ uint8_t key = util::random_number( 0, 255 ) & 0xff;
+
+ 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 WIN64
+ 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_msg( const char* msg ) {
+ auto length = strlen( msg );
+ auto buffer = std::make_unique< uint8_t[ ] >( length + 1 );
+ uint8_t key = util::random_number( 0, 255 ) & 0xff;
+
+ memset( buffer.get( ), 0, length+1 );
+
+ 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 WIN64
+ 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::handle( ) {
+ /*
+ ALL TEST CODE BELOW.
+ */
+ auto hello_msg = get_msg( );
+ printf( "%s\n", hello_msg.c_str( ) );
+
+ if ( hello_msg != "hello" )
+ return false;
+
+ auto username = get_msg( );
+ if ( username != "friendly" )
+ return false;
+
+ printf( "correct username\n" );
+ send_msg( "correct username" );
+
+ auto password = get_msg( );
+ if ( password != "nigger" )
+ return false;
+
+ printf( "correct password\n" );
+ send_msg( "correct password" );
+
+ const char* games_list =
+R"(games:
+1: CSGO
+2: CSGO (test)
+3: Garry's Mod
+)";
+
+ send_msg( games_list );
+
+ auto game_id = get_msg( );
+
+ if ( game_id== "1" ) {
+ printf( "csgo\n" );
+ send_msg( "csgo.exe" );
+ }
+ else if ( game_id == "2" ) {
+ printf( "csgo test\n" );
+ send_msg( "csgo.exe" );
+ }
+ else if ( game_id == "3" ) {
+ printf( "gmod\n" );
+ send_msg( "hl2.exe" );
+ }
+ else {
+ printf( "invalid\n" );
+ return false;
+ }
+
+ auto found = get_msg( );
+ if ( found != "found" )
+ return false;
+
+ printf( "process found\n" );
+
+ if ( game_id == "3" ) {
+ // test. make sure the file is in ur directory
+ auto file = std::ifstream( "gmod.dll", std::ifstream::binary );
+ if ( file.is_open( ) ) {
+ file.seekg( 0, file.end );
+
+ auto size = ( int )file.tellg( );
+ auto buffer = std::make_unique< char[ ] >( size );
+
+ memset( buffer.get( ), 0, size );
+
+ file.seekg( 0, file.beg );
+ file.read( buffer.get( ), size );
+
+ send_msg( ( uint8_t* )buffer.get( ), size );
+
+ file.close( );
+ }
+ }
+
+ return true;
+}
diff --git a/loader/server/client.hpp b/loader/server/client.hpp
new file mode 100644
index 0000000..1f577c7
--- /dev/null
+++ b/loader/server/client.hpp
@@ -0,0 +1,67 @@
+#pragma once
+
+#ifdef WIN64
+#include <Windows.h>
+#pragma comment(lib, "ws2_32.lib")
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#endif
+
+
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <fstream>
+#include <memory>
+#include <thread>
+
+
+#include "util.hpp"
+
+constexpr auto PORT_NUM = 6969;
+constexpr auto BUFFER_SIZE = 255;
+
+namespace server
+{
+ class c_client {
+ SOCKET m_socket{ };
+ in_addr m_address{ };
+ ulong_t m_hwid{ };
+ public:
+ c_client( SOCKET socket, in_addr& address ) :
+ m_socket( socket ),
+ m_address( address )
+ { }
+
+ ~c_client( ) {
+ kill( );
+ }
+
+
+ void decode_buffer( uint8_t* buf, size_t length ) {
+ auto key = buf[ 0 ];
+ for( size_t i{ 1 }; i < length; ++i )
+ buf[ i ] ^= key;
+ }
+
+ auto get_ip( ) {
+ return inet_ntoa( m_address );
+ }
+
+ void kill( );
+
+ //std::vector< byte > receive_message( );
+ std::string get_msg( );
+ bool send_msg( byte* msg, size_t length );
+ bool send_msg( const char* );
+
+ //handles messages, hwid etc
+ void handle_buffer( byte* msg );
+ virtual bool handle( );
+ };
+} \ No newline at end of file
diff --git a/loader/server/message.hpp b/loader/server/message.hpp
new file mode 100644
index 0000000..bf67389
--- /dev/null
+++ b/loader/server/message.hpp
@@ -0,0 +1,8 @@
+#pragma once
+
+enum MessageType_t {
+ MSG_HELLO = 'h',
+ MSG_READY = 'r',
+ MSG_BAN = 'q',
+ MSG_IMPORT = 'i'
+}; \ No newline at end of file
diff --git a/loader/server/server.cpp b/loader/server/server.cpp
new file mode 100644
index 0000000..e12e691
--- /dev/null
+++ b/loader/server/server.cpp
@@ -0,0 +1,48 @@
+#include "server.hpp"
+
+int server::c_server::init( ) {
+#if WIN64
+ 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 )
+ return 2;
+
+ sockaddr_in server_address{ };
+ server_address.sin_addr.s_addr = INADDR_ANY;
+ server_address.sin_port = htons( PORT_NUM );
+ server_address.sin_family = AF_INET;
+
+ auto result = ::bind( m_socket, ( sockaddr* )( &server_address ), sizeof( server_address ) );
+ return result != -1 ? 0 : 3;
+}
+
+void server::c_server::listen( ) {
+ ::listen( m_socket, 5 );
+
+ sockaddr_in client_address{ };
+
+ // 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;
+ }
+
+ printf( "incoming connection from: %s\n", inet_ntoa( client_address.sin_addr ) );
+
+ // connection established.
+ auto client = std::make_shared< c_client >( result, client_address.sin_addr );
+
+ // handshake.
+ client->send_msg( "hello" );
+
+ // surprised it even works with shared_ptr.
+ std::thread thread{ &c_client::handle, client };
+ thread.detach( );
+}
diff --git a/loader/server/server.hpp b/loader/server/server.hpp
new file mode 100644
index 0000000..5ac8393
--- /dev/null
+++ b/loader/server/server.hpp
@@ -0,0 +1,34 @@
+#pragma once
+#include <vector>
+#include <memory>
+#include <mutex>
+#include <thread>
+
+#include "client.hpp"
+
+
+//since this will be running on our vps we dont need string encryption or protection for anything
+//which is cool, i guess
+
+namespace server
+{
+ class c_server {
+ // not sure if even needed.
+ std::mutex m_mutex;
+ private:
+ WSADATA m_sock_data{ };
+ SOCKET m_socket{ };
+
+ public:
+ ~c_server( ) {
+ if ( m_socket )
+ closesocket( m_socket );
+ }
+
+ int init( );
+ void listen( );
+ void client_loop( );
+ };
+}
+
+extern server::c_server g_server; \ No newline at end of file
diff --git a/loader/server/server.vcxproj b/loader/server/server.vcxproj
new file mode 100644
index 0000000..543a42f
--- /dev/null
+++ b/loader/server/server.vcxproj
@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="D_LinuxServer|Win32">
+ <Configuration>D_LinuxServer</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="D_LinuxServer|x64">
+ <Configuration>D_LinuxServer</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_Windows|Win32">
+ <Configuration>Release_Windows</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_Windows|x64">
+ <Configuration>Release_Windows</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="client.hpp" />
+ <ClInclude Include="message.hpp" />
+ <ClInclude Include="server.hpp" />
+ <ClInclude Include="util.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="client.cpp" />
+ <ClCompile Include="server.cpp" />
+ <ClCompile Include="server_windows.cpp" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>15.0</VCProjectVersion>
+ <ProjectGuid>{A6D4FCB9-F886-424C-8493-758A15CCD7A9}</ProjectGuid>
+ <RootNamespace>server</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup />
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <PreprocessorDefinitions>WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='D_LinuxServer|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <PreprocessorDefinitions>VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Windows|x64'">
+ <ClCompile>
+ <WarningLevel>Level4</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <ConformanceMode>true</ConformanceMode>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
+ <LanguageStandard>stdcpplatest</LanguageStandard>
+ <CallingConvention>FastCall</CallingConvention>
+ <PreprocessorDefinitions>WIN64;VC_EXTRALEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <Link>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/loader/server/server.vcxproj.filters b/loader/server/server.vcxproj.filters
new file mode 100644
index 0000000..5ef28fc
--- /dev/null
+++ b/loader/server/server.vcxproj.filters
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClInclude Include="message.hpp" />
+ <ClInclude Include="server.hpp" />
+ <ClInclude Include="util.hpp" />
+ <ClInclude Include="client.hpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="server.cpp" />
+ <ClCompile Include="server_windows.cpp" />
+ <ClCompile Include="client.cpp" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/loader/server/server_windows.cpp b/loader/server/server_windows.cpp
new file mode 100644
index 0000000..cdc6ac4
--- /dev/null
+++ b/loader/server/server_windows.cpp
@@ -0,0 +1,40 @@
+#ifdef WIN64
+#include <Windows.h>
+#pragma comment(lib, "ws2_32.lib")
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#endif
+
+#include <cstdio>
+#include <cstdlib>
+#include <string>
+#include <fstream>
+#include <thread>
+#include "server.hpp"
+
+server::c_server g_server;
+
+int main( ) {
+ std::thread listen_thread;
+
+ int result = g_server.init( );
+ if( !result ) {
+ //listen_thread = std::thread( [ ]( ) { while( 1 ) { g_server.listen( ); } } );
+ //listen_thread.detach( );
+
+ while( true ) {
+ g_server.listen( );
+ //Sleep( 1 );
+ }
+ }
+ else
+ printf( "server init error (%d)\n", result );
+
+ system( "pause" );
+ return 0;
+}
diff --git a/loader/server/util.hpp b/loader/server/util.hpp
new file mode 100644
index 0000000..1d408e0
--- /dev/null
+++ b/loader/server/util.hpp
@@ -0,0 +1,25 @@
+#pragma once
+#include <random>
+
+using ulong_t = unsigned long;
+
+namespace util
+{
+ namespace {
+ //make a random generator and seed it with a p random number
+ static std::random_device rd;
+ static std::mt19937 gen( rd( ) );
+ }
+
+ template < typename t >
+ __forceinline t random_number( t min, t max ) {
+ if constexpr( !std::is_integral_v< t > ) {
+ std::uniform_real_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ else {
+ std::uniform_int_distribution< t > dist( min, max );
+ return dist( gen );
+ }
+ }
+} \ No newline at end of file
diff --git a/loader/x64/D_LinuxServer/client.ilk b/loader/x64/D_LinuxServer/client.ilk
new file mode 100644
index 0000000..7db2185
--- /dev/null
+++ b/loader/x64/D_LinuxServer/client.ilk
Binary files differ
diff --git a/loader/x64/D_LinuxServer/server.ilk b/loader/x64/D_LinuxServer/server.ilk
new file mode 100644
index 0000000..29c34f2
--- /dev/null
+++ b/loader/x64/D_LinuxServer/server.ilk
Binary files differ