From 4db29589a61f2e7cb663c5734f911c02206c7997 Mon Sep 17 00:00:00 2001 From: boris Date: Wed, 9 Jan 2019 20:51:16 +1300 Subject: whole buncha shit FIXME: loader currently corrupts heap on injection because i am retarded --- csgo-loader/csgo-module/Networking/TCPClient.hpp | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 csgo-loader/csgo-module/Networking/TCPClient.hpp (limited to 'csgo-loader/csgo-module/Networking/TCPClient.hpp') diff --git a/csgo-loader/csgo-module/Networking/TCPClient.hpp b/csgo-loader/csgo-module/Networking/TCPClient.hpp new file mode 100644 index 0000000..a5794e9 --- /dev/null +++ b/csgo-loader/csgo-module/Networking/TCPClient.hpp @@ -0,0 +1,46 @@ +#pragma once + +// For encryption wrappers. +#include + +// WinSocks +#include +#pragma comment(lib, "ws2_32.lib") + +// std::min +#include + +// std::unique_ptr +#include + +namespace Networking +{ + // A TCPClient is essentially the same as the TCPConnection counterpart on the server, + // however, it independently handles connection. + class TCPClient + { + WSADATA m_WinSocks; + SOCKET m_Socket; + sockaddr_in m_Context; + uint8_t m_EncryptionKey[32]; + + public: + TCPClient() = default; + + // Connects to a remote server. + // Also handles the initial handshake between server and client. + bool Start(uint32_t ServerAddress, uint16_t ServerPort); + + // Kills the client. + void Kill(); + + // Wrappers for sending/receiving data. + void SendRawBytes(ByteArray &Bytes); + ByteArray ReceiveRawBytes(); + + void SendBytes(ByteArray &Bytes); + ByteArray ReceiveBytes(); + }; + + using TCPClientPtr = std::unique_ptr; +} \ No newline at end of file -- cgit v1.2.3