diff options
| author | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2018-11-28 16:00:02 +1300 |
| commit | 3d412a4b30a9f7c7f51ea6562e694315948bd3da (patch) | |
| tree | 26d67dfd1f3e5fd12903ad13e85d0cb8bcf8f21c /loader/server/client.hpp | |
| parent | e4729e4393d90271a3814c7a79950a660c48325a (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/server/client.hpp')
| -rw-r--r-- | loader/server/client.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
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 |
