diff options
| author | boris <wzn@moneybot.cc> | 2019-01-09 20:51:16 +1300 |
|---|---|---|
| committer | boris <wzn@moneybot.cc> | 2019-01-09 20:51:16 +1300 |
| commit | 4db29589a61f2e7cb663c5734f911c02206c7997 (patch) | |
| tree | 38ec6f25fe1b807ba76e28720badf4a70a87601c /csgo-loader/csgo-module/Networking/TCPClient.hpp | |
| parent | 1fbe9543b16fc6edacfc1e1dca75f5938ebb08a3 (diff) | |
whole buncha shit
FIXME: loader currently corrupts heap on injection because i am retarded
Diffstat (limited to 'csgo-loader/csgo-module/Networking/TCPClient.hpp')
| -rw-r--r-- | csgo-loader/csgo-module/Networking/TCPClient.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
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 <Security/Encryption.hpp>
+
+// WinSocks
+#include <winsock2.h>
+#pragma comment(lib, "ws2_32.lib")
+
+// std::min
+#include <algorithm>
+
+// std::unique_ptr
+#include <memory>
+
+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<TCPClient>;
+}
\ No newline at end of file |
