-
Notifications
You must be signed in to change notification settings - Fork 7
/
NetLogger.hpp
95 lines (71 loc) · 2.3 KB
/
NetLogger.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#define XOR_BYTE(x, pos) byte y = (x ^ pos) //fix this
#define CURRENT_VERSION "1.0"
#pragma once
#include "Offsets.hpp"
#include "NetCipher.hpp"
#include <WinSock.h>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <string>
#include <time.h>
#include "AutoUpdate.hpp"
#include "OS.hpp"
#pragma comment(lib, "ws2_32")
typedef struct ItemEntry
{
USHORT ID;
USHORT StackCount;
BYTE Tier;
std::wstring ItemPath;
std::wstring ReadableName;
}LoggedItems;
const byte unpackKey = 0x50;
//static byte serverIP[12] = { '4' ^ unpackKey, '5' ^ unpackKey, '.' ^ unpackKey, '1' ^ unpackKey, '3' ^ unpackKey, '8' ^ unpackKey, '.' ^ unpackKey, '1' ^ unpackKey, '6' ^ unpackKey, '.' ^ unpackKey, '6' ^ unpackKey, '6' ^ unpackKey };
static byte serverIP[] = { '2' ^ unpackKey, '.' ^ unpackKey, '5' ^ unpackKey, '8' ^ unpackKey, '.' ^ unpackKey, '5' ^ unpackKey, '6' ^ unpackKey, '.' ^ unpackKey, '1' ^ unpackKey, '6' ^ unpackKey, '8' ^ unpackKey };
class NetLogger //'licensing'
{
private:
SOCKET Socket;
USHORT Port;
char* IPAddress;
BYTE ConnectionType; //WSATCP, TCP2, TCP1, UDP
const UINT TimeBetweenHeartbeat = 3; //minutes
std::string HardwareID;
LPBYTE Heartbeat;
std::queue<ItemEntry> LoggedItems;
std::vector<char>* CryptoKey;
LPBYTE CryptoBuffer;
LPBYTE ResponseBuffer;
BYTE IsCompromised;
BOOL SendPCInfo();
public:
NetLogger();
struct IPv4
{
unsigned char b1, b2, b3, b4;
};
SOCKET GetSocket() { return this->Socket; }
USHORT GetPort() { return this->Port; }
char* GetIP() { return this->IPAddress; }
UINT GetTimeBetweenSends() { return this->TimeBetweenHeartbeat; }
BOOL SetSocket(SOCKET S);
BOOL SetSocketPort(USHORT Port);
BOOL SetIP(const char* IP);
string GetUnpackedServerIP();
ItemEntry* GetItemEntries(LPWSTR PathName);
INT SendData(string data);
VOID EncryptData(LPBYTE Data, LPBYTE Key);
std::string FillHardwareID();
bool SendHWID();
std::string NetLogger::PostItemToLogger(char* dataBuffer);
BOOL CompareHardwareID();
BOOL GetClientIPv4(IPv4 & myIP);
static void Listen(LPVOID param);
UINT64 Offsets[14]; //server-provided offsets
byte HeartbeatRecvBytes[256];
bool TransactHeartbeat();
int nTransactions;
bool HeartbeatApproved = false;
bool HelloApproved = false;
};