BF2MC-Matchmaker
browsing/test.cpp
1 #include <unistd.h>
2 #include <iostream>
3 #include <iomanip>
4 #include <regex>
5 #include <thread>
6 
7 #include <settings.h>
8 #include <logger.h>
9 #include <server.h>
10 #include <globals.h>
11 #include <util.h>
12 #include <browsing/sb_crypt.h>
13 #include <browsing/constants.h>
14 
15 #include <browsing/client.h>
16 
17 // Example's
18 
19 std::vector<unsigned char> example_A_request = {
20  0x01, 0x5e, // Total Bytes to read
21  0x00, // REQUEST_SERVER_LIST
22  0x01, // protocol_version
23  0x03, // encoding_version
24  0x00, 0x00, 0x00, 0x00, // game_version
25  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // for_gamename
26  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // from_gamename
27  0x25, 0x60, 0x50, 0x27, 0x6c, 0x6d, 0x64, 0x55, // client challenge
28 
29  // filter: gamever='V1.31a' and (teamplay=0 and numplayers<=23 and numplayers>=0 and numplayers!=maxplayers and nr<=2 and xr>=2)and (region & 1)!=0
30  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x3d, 0x27, 0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x27,
31  0x20, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x3d, 0x30,
32  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3c,
33  0x3d, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65,
34  0x72, 0x73, 0x3e, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61,
35  0x79, 0x65, 0x72, 0x73, 0x21, 0x3d, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73,
36  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x72, 0x3c, 0x3d, 0x32, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x78,
37  0x72, 0x3e, 0x3d, 0x32, 0x29, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e,
38  0x20, 0x26, 0x20, 0x31, 0x29, 0x21, 0x3d, 0x30, 0x00,
39 
40  // key_list: \hostname\gametype\gamever\hostport\timelimit\timeelapsed\mapname\numplayers\maxplayers\
41  teamplay\team_t\ping_\c0\c1\n0\n1\c0c\c1c\nr\xr\ff\mc\gc\rc\sr\ni\xi\qm
42  0x5c, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79,
43  0x70, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x70,
44  0x6f, 0x72, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5c, 0x74, 0x69,
45  0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5c, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d,
46  0x65, 0x5c, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x6d, 0x61, 0x78,
47  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79,
48  0x5c, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x5c, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x5c, 0x63, 0x30,
49  0x5c, 0x63, 0x31, 0x5c, 0x6e, 0x30, 0x5c, 0x6e, 0x31, 0x5c, 0x63, 0x30, 0x63, 0x5c, 0x63, 0x31,
50  0x63, 0x5c, 0x6e, 0x72, 0x5c, 0x78, 0x72, 0x5c, 0x66, 0x66, 0x5c, 0x6d, 0x63, 0x5c, 0x67, 0x63,
51  0x5c, 0x72, 0x63, 0x5c, 0x73, 0x72, 0x5c, 0x6e, 0x69, 0x5c, 0x78, 0x69, 0x5c, 0x71, 0x6d, 0x00,
52 
53  0x00, 0x00, 0x00, 0x80, // options
54  0x14, 0x00, 0x00, 0x00 // options max_results
55 };
56 
57 std::vector<unsigned char> example_A_response = {
58  // Crypt challenge
59  0xe6, // length
60  0xbb, 0x79, 0x76, 0xb5, 0xb9, 0xe1, 0xa6, 0xaf, 0x08, 0x15, // data
61 
62  // Server challenge
63  0xf3, // length // data
64  0xc7, 0x63, 0x80, 0x6e, 0xd7, 0x70, 0x7a, 0x11, 0xc4, 0x03, 0x1b, 0xa0, 0x70, 0x13, 0x7e, 0x69, // data 1-16
65  0x69, 0x53, 0x33, 0x45, 0x92, 0xee, 0x3e, 0x09, 0xa4,
66 
67  // Encrypted data
68  0xe6, 0x35, 0x83, 0xc4, 0x70, 0x40, 0xdf, 0x4f, 0x14, 0x77, 0x52, 0xb3, 0x4c, 0xf8, 0xca, 0xec,
69  0x9f, 0xd7, 0x74, 0xe9, 0x03, 0x49, 0xe8, 0xcb, 0xef, 0xd8, 0xb3, 0x01, 0xfc, 0xe6, 0xe1, 0xd0,
70  0x03, 0xbe, 0x61, 0x43, 0x2a, 0x66, 0xfb, 0x13, 0x3d, 0x67, 0xc5, 0x17, 0xd9, 0x53, 0x52, 0xbf,
71  0xa8, 0x87, 0xe6, 0x20, 0x2d, 0xd1, 0xe9, 0xb8, 0x82, 0x29, 0xac, 0xb1, 0x93, 0x63, 0x10, 0xf2,
72  0xa3, 0x7f, 0x60, 0x61, 0x31, 0xc3, 0x22, 0xa0, 0x7b, 0x88, 0x25, 0xf1, 0xbe, 0xee, 0x5b, 0x44,
73  0x43, 0xab, 0xb9, 0x84, 0x58, 0xb4, 0xf4, 0xf3, 0xf6, 0x61, 0x81, 0x31, 0x04, 0x9c, 0xf5, 0xff,
74  0xe2, 0x79, 0x65, 0x98, 0x6d, 0x1d, 0x4d, 0x00, 0xa8, 0x2d, 0x1d, 0x4f, 0xfd, 0x68, 0x7e, 0x7e,
75  0xb3, 0x0f, 0xda, 0x4c, 0x90, 0xe9, 0x89, 0x64, 0x3d, 0xbe, 0xdf, 0xd3, 0x31, 0x2f, 0x1a, 0x96,
76  0x89, 0xef, 0x00, 0x89, 0x7a, 0xe8, 0x56, 0xa1, 0x5a, 0x95, 0x66, 0xd4, 0x20, 0x0b, 0x20, 0xbc,
77  0xe7, 0xe6, 0xea, 0x55, 0xdd, 0xd3, 0x33, 0x9c, 0x37, 0x82, 0xcb, 0xc1, 0x8d, 0x40, 0xf3, 0x0f,
78  0x33, 0x13, 0x1f, 0xd4, 0x40, 0x65, 0xd1, 0x3f, 0xd1, 0xbb, 0xf6, 0x71, 0x88, 0xfc, 0x9c, 0xa4,
79  0x8b, 0xbe, 0x41, 0xf6, 0x11, 0x0b, 0x09, 0x7f, 0x1d, 0x72, 0x04, 0x05, 0x4b, 0xaf, 0xe8, 0x0b,
80  0x62, 0x7b, 0xce, 0xcf, 0x27, 0xd0, 0xb6, 0x19, 0x4a, 0x25, 0x94, 0x8f, 0x6a, 0x50, 0xa4, 0xec,
81  0x30, 0x19, 0xda, 0x08, 0xc7, 0xa1, 0x90, 0x2e, 0x83, 0x44, 0x16, 0x49, 0x6b, 0x69, 0x6c, 0x63,
82  0x17, 0x59, 0x28, 0xc9, 0xa9, 0x6f, 0xcb, 0xce, 0x22, 0x9f
83 };
84 
85 std::vector<unsigned char> example_B_request = {
86  0x01, 0x5d, // Total Bytes to read
87  0x00, // REQUEST_SERVER_LIST
88  0x01, // protocol_version
89  0x03, // encoding_version
90  0x00, 0x00, 0x00, 0x00, // game_version
91  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // for_gamename
92  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // from_gamename
93  0x3b, 0x6e, 0x32, 0x56, 0x72, 0x4d, 0x2a, 0x30, // client challenge
94 
95  // filter: gamever='V1.31a' and (teamplay=0 and numplayers<=23 and numplayers>=0 and numplayers!=maxplayers and nr<=2 and xr>=2)and (region & 1)=0
96  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x3d, 0x27, 0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x27,
97  0x20, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x3d, 0x30,
98  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3c,
99  0x3d, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65,
100  0x72, 0x73, 0x3e, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61,
101  0x79, 0x65, 0x72, 0x73, 0x21, 0x3d, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73,
102  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x72, 0x3c, 0x3d, 0x32, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x78,
103  0x72, 0x3e, 0x3d, 0x32, 0x29, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e,
104  0x20, 0x26, 0x20, 0x31, 0x29, 0x3d, 0x30, 0x00,
105 
106  // key_list: \hostname\gametype\gamever\hostport\timelimit\timeelapsed\mapname\numplayers\maxplayers\
107  teamplay\team_t\ping_\c0\c1\n0\n1\c0c\c1c\nr\xr\ff\mc\gc\rc\sr\ni\xi\qm
108  0x5c, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79,
109  0x70, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x70,
110  0x6f, 0x72, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5c, 0x74, 0x69,
111  0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5c, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d,
112  0x65, 0x5c, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x6d, 0x61, 0x78,
113  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79,
114  0x5c, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x5c, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x5c, 0x63, 0x30,
115  0x5c, 0x63, 0x31, 0x5c, 0x6e, 0x30, 0x5c, 0x6e, 0x31, 0x5c, 0x63, 0x30, 0x63, 0x5c, 0x63, 0x31,
116  0x63, 0x5c, 0x6e, 0x72, 0x5c, 0x78, 0x72, 0x5c, 0x66, 0x66, 0x5c, 0x6d, 0x63, 0x5c, 0x67, 0x63,
117  0x5c, 0x72, 0x63, 0x5c, 0x73, 0x72, 0x5c, 0x6e, 0x69, 0x5c, 0x78, 0x69, 0x5c, 0x71, 0x6d, 0x00,
118 
119  0x00, 0x00, 0x00, 0x80, // options
120  0x12, 0x00, 0x00, 0x00 // options max_results
121 };
122 
123 std::vector<unsigned char> example_B_response = {
124  // Crypt challenge
125  0xe6, // length
126  0xe2, 0x7f, 0x2f, 0x6e, 0x42, 0x18, 0x35, 0x59, 0x19, 0x1b, // data
127 
128  // Server challenge
129  0xf3, // length
130  0x7b, 0x7a, 0xbd, 0x2d, 0x2e, 0xb3, 0xa5, 0x7e, 0x9f, 0x91, 0x77, 0x74, 0xc0, 0xcd, 0x08, 0xf5, // data 1-16
131  0x86, 0x60, 0xc0, 0xf5, 0x4c, 0xa2, 0x74, 0x7b, 0x10, // data 17-25
132 
133  // Encrypted data
134  0x46, 0xb5, 0xa5, 0x93, 0xf3, 0xaa, 0x48, 0xc4, 0x5e, 0xdb, 0x1a, 0x64, 0xf4, 0xee, 0x6f, 0x43,
135  0xa7, 0x44, 0x73, 0x4b, 0x98, 0xa7, 0xe6, 0x96, 0xfb, 0x2f, 0xe4, 0xe2, 0xbd, 0xe6, 0x71, 0xae,
136  0x7b, 0x76, 0xee, 0x99, 0x36, 0xef, 0x3b, 0x62, 0xfd, 0xd6, 0xbb, 0x55, 0x88, 0xb4, 0x43, 0xe1,
137  0xd1, 0x85, 0x30, 0x2d, 0x45, 0xef, 0x08, 0x8f, 0x79, 0x6a, 0x78, 0xaf, 0x37, 0xe4, 0x79, 0x8d,
138  0xa8, 0x1d, 0x1b, 0xa5, 0x5e, 0x9a, 0x03, 0xa2, 0x9a, 0xb3, 0xa2, 0x0d, 0xf8, 0xc9, 0xe3, 0xf1,
139  0xce, 0xb3, 0x1d, 0x93, 0x6d, 0xc9, 0xf3, 0x25, 0x99, 0xb8, 0x77, 0xfb, 0xd4, 0x6b, 0x7b, 0x2c,
140  0x3c, 0xa3, 0xe0, 0x19, 0x8b, 0x6f, 0x2a, 0x79, 0xa7, 0x54, 0xc0, 0x9f, 0xa9, 0x7e, 0xea, 0x90,
141  0xe1, 0xd1, 0x22, 0x5c, 0x8f, 0x8a, 0x87, 0x76, 0x5c, 0x21, 0x01, 0x5c, 0x35, 0x0f, 0x20, 0xe4,
142  0x8b, 0x7f, 0xfc, 0x0f, 0xec, 0x32, 0x5a, 0x2c, 0xbd, 0x61, 0xdd, 0x11, 0xc6, 0x75, 0x21, 0x62,
143  0x89, 0x05, 0x6c, 0x0a, 0xc2, 0xf3, 0xfd, 0xfe, 0x73, 0xea, 0x41, 0x44, 0xb6, 0xb6, 0x1e, 0x2d,
144  0x15, 0x24, 0xf4, 0x64, 0x9c, 0x41, 0x06, 0x3f, 0xa8, 0xf8, 0x49, 0x3f, 0x63, 0x2f, 0xe0, 0x74,
145  0x31, 0xe8, 0x43, 0xa0, 0x23, 0x3d, 0xae, 0x4d, 0x5e, 0x95, 0xcf, 0xcd, 0x83, 0x3d, 0x25, 0xbd,
146  0x22, 0xaf, 0x72, 0x39, 0xc3, 0xea, 0x94, 0x72
147 };
148 
149 std::vector<unsigned char> example_C_request = {
150  0x01, 0x5e, // Total Bytes to read
151  0x00, // REQUEST_SERVER_LIST
152  0x01, // protocol_version
153  0x03, // encoding_version
154  0x00, 0x00, 0x00, 0x00, // game_version
155  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // for_gamename
156  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // from_gamename
157  0x34, 0x68, 0x6b, 0x54, 0x61, 0x5c, 0x2d, 0x6d, // client challenge
158 
159  // filter: gamever='V1.31a' and (teamplay=0 and numplayers<=23 and numplayers>=0 and numplayers!=maxplayers and nr<=2 and xr>=2)and (region & 1)!=0
160  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x3d, 0x27, 0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x27,
161  0x20, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x3d, 0x30,
162  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3c,
163  0x3d, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65,
164  0x72, 0x73, 0x3e, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61,
165  0x79, 0x65, 0x72, 0x73, 0x21, 0x3d, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73,
166  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x72, 0x3c, 0x3d, 0x32, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x78,
167  0x72, 0x3e, 0x3d, 0x32, 0x29, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e,
168  0x20, 0x26, 0x20, 0x31, 0x29, 0x21, 0x3d, 0x30, 0x00,
169 
170  // key_list: \hostname\gametype\gamever\hostport\timelimit\timeelapsed\mapname\numplayers\maxplayers\
171  teamplay\team_t\ping_\c0\c1\n0\n1\c0c\c1c\nr\xr\ff\mc\gc\rc\sr\ni\xi\qm
172  0x5c, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79,
173  0x70, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x70,
174  0x6f, 0x72, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5c, 0x74, 0x69,
175  0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5c, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d,
176  0x65, 0x5c, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x6d, 0x61, 0x78,
177  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79,
178  0x5c, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x5c, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x5c, 0x63, 0x30,
179  0x5c, 0x63, 0x31, 0x5c, 0x6e, 0x30, 0x5c, 0x6e, 0x31, 0x5c, 0x63, 0x30, 0x63, 0x5c, 0x63, 0x31,
180  0x63, 0x5c, 0x6e, 0x72, 0x5c, 0x78, 0x72, 0x5c, 0x66, 0x66, 0x5c, 0x6d, 0x63, 0x5c, 0x67, 0x63,
181  0x5c, 0x72, 0x63, 0x5c, 0x73, 0x72, 0x5c, 0x6e, 0x69, 0x5c, 0x78, 0x69, 0x5c, 0x71, 0x6d, 0x00,
182 
183  0x00, 0x00, 0x00, 0x80, // options
184  0x14, 0x00, 0x00, 0x00 // options max_results
185 };
186 
187 std::vector<unsigned char> example_C_response = {
188  // Crypt challenge
189  0xe6, // length
190  0x48, 0x3c, 0xdb, 0xb6, 0x0b, 0x68, 0x4f, 0x45, 0xb1, 0xcd, // data
191 
192  // Server challenge
193  0xf3, // length
194  0x8e, 0x71, 0x43, 0xfa, 0xdb, 0x0c, 0x42, 0xef, 0xaf, 0x68, 0xfb, 0x64, 0x4b, 0x53, 0xac, 0x69, // data 1-16
195  0xbf, 0x74, 0xe8, 0x4d, 0x6f, 0x30, 0x8a, 0x4a, 0xe6, // data 17-25
196 
197  // Encrypted data
198  0x92, 0xbd, 0x4c, 0xaf, 0x27, 0x6d, 0x87, 0x87, 0x3a, 0xfa, 0x44, 0x67, 0x16, 0xbc, 0x8e, 0x2e,
199  0xe0, 0x9f, 0xfb, 0x0d, 0xdf, 0x37, 0x5b, 0xe4, 0x8a, 0xc4, 0x06, 0x21, 0x7d, 0x55, 0x73, 0xfe,
200  0x5b, 0x22, 0x23, 0xd9, 0x9e, 0xd2, 0xe3, 0xbd, 0xd9, 0xd2, 0xcd, 0x2c, 0x6b, 0xc6, 0x2a, 0xe0,
201  0x34, 0x7b, 0xfd, 0x6a, 0xed, 0xad, 0xcf, 0xca, 0x88, 0x5e, 0xa3, 0x9e, 0xef, 0xc4, 0x0f, 0x95,
202  0x84, 0xf4, 0xaa, 0xd7, 0x04, 0x03, 0xfd, 0xfd, 0x0e, 0xc9, 0xd3, 0xeb, 0x78, 0x0c, 0x39, 0xc7,
203  0xbb, 0xe8, 0xa3, 0x8a, 0x49, 0x31, 0xb1, 0xe1, 0xde, 0x74, 0x40, 0x48, 0x37, 0x45, 0x1a, 0x4f,
204  0xb3, 0x3a, 0xc8, 0x2c, 0x5d, 0x22, 0xd3, 0x59, 0xb1, 0x40, 0x54, 0x21, 0xdd, 0x20, 0xa4, 0x89,
205  0x26, 0xfc, 0x2c, 0x45, 0x12, 0x7e, 0x0e, 0x67, 0xc9, 0x53, 0xb2, 0x05, 0xa6, 0xbc, 0x74, 0xba,
206  0x63, 0x21, 0x82, 0x49, 0x68, 0xd7, 0x26, 0x39, 0xc3, 0xdc, 0x56, 0xee, 0x36, 0x24, 0xd6, 0x93,
207  0x83, 0xe6, 0x8a, 0x84, 0x53, 0x00, 0x80, 0xb9, 0x5c, 0x19, 0xf4, 0xa6, 0x54, 0xc3, 0xc0, 0xa4,
208  0x1a, 0x0b, 0x03, 0x32, 0xb2, 0x5f, 0x6f, 0x83, 0xef, 0x38, 0xed, 0x5a, 0x39, 0xa2, 0xbe, 0x0d,
209  0x8b, 0xa8, 0x14, 0xaf, 0xaa, 0x8f, 0x3a, 0x37, 0xc5, 0xab, 0x0a, 0x01, 0x8a, 0x67, 0xc2, 0x62,
210  0xac, 0x53, 0x19, 0xd1, 0x51, 0xa2, 0x81, 0x05, 0xc3, 0x6a, 0xde, 0x17, 0xb3, 0x4a, 0x5d, 0xc2,
211  0xb4, 0xe6, 0x91, 0x02, 0x4a, 0x0b, 0x75, 0x70, 0x86, 0xe1, 0xe8, 0x93, 0x3f, 0x7c, 0x5a, 0xc8,
212  0x55, 0xd7, 0x04, 0x7a, 0x7a, 0x46, 0x4f, 0x5d, 0x88, 0x13
213 };
214 
215 std::vector<unsigned char> example_D_request = {
216  0x01, 0x5d, // Total Bytes to read
217  0x00, // REQUEST_SERVER_LIST
218  0x01, // protocol_version
219  0x03, // encoding_version
220  0x00, 0x00, 0x00, 0x00, // game_version
221  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // for_gamename
222  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // from_gamename
223  0x25, 0x70, 0x24, 0x56, 0x7c, 0x29, 0x3e, 0x5d, // client challenge
224 
225  // filter: gamever='V1.31a' and (teamplay=0 and numplayers<=23 and numplayers>=0 and numplayers!=maxplayers and nr<=2 and xr>=2)and (region & 1)=0
226  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x3d, 0x27, 0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x27,
227  0x20, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x3d, 0x30,
228  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3c,
229  0x3d, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65,
230  0x72, 0x73, 0x3e, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61,
231  0x79, 0x65, 0x72, 0x73, 0x21, 0x3d, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73,
232  0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x72, 0x3c, 0x3d, 0x32, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x78,
233  0x72, 0x3e, 0x3d, 0x32, 0x29, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e,
234  0x20, 0x26, 0x20, 0x31, 0x29, 0x3d, 0x30, 0x00,
235 
236  // key_list
237  0x5c, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79,
238  0x70, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x70,
239  0x6f, 0x72, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5c, 0x74, 0x69,
240  0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5c, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d,
241  0x65, 0x5c, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x6d, 0x61, 0x78,
242  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79,
243  0x5c, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x5c, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x5c, 0x63, 0x30,
244  0x5c, 0x63, 0x31, 0x5c, 0x6e, 0x30, 0x5c, 0x6e, 0x31, 0x5c, 0x63, 0x30, 0x63, 0x5c, 0x63, 0x31,
245  0x63, 0x5c, 0x6e, 0x72, 0x5c, 0x78, 0x72, 0x5c, 0x66, 0x66, 0x5c, 0x6d, 0x63, 0x5c, 0x67, 0x63,
246  0x5c, 0x72, 0x63, 0x5c, 0x73, 0x72, 0x5c, 0x6e, 0x69, 0x5c, 0x78, 0x69, 0x5c, 0x71, 0x6d, 0x00,
247 
248  0x00, 0x00, 0x00, 0x80, // options
249  0x12, 0x00, 0x00, 0x00 // options max_results
250 };
251 
252 std::vector<unsigned char> example_D_response = {
253  // Crypt challenge
254  0xe6, // length
255  0x48, 0x3c, 0xdb, 0xb6, 0x0b, 0x68, 0x4f, 0x45, 0xb1, 0xcd, // data
256 
257  // Server challenge
258  0xf3, // length
259  0x8e, 0x71, 0x43, 0xfa, 0xdb, 0x0c, 0x42, 0xef, 0xaf, 0x68, 0xfb, 0x64, 0x4b, 0x53, 0xac, 0x69, // data 1-16
260  0xbf, 0x74, 0xe8, 0x4d, 0x6f, 0x30, 0x8a, 0x4a, 0xe6, // data 17-25
261 
262  // Encrypted data
263  0xa6, 0x4e, 0x0e, 0xe7, 0xbc, 0xdf, 0xa6, 0xc1, 0x47, 0x28, 0x28, 0x44, 0xeb, 0x9e, 0xac, 0x94,
264  0x71, 0x36, 0xcf, 0xed, 0x49, 0x98, 0x2d, 0xa9, 0x44, 0xbf, 0xe6, 0xc2, 0x6d, 0xa9, 0x15, 0x00,
265  0x83, 0xa6, 0x30, 0xe6, 0x63, 0x9a, 0xcb, 0x85, 0x91, 0xad, 0xfe, 0x22, 0x1b, 0xac, 0x27, 0xe4,
266  0xee, 0x4a, 0xe6, 0x31, 0x03, 0x18, 0x30, 0x31, 0x2b, 0xb5, 0xca, 0x60, 0xd7, 0xc6, 0x64, 0x25,
267  0x0c, 0x20, 0x08, 0x47, 0x95, 0x50, 0x98, 0xb5, 0xd3, 0xa8, 0x6c, 0x4d, 0x1e, 0x27, 0x43, 0xc0,
268  0x8e, 0xf3, 0x9d, 0xfd, 0x83, 0xb6, 0x4d, 0x4c, 0x6b, 0x39, 0x72, 0x0d, 0x1a, 0x97, 0x55, 0x4c,
269  0x7f, 0xe5, 0xf4, 0x32, 0x82, 0xd4, 0x29, 0xe1, 0x29, 0x4a, 0x4a, 0x68, 0x28, 0x62, 0xe6, 0xbe,
270  0xed, 0xfa, 0xd2, 0x63, 0xc1, 0x1d, 0x54, 0xaf, 0xcc, 0x68, 0x11, 0x1e, 0x3e, 0xda, 0xb3, 0x65,
271  0x9f, 0x1a, 0x61, 0x99, 0xcd, 0x3d, 0x2f, 0x47, 0xaf, 0xdb, 0x52, 0xb4, 0xa2, 0x62, 0xd5, 0xee,
272  0x5b, 0xb1, 0x32, 0xd9, 0xea, 0x82, 0xac, 0x43, 0xab, 0x5c, 0x77, 0xd9, 0xab, 0x4b, 0xf0, 0x07,
273  0x58, 0x6f, 0x9d, 0xf3, 0x64, 0xd2, 0x37, 0x8d, 0x2e, 0x72, 0x45, 0x84, 0x89, 0x18, 0x98, 0x9c,
274  0x13, 0x7e, 0x1a, 0x89, 0x29, 0x6b, 0x5b, 0x0b, 0x08, 0x0b, 0x7f, 0x11, 0x41, 0x50, 0x1e, 0x55,
275  0x6e, 0xa9, 0x13, 0x99, 0x88, 0xcc, 0xf0, 0x76
276 };
277 
278 std::vector<unsigned char> example_C_decrypt_data = {
279  // Request
280  0x56, 0x57, 0x8b, 0xeb, // Request ip: 86.87.139.235
281  0x19, 0x64, // Requested: port 6500
282 
283  // Accepted server values
284  0x1c, 0x00, // Total header items: 28
285  0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, // hostname
286  0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // gametype
287  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x00, // gamever
288  0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x00, // hostport
289  0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00, 0x00, // timelimit
290  0x74, 0x69, 0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x00, 0x00, // timeelapsed
291  0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, // mapname
292  0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00, // numplayers
293  0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00, // maxplayers
294  0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x00, 0x00, // teamplay
295  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x00, 0x00, // team_t
296  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, // ping_
297  0x63, 0x30, 0x00, 0x00, // c0
298  0x63, 0x31, 0x00, 0x00, // c1
299  0x6e, 0x30, 0x00, 0x00, // n0
300  0x6e, 0x31, 0x00, 0x00, // n1
301  0x63, 0x30, 0x63, 0x00, 0x00, // c0c
302  0x63, 0x31, 0x63, 0x00, 0x00, // c1c
303  0x6e, 0x72, 0x00, 0x00, // nr
304  0x78, 0x72, 0x00, 0x00, // xr
305  0x66, 0x66, 0x00, 0x00, // ff
306  0x6d, 0x63, 0x00, 0x00, // mc
307  0x67, 0x63, 0x00, 0x00, // gc
308  0x72, 0x63, 0x00, 0x00, // rc
309  0x73, 0x72, 0x00, 0x00, // sr
310  0x6e, 0x69, 0x00, 0x00, // ni
311  0x78, 0x69, 0x00, 0x00, // xi
312  0x71, 0x6d, 0x00, 0x00, // qm
313 
314  // New server
315  0x3b, // flags: FLAG_UNSOLICITED_UDP | FLAG_PRIVATE_IP | FLAG_ICMP_IP |
316  // FLAG_NONSTANDARD_PORT | FLAG_NONSTANDARD_PRIVATE_PORT
317  0xa8, 0x77, 0xbd, 0x95, // wan ip: 168.119.189.149
318  0x0e, 0x4a, // FLAG_NONSTANDARD_PORT -> wan port: 3658
319  0xa8, 0x77, 0xbd, 0x95, // FLAG_PRIVATE_IP -> localip0 ip: 168.119.189.149
320  0x0e, 0x4a, // FLAG_NONSTANDARD_PRIVATE_PORT -> localport: 3658
321  0xa8, 0x77, 0xbd, 0x95, // FLAG_ICMP_IP -> icmp ip: 168.119.189.149
322 
323  // New server
324  0x3b, // flags: FLAG_UNSOLICITED_UDP | FLAG_PRIVATE_IP | FLAG_ICMP_IP |
325  // FLAG_NONSTANDARD_PORT | FLAG_NONSTANDARD_PRIVATE_PORT
326  0x4e, 0x2f, 0xb8, 0x17, // wan ip: 78.47.184.23
327  0x0e, 0x4a, // FLAG_NONSTANDARD_PORT -> wan port: 3658
328  0x4e, 0x2f, 0xb8, 0x17, // FLAG_PRIVATE_IP -> localip0 ip: 78.47.184.23
329  0x0e, 0x4a, // FLAG_NONSTANDARD_PRIVATE_PORT -> localport: 3658
330  0x4e, 0x2f, 0xb8, 0x17, // FLAG_ICMP_IP -> icmp ip: 78.47.184.23
331 
332  // No more server information
333  0x00,
334 
335  // End decrypted data
336  0xff, 0xff, 0xff, 0xff
337 };
338 
339 std::vector<unsigned char> example_D_decrypt_data = {
340  // Request
341  0x56, 0x57, 0x8b, 0xeb, // Request ip: 86.87.139.235
342  0x19, 0x64, // Requested: port 6500
343 
344  // Accepted server values
345  0x1c, 0x00, // Total header items: 28
346  0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, // hostname
347  0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, // gametype
348  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x00, // gamever
349  0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x00, // hostport
350  0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00, 0x00, // timelimit
351  0x74, 0x69, 0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x00, 0x00, // timeelapsed
352  0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, // mapname
353  0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00, // numplayers
354  0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00, // maxplayers
355  0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x00, 0x00, // teamplay
356  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x00, 0x00, // team_t
357  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, // ping_
358  0x63, 0x30, 0x00, 0x00, // c0
359  0x63, 0x31, 0x00, 0x00, // c1
360  0x6e, 0x30, 0x00, 0x00, // n0
361  0x6e, 0x31, 0x00, 0x00, // n1
362  0x63, 0x30, 0x63, 0x00, 0x00, // c0c
363  0x63, 0x31, 0x63, 0x00, 0x00, // c1c
364  0x6e, 0x72, 0x00, 0x00, // nr
365  0x78, 0x72, 0x00, 0x00, // xr
366  0x66, 0x66, 0x00, 0x00, // ff
367  0x6d, 0x63, 0x00, 0x00, // mc
368  0x67, 0x63, 0x00, 0x00, // gc
369  0x72, 0x63, 0x00, 0x00, // rc
370  0x73, 0x72, 0x00, 0x00, // sr
371  0x6e, 0x69, 0x00, 0x00, // ni
372  0x78, 0x69, 0x00, 0x00, // xi
373  0x71, 0x6d, 0x00, 0x00, // qm
374 
375  // No more server information
376  0x00,
377 
378  // End decrypted data
379  0xff, 0xff, 0xff, 0xff
380 };
381 
382 std::vector<unsigned char> example_E_1_request = {
383  0x00, 0x33, // Total Bytes to read
384  0x00, // REQUEST_SERVER_LIST
385  0x01, // protocol_version
386  0x03, // encoding_version
387  0x00, 0x00, 0x00, 0x00, // game_version
388  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // for_gamename
389  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, // from_gamename
390  0x66, 0x59, 0x35, 0x70, 0x68, 0x39, 0x33, 0x3a,
391 
392  // ????
393  0x00, 0x00, 0x00, 0x00, 0x00, 0x02
394 };
395 
396 std::vector<unsigned char> example_E_1_response = {
397 };
398 
399 std::vector<unsigned char> example_E_2_request = {
400  0x09, // Total Bytes to read
401  0x01, // REQUEST_SERVER_INFO
402 
403  0x4e, 0x2f, 0xb8, 0x17, // ip
404  0x0e, 0x4a // port
405 };
406 
407 std::vector<unsigned char> example_E_2_response = {
408  // Crypt challenge
409  0xe6,
410  0xff, 0x1c, 0xf3, 0x4c, 0x8d, 0xc4, 0x5a, 0x52, 0x2b, 0x58,
411 
412  // Server challenge
413  0xf3,
414  0x28, 0x00, 0x41, 0xbd, 0x53, 0xd3, 0x37, 0x96, 0x63, 0xf3, 0xd3, 0x0c, 0xe6, 0x16, 0xa6, 0x39,
415  0x0b, 0x2e, 0x27, 0x1d, 0xd8, 0x26, 0x39, 0xcb, 0x72,
416 
417  // Encrypted data
418  0x34, 0x13, 0xba, 0x57, 0xd7, 0xf2,
419 
420  // Encrypted data in second packet
421  0x43, 0x1b, 0xcd, 0xae, 0xe3, 0x3d, 0xfa, 0x71, 0x63, 0xb0, 0x00, 0xda, 0x5c, 0xb5, 0x4b, 0x92,
422  0xeb, 0x79, 0x44, 0x21, 0xd0, 0x41, 0x28, 0x78, 0x8c, 0x06, 0x5c, 0x95, 0x38, 0xa2, 0x7a, 0x8d,
423  0x91, 0xbb, 0x2c, 0xdb, 0x47, 0x62, 0x03, 0x43, 0x82, 0xf5, 0xe1, 0x38, 0xb3, 0xe5, 0xcd, 0xdb,
424  0x0f, 0xe2, 0x52, 0x5c, 0xd9, 0x84, 0xce, 0xc1, 0x60, 0x5e, 0x96, 0x4a, 0x1a, 0x54, 0xc1, 0xed,
425  0xfd, 0x8e, 0x5b, 0xce, 0x73, 0xdd, 0xe1, 0x46, 0xc4, 0x72, 0x0c, 0xd1, 0xd3, 0x7d, 0xb1, 0x7c,
426  0x1a, 0x1c, 0x5c, 0x90, 0x5a, 0x03, 0x8c, 0x26, 0x2f, 0xb7, 0x4a, 0x3e, 0x39, 0x65, 0xa6, 0x62,
427  0x07, 0x58, 0x02, 0x46, 0x26, 0x03, 0x75, 0x74, 0xc0, 0x74, 0x0b, 0xde, 0x82, 0x84, 0x3c, 0x61,
428  0x05, 0x75, 0x9b, 0x70, 0x8d, 0xf6, 0x53, 0x47, 0x53, 0x05, 0x23, 0x1d, 0xa0, 0x2d, 0x8e, 0xf9,
429  0xf3, 0x33, 0x5d, 0x44, 0xbd, 0xaa, 0x8c, 0xcc, 0xbb, 0x74, 0xa7, 0x5c, 0x53, 0x66, 0xfc, 0x8e,
430  0x72, 0x19, 0xef, 0x1e, 0xb4, 0x44, 0x35, 0xe6, 0x98, 0x5a, 0xac, 0xb8, 0xdb, 0x97, 0xeb, 0xd1,
431  0x8d, 0x64, 0xcd, 0x79, 0x07, 0x41, 0x9a, 0x40, 0x7e, 0xb0, 0x3b, 0xdd, 0xb8, 0x0d, 0xcc, 0xe0,
432  0xda, 0xc0, 0xc9, 0x7a, 0xea, 0x5c, 0xc9, 0x11, 0xb5, 0xad, 0xb9, 0x80, 0x75, 0xd9, 0x98, 0xf9,
433  0x73, 0x40, 0xcc, 0xcc, 0xe0, 0x77, 0xf1, 0xc3, 0xbc, 0x9b, 0xa1, 0x9d, 0x95, 0x21, 0x6c, 0x83,
434  0x39, 0x97, 0x37, 0x7d, 0x87, 0x33, 0xab, 0x72, 0xf6, 0x7a, 0x70, 0xff, 0x5d, 0xbf, 0xae, 0xd2,
435  0x71, 0x2c, 0x01, 0x4e, 0x76, 0x3b, 0x32, 0x64, 0x80, 0x40, 0xd4, 0x4a, 0xd7, 0x53, 0x2b, 0x81,
436  0x14, 0xf5, 0xdf, 0xd0, 0x77, 0x51, 0x71, 0xd3, 0x35, 0x4a, 0x0a, 0xa1, 0x00, 0xcf, 0xec, 0x59,
437  0x4e, 0x08, 0xda, 0x86, 0xdd, 0x0d, 0xc8, 0x8a, 0xd6, 0x4a, 0xf6, 0x49, 0xe3, 0xba, 0xbb, 0xac,
438  0x1e, 0xd4, 0x48, 0xa4, 0xa5, 0xfb, 0x39, 0x95, 0x37, 0x49, 0x1c, 0x55, 0xa5, 0x87, 0x97, 0x74,
439  0x1b, 0x63, 0xc4, 0x6c, 0x31, 0xe0, 0xb3, 0x55, 0x4a, 0x85, 0xd2, 0x91, 0x4d, 0x77, 0xc4, 0x25,
440  0xd1, 0x6c, 0xd2, 0xc7, 0xcf, 0x1c, 0x39, 0x0d, 0xa6, 0x93, 0x9c, 0x71, 0x95, 0xe1, 0x9f, 0x58,
441  0x4a, 0x6a, 0x06, 0x0f, 0xbe, 0x2b, 0x6c, 0x0b, 0x39, 0x03, 0xca, 0xac, 0x95, 0xb7, 0x3a, 0xc6,
442  0xaa, 0x88, 0xa0, 0x6d, 0x22, 0xd6, 0x24, 0x39, 0xef, 0x8a, 0x54, 0x3b, 0x86, 0xe0, 0xc7, 0x5f,
443  0x46, 0xfe, 0x74, 0x02, 0x10, 0x3a, 0x07, 0x90, 0x41, 0x0b, 0xa0, 0x28, 0xea, 0x52, 0xdb, 0x12,
444  0xee, 0xed, 0xe1, 0xf3, 0x1c, 0x88, 0x56, 0x54, 0xa2, 0x1a, 0xf4, 0x58, 0xd0, 0xee, 0xb5, 0x79,
445  0x5d, 0x62, 0x91, 0x03, 0xfd, 0xd4, 0xc4, 0xe6, 0x51, 0x2b, 0x61, 0x9a, 0xd4, 0xe8, 0x0f, 0x5a,
446  0xaf, 0x38, 0x7a, 0x0c, 0xfa, 0x73, 0x8e, 0xb6, 0xe2, 0xa6, 0x55, 0xd0, 0x4e, 0xbb, 0x84, 0x8b,
447  0x7c, 0xc7, 0xc8, 0x9f, 0x47, 0xe7, 0x51, 0xe3, 0xfe, 0x87, 0x4c, 0x06, 0x3c, 0xfc, 0x07, 0x8d,
448  0x3d, 0x5d, 0xc2, 0x54, 0xe8, 0xba, 0x76, 0x54, 0x2d, 0x7f, 0x11, 0x2f, 0x27, 0x05, 0x79, 0x4a,
449  0xf7, 0x3c, 0xdc, 0xcf, 0x09, 0x31, 0x6b, 0xb1, 0x66, 0x2d, 0x46, 0x99, 0x25, 0x52, 0xbe, 0x4e,
450  0x60, 0x57, 0xb5, 0x19, 0xf1, 0x3d, 0x37, 0xb5, 0x29, 0x18, 0x7e, 0x0b, 0x9c, 0x14, 0x26, 0x91,
451  0xa9, 0x98, 0xea, 0x75, 0xe5, 0x8a, 0x91, 0x73, 0xf0, 0xe4, 0x85, 0xc4, 0xaa, 0x4a, 0xec, 0x43,
452  0xaf, 0x8b, 0x95, 0xfe, 0xe0, 0xdd, 0xfd, 0xf4, 0x2f, 0x8c, 0x8d, 0x5b, 0x26, 0x0c, 0x6d, 0x30,
453  0x04, 0xcf, 0x89, 0x30, 0x69, 0x70, 0xbf, 0xbc, 0x62, 0x2f, 0x52, 0xe3, 0x23, 0x04, 0x11, 0x22,
454  0xbe, 0x6f, 0xda, 0x91, 0xdb, 0x72, 0x6b, 0x21, 0x63, 0x0d, 0x43, 0x1f, 0x2b, 0xbf, 0xba, 0xd7,
455  0x65, 0xbb, 0x05, 0x59, 0x80, 0xe6, 0xc4, 0xda, 0x64, 0x44, 0x86, 0x90, 0x49, 0xd4, 0x4b, 0x74,
456  0x5f, 0x1a, 0x31, 0xb4, 0x62, 0x88, 0x93, 0x0c, 0x01, 0x25, 0x03, 0x2a, 0x7b, 0x42, 0xba, 0x7d,
457  0x7e, 0xfb, 0x0b, 0x3b, 0x5d, 0x25, 0x04, 0x14, 0x4c, 0x6b, 0x68, 0xee, 0x52, 0x05, 0x9b, 0xe8,
458  0x3c, 0xc6, 0xa2, 0x48, 0x14, 0x89, 0xe9, 0x1e, 0xc3, 0x64, 0xe4, 0x0a, 0xc7, 0x64, 0xb4, 0xb9,
459  0x3e, 0xcd, 0x37, 0xb1, 0x25, 0xae, 0x51, 0x13, 0x6a, 0xd1, 0xf4, 0xb1, 0x48, 0x9f, 0x67, 0x60,
460  0x3f, 0x06, 0x19, 0x7f, 0x23, 0x68, 0x29, 0x94, 0x0f, 0x1c, 0x4b, 0x2f, 0x30, 0xb5, 0x7f, 0x2c,
461  0x2f, 0x3d, 0x0f, 0xa1, 0xc6, 0x78, 0xab, 0xae, 0xa1, 0xfa, 0xff, 0xd3, 0x1f, 0x96, 0xd9, 0x17,
462  0x00, 0x9f, 0xdc, 0xa6, 0xd1, 0x1e, 0x0f, 0xee, 0xbe, 0xab, 0xa5, 0xd4, 0xf0, 0x4d, 0xb8, 0xd6,
463  0x88, 0x32, 0x7f, 0xc5, 0x44, 0x3e, 0x6c, 0x31, 0xfa, 0xb2, 0x4a, 0xc7, 0x9c, 0xc0, 0x0e, 0x10,
464  0xdb, 0xaf, 0x72, 0x1f, 0x82, 0x6b, 0xbf, 0xdd, 0xd0, 0xdd, 0x43, 0x88, 0xc0, 0x47, 0xae, 0xfe,
465  0x12, 0x19, 0x45, 0x80, 0x68, 0x24, 0x13, 0xf6, 0xc9, 0x8c, 0xd7, 0x51, 0xf9, 0x60, 0x46, 0xcd,
466  0xb5, 0x95, 0xb5, 0x75, 0xa1, 0xba, 0xfa, 0xe1, 0x64, 0xc8, 0x42, 0x58, 0x7a, 0x19, 0xfa, 0x9d,
467  0x01, 0x57, 0xbc, 0xfa, 0xa3, 0x64, 0x89, 0xad, 0xbd, 0x4e, 0xba, 0x03, 0x08, 0xb4, 0xe5, 0x8f,
468  0xec, 0x61, 0x5a, 0x69, 0x71, 0xab, 0xa9, 0x49, 0x8b, 0xb8, 0x32, 0xae, 0xcb, 0x23, 0x8c, 0xd8,
469  0xff, 0xfe, 0xc7, 0xf9, 0xe1, 0x7e, 0x96, 0x72, 0x02, 0x44, 0x76, 0x60, 0x26, 0xa3, 0xf5, 0xe9,
470  0x79, 0x8f, 0xd0, 0xaf, 0xf3, 0x7a, 0xca, 0x2a, 0x28, 0xef, 0xe8, 0xe3, 0x77, 0xe0, 0xaf, 0x8e,
471  0x97, 0x34, 0x17, 0x00, 0xbf, 0x20, 0xcb, 0xa5, 0xff, 0x4a, 0xb0, 0x8d, 0xbd, 0xa5, 0x7c, 0x10,
472  0xde, 0xf0, 0x42, 0x64, 0x55, 0x1b, 0x62, 0x47, 0xce, 0x58, 0xf0, 0x8c, 0xcc, 0x44, 0x9c, 0xbb,
473  0x84, 0xfb, 0xe6, 0x2d, 0x20, 0x2f, 0xb2, 0xbd, 0xd0, 0x52, 0x57, 0xfa, 0x93, 0x2a, 0xd5, 0xd6,
474  0x15, 0x4b, 0xee, 0x1a, 0x82, 0x7f, 0xb4, 0x84, 0x89, 0x86, 0x2e, 0xdb, 0x1a, 0x75, 0x3b, 0x62,
475  0x14, 0xdc, 0x73, 0x9f, 0x16, 0xd2, 0xa0, 0x98, 0x1e, 0xe1, 0xdd, 0xb3, 0xa3, 0x77, 0xb4, 0x1d,
476  0x21, 0x3a, 0xe9, 0x07, 0xcd, 0x36, 0x97, 0xda, 0x9c, 0xde, 0x8c, 0xc7, 0xb6, 0xe3, 0xcd, 0x34,
477  0xcf, 0x6f, 0x1b, 0x3d, 0xca, 0xd8, 0x47, 0x6a, 0x9f, 0x0a, 0xfd, 0x42, 0xf6, 0x25, 0xcd, 0x62,
478  0x54, 0x19, 0x80, 0xb7, 0x39, 0x2b, 0xe1, 0xde, 0xcc, 0x09, 0x23, 0x7f, 0x71, 0xc1, 0x20, 0xa1,
479  0x88, 0x43, 0x6f, 0xb5, 0x50, 0xe3, 0x65, 0x87, 0x71, 0xce, 0xdd, 0x5d, 0x6f, 0xf1, 0x74, 0xb8,
480  0xdc, 0x34, 0xb7, 0x14, 0x12, 0x85, 0x90, 0x22, 0xbc, 0x1a, 0x27, 0x98, 0x17, 0x60, 0x71, 0x8f,
481  0x3f, 0x3e, 0x47, 0x98, 0x09, 0xaa, 0xfd, 0x96, 0xc3, 0xac, 0xda, 0x58, 0xcd, 0x40, 0xd4, 0x29,
482  0x6d, 0x75, 0xf9, 0x93, 0xb7, 0x12, 0x99, 0x5b, 0x6e, 0xee, 0xb9, 0x06, 0x11, 0x57, 0xc4, 0x7e,
483  0x86, 0xda, 0x48, 0x55, 0x6d, 0xa5, 0x0e, 0x4c, 0xe8, 0xdf, 0x14, 0x48, 0xbe, 0xa0, 0xa8, 0xc0,
484  0x56, 0x0f, 0x38, 0x7b, 0x55, 0x99, 0x32, 0xd4, 0x9a, 0xab, 0x8f, 0x1a, 0xcc, 0x1b, 0x0a, 0xfb,
485  0x4b, 0xde, 0x05, 0x5b, 0xb9, 0x1d, 0x1c, 0x11, 0xa7, 0x5f, 0x5d, 0x76, 0xd7, 0x56, 0xe1, 0x71,
486  0x0d, 0x3c, 0xa7, 0x2d, 0xa4, 0xde, 0xa7, 0x11, 0x3f, 0x1c, 0xb7, 0x67, 0x40, 0x64, 0xe5, 0xc5,
487  0x71, 0xec, 0x19, 0xf0, 0xd8, 0x33, 0xca, 0xe5, 0xf9, 0x95, 0x47, 0xaa, 0x10, 0x72, 0x48, 0x9f,
488  0x8d, 0xf2, 0xef, 0x79, 0x09, 0xc5, 0xae, 0x71, 0x5a, 0x4d, 0x53, 0x11, 0x93, 0x0c, 0x74, 0xec,
489  0xd5, 0x08, 0x98, 0x25, 0x97, 0x99, 0x1a, 0xd5, 0x98, 0x5e, 0xe8, 0x23, 0xbe, 0x5d, 0x31, 0xc8,
490  0x6a, 0x2b, 0x77, 0x8c, 0x23, 0xc9, 0x63, 0x9a, 0x99, 0x4f, 0x08, 0xb8, 0xdb, 0x13, 0xd6, 0x89,
491  0xb0, 0xe0, 0x55, 0xa1, 0xa9, 0xb4, 0x0c, 0xa5, 0x3a, 0xcf, 0x78, 0xd0, 0xcb, 0x00, 0xad, 0xcd,
492  0x6c, 0x28, 0x6f, 0xd0, 0xaa, 0x28, 0x42, 0xc7, 0x9e, 0x28, 0x67, 0xf6, 0xbe, 0x51, 0x2a, 0xcf,
493  0x6a, 0x3d, 0x06, 0x88, 0xf8, 0x7b, 0x32, 0x21, 0xe3, 0xeb, 0x34, 0xfe, 0x19, 0x5d, 0xd4, 0xcf,
494  0x5d, 0x55, 0x99, 0x67, 0x0a, 0x59, 0x40, 0x10, 0xfc, 0xd8, 0x47, 0x39, 0xe5, 0x14, 0x37, 0x72,
495  0x82, 0xc1, 0x25, 0xf1, 0x61, 0x56, 0xb2, 0x83, 0xc0, 0xa7, 0x56, 0x90, 0x89, 0x60, 0x42, 0xea,
496  0x77, 0xcc, 0x79, 0xb3, 0x52, 0xca, 0x6c, 0xd2, 0xdb, 0x91, 0x15, 0x6c, 0x50, 0x3a, 0xa9, 0xa7,
497  0x08, 0x54, 0xdc, 0x5e, 0xac, 0xbb, 0x3e, 0x30, 0x4f, 0xf9, 0xe2, 0xac, 0x1e, 0xe7, 0xef, 0xfc,
498  0xa9, 0x90, 0x2d, 0x22, 0x06, 0x4c, 0x98, 0x08, 0x54, 0x12, 0x5a, 0xbc, 0x7c, 0xe7, 0x60, 0x5e,
499  0xdd, 0xae, 0x2d, 0xc9, 0x94, 0x8c, 0xd0, 0x31, 0xbc, 0x5d, 0x77, 0xf3, 0xac, 0x68, 0x7e, 0x16,
500  0xd3, 0xfe, 0x40, 0x62, 0xb9, 0xff, 0x62, 0x3c, 0xcc, 0xbd, 0x0a, 0xfb, 0xb1, 0x26, 0x0a, 0x88,
501  0xc1, 0x2c, 0xfb, 0x5e, 0xc6, 0xfc, 0x96, 0x83, 0xda, 0x37, 0x8c, 0xe4, 0x42, 0xe3, 0xcd, 0xdb,
502  0x2a, 0x2d, 0x27, 0x75, 0x0a, 0x58, 0x6e, 0x5a, 0x12, 0xb9, 0xd9, 0x55, 0xf0, 0xf7, 0xbb, 0x71,
503  0x6c, 0xa6, 0x50, 0xa3, 0xed, 0x39, 0xcf, 0xb1, 0x16, 0x2e, 0x3b, 0x47, 0x4e, 0xb7, 0x7b, 0x5c,
504  0x6b, 0x50, 0x42, 0xf9, 0x3e, 0x2e, 0x8e, 0xe8, 0xa5, 0xa0, 0xb6, 0xe0, 0x4a, 0xc2, 0x6f, 0xcf,
505  0x24, 0x5e, 0xfe, 0x43, 0xbf, 0x15, 0x38, 0x74, 0x6e, 0x23, 0x67, 0xe5, 0xd3, 0x03, 0x07, 0xa1,
506  0xc8, 0x19, 0x65, 0x2c, 0x4b, 0xf5, 0x1f, 0xd2, 0x65, 0xd8, 0x82, 0x05, 0x1a, 0x85, 0x6b, 0x3a,
507  0x7f, 0x3b, 0x23, 0x9e, 0x82, 0x07, 0xb8, 0xac, 0x87, 0x54, 0xf4, 0xc6, 0x45, 0x32, 0x0c, 0xf8,
508  0xe3, 0xe4, 0x1f, 0x86, 0x49, 0xd2, 0x04, 0xdb, 0x2e, 0xc8, 0x27, 0x5e, 0xf2, 0xfa, 0x7d, 0xa3,
509  0x20, 0x0b, 0x40, 0xe6, 0x9b, 0x1c, 0x31, 0xb4, 0x79, 0xf3, 0x5e, 0x61, 0xd6, 0x8c, 0x3f, 0x27,
510  0xd0, 0x0e, 0xcf, 0x6f, 0x9f, 0x76, 0xe0, 0x12, 0x25, 0xe2, 0xac, 0x1a, 0xf5, 0x24, 0x5f, 0x73,
511  0x18, 0x10, 0xe1, 0x25, 0x05, 0xbc, 0xda, 0x2f
512 };
513 
514 std::vector<unsigned char> example_E_2_decrypt_data = {
515  // Request
516  0x56, 0x57, 0x8b, 0xeb, // Request ip: 86.87.139.235
517  0x19, 0x64, // Requested: port 6500
518 
519  0x05, 0xa8, // Total Bytes to read
520  0x02, // ???
521 
522  // Server information
523  0xbb, // flags: FLAG_UNSOLICITED_UDP | FLAG_PRIVATE_IP | FLAG_ICMP_IP |
524  // FLAG_NONSTANDARD_PORT | FLAG_NONSTANDARD_PRIVATE_PORT |
525  // FLAG_HAS_FULL_RULES
526  0x4e, 0x2f, 0xb8, 0x17, // wan ip: 78.47.184.23
527  0x0e, 0x4a, // FLAG_NONSTANDARD_PORT -> wan port: 3658
528  0x4e, 0x2f, 0xb8, 0x17, // FLAG_PRIVATE_IP -> localip0 ip: 78.47.184.23
529  0x0e, 0x4a, // FLAG_NONSTANDARD_PRIVATE_PORT -> localport: 3658
530  0x4e, 0x2f, 0xb8, 0x17, // FLAG_ICMP_IP -> icmp ip: 78.47.184.23
531 
532  // backend_id = bfield1942ps2:1508534:
533  0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x69, 0x64, 0x00,
534  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x3a, 0x31, 0x35,
535  0x30, 0x38, 0x35, 0x33, 0x34, 0x3a, 0x00,
536 
537  // cl = 100.216335.alpha
538  0x63, 0x6c, 0x00,
539  0x31, 0x30, 0x30, 0x2e, 0x32, 0x31, 0x36, 0x33, 0x33, 0x35, 0x2e, 0x61, 0x6c, 0x70, 0x68, 0x61,
540  0x00,
541 
542  // country = DE
543  0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x00,
544  0x44, 0x45, 0x00,
545 
546  // ff = 1
547  0x66, 0x66, 0x00,
548  0x31, 0x00,
549 
550  // fraglimit = 0
551  0x66, 0x72, 0x61, 0x67, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00,
552  0x30, 0x00,
553 
554  // gamemode = openplaying
555  0x67, 0x61, 0x6d, 0x65, 0x6d, 0x6f, 0x64, 0x65, 0x00,
556  0x6f, 0x70, 0x65, 0x6e, 0x70, 0x6c, 0x61, 0x79, 0x69, 0x6e, 0x67, 0x00,
557 
558  // gamename = bfield1942ps2
559  0x67, 0x61, 0x6d, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x00,
560  0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00,
561 
562  // gametype = conquest
563  0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00,
564  0x63, 0x6f, 0x6e, 0x71, 0x75, 0x65, 0x73, 0x74, 0x00,
565 
566  // gamevariant = Border
567  0x67, 0x61, 0x6d, 0x65, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x00,
568  0x42, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x00,
569 
570  // gamever = V1.31a
571  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00,
572  0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x00,
573 
574  // gc = 0
575  0x67, 0x63, 0x00,
576  0x30, 0x00,
577 
578  // hostname = [CQ]BF2MC-SERVER1
579  0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00,
580  0x5b, 0x43, 0x51, 0x5d, 0x42, 0x46, 0x32, 0x4d, 0x43, 0x2d, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52,
581  0x31, 0x00,
582 
583  // hostport = 3658
584  0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00,
585  0x33, 0x36, 0x35, 0x38, 0x00,
586 
587  // localip0 = 78.47.184.23
588  0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x69, 0x70, 0x30, 0x00,
589  0x37, 0x38, 0x2e, 0x34, 0x37, 0x2e, 0x31, 0x38, 0x34, 0x2e, 0x32, 0x33, 0x00,
590 
591  // localport = 3658
592  0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x70, 0x6f, 0x72, 0x74, 0x00,
593  0x33, 0x36, 0x35, 0x38, 0x00,
594 
595  // map = backstab
596  0x6d, 0x61, 0x70, 0x00,
597  0x62, 0x61, 0x63, 0x6b, 0x73, 0x74, 0x61, 0x62, 0x00,
598 
599  // mapname = 0
600  0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00,
601  0x30, 0x00,
602 
603  // maxplayers = 24
604  0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00,
605  0x32, 0x34, 0x00,
606 
607  // mc = 1
608  0x6d, 0x63, 0x00,
609  0x31, 0x00,
610 
611  // natneg = 1
612  0x6e, 0x61, 0x74, 0x6e, 0x65, 0x67, 0x00,
613  0x31, 0x00,
614 
615  // ni = -2147483648
616  0x6e, 0x69, 0x00,
617  0x2d, 0x32, 0x31, 0x34, 0x37, 0x34, 0x38, 0x33, 0x36, 0x34, 0x38, 0x00,
618 
619  // nr = 1
620  0x6e, 0x72, 0x00,
621  0x31, 0x00,
622 
623  // numplayers = 9
624  0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00,
625  0x39, 0x00,
626 
627  // numteams = 2
628  0x6e, 0x75, 0x6d, 0x74, 0x65, 0x61, 0x6d, 0x73, 0x00,
629  0x32, 0x00,
630 
631  // password = 0
632  0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x00,
633  0x30, 0x00,
634 
635  // qm = 0
636  0x71, 0x6d, 0x00,
637  0x30, 0x00,
638 
639  // rc = 0
640  0x72, 0x63, 0x00,
641  0x30, 0x00,
642 
643  // region = 65536
644  0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x00,
645  0x36, 0x35, 0x35, 0x33, 0x36, 0x00,
646 
647  // rv = retail
648  0x72, 0x76, 0x00,
649  0x72, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x00,
650 
651  // sr = 1
652  0x73, 0x72, 0x00,
653  0x31, 0x00,
654 
655  // statechanged = 1
656  0x73, 0x74, 0x61, 0x74, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x64, 0x00,
657  0x31, 0x00,
658 
659  // teamfraglimit = 0
660  0x74, 0x65, 0x61, 0x6d, 0x66, 0x72, 0x61, 0x67, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00,
661  0x30, 0x00,
662 
663  // teamplay = 0
664  0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x00,
665  0x30, 0x00,
666 
667  // timeelapsed = 148
668  0x74, 0x69, 0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x00,
669  0x31, 0x34, 0x38, 0x00,
670 
671  // timelimit = 1200
672  0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00,
673  0x31, 0x32, 0x30, 0x30, 0x00,
674 
675  // xi = 2147483647
676  0x78, 0x69, 0x00,
677  0x32, 0x31, 0x34, 0x37, 0x34, 0x38, 0x33, 0x36, 0x34, 0x37, 0x00,
678 
679  // xr = 20
680  0x78, 0x72, 0x00,
681  0x32, 0x30, 0x00,
682 
683  // deaths_0 = 0
684  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x30, 0x00,
685  0x30, 0x00,
686 
687  // pid_0 = 10046631
688  0x70, 0x69, 0x64, 0x5f, 0x30, 0x00,
689  0x31, 0x30, 0x30, 0x34, 0x36, 0x36, 0x33, 0x31, 0x00,
690 
691  // ping_0 = 0
692  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x30, 0x00,
693  0x30, 0x00,
694 
695  // player_0 = ASSASINO_BR
696  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x30, 0x00,
697  0x41, 0x53, 0x53, 0x41, 0x53, 0x49, 0x4e, 0x4f, 0x5f, 0x42, 0x52, 0x00,
698 
699  // score_0 = 4
700  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x30, 0x00,
701  0x34, 0x00,
702 
703  // skill_0 = rookie
704  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x30, 0x00,
705  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
706 
707  // team_0 = 1
708  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x30, 0x00,
709  0x31, 0x00,
710 
711  // deaths_1 = 0
712  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x31, 0x00,
713  0x30, 0x00,
714 
715  // pid_1 = 10044023
716  0x70, 0x69, 0x64, 0x5f, 0x31, 0x00,
717  0x31, 0x30, 0x30, 0x34, 0x34, 0x30, 0x32, 0x33, 0x00,
718 
719  // ping_1 = 0
720  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x31, 0x00,
721  0x30, 0x00,
722 
723  // player_1 = _-^FaNtASmA^-_
724  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x31, 0x00,
725  0x5f, 0x2d, 0x5e, 0x46, 0x61, 0x4e, 0x74, 0x41, 0x53, 0x6d, 0x41, 0x5e, 0x2d, 0x5f, 0x00,
726 
727  // score_1 = 1
728  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x31, 0x00,
729  0x31, 0x00,
730 
731  // skill_1 = rookie
732  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x31, 0x00,
733  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
734 
735  // team_1 = 0
736  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x31, 0x00,
737  0x30, 0x00,
738 
739  // deaths_2 = 0
740  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x32, 0x00,
741  0x30, 0x00,
742 
743  // pid_2 = 10037796
744  0x70, 0x69, 0x64, 0x5f, 0x32, 0x00,
745  0x31, 0x30, 0x30, 0x33, 0x37, 0x37, 0x39, 0x36, 0x00,
746 
747  // ping_2 = 0
748  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x32, 0x00,
749  0x30, 0x00,
750 
751  // player_2 = revai
752  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x32, 0x00,
753  0x72, 0x65, 0x76, 0x61, 0x69, 0x00,
754 
755  // score_2 = 0
756  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x32, 0x00,
757  0x30, 0x00,
758  // skill_2 = rookie
759  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x32, 0x00,
760  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
761 
762  // team_2 = 0
763  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x32, 0x00,
764  0x30, 0x00,
765 
766  // deaths_3 = 1
767  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x33, 0x00,
768  0x31, 0x00,
769 
770  // pid_3 = 10048679
771  0x70, 0x69, 0x64, 0x5f, 0x33, 0x00,
772  0x31, 0x30, 0x30, 0x34, 0x38, 0x36, 0x37, 0x39, 0x00,
773 
774  // ping_3 = 0
775  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x33, 0x00,
776  0x30, 0x00,
777 
778  // player_3 = kalion
779  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x33, 0x00,
780  0x6b, 0x61, 0x6c, 0x69, 0x6f, 0x6e, 0x00,
781 
782  // score_3 = 1
783  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x33, 0x00,
784  0x31, 0x00,
785 
786  // skill_3 = rookie
787  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x33, 0x00,
788  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
789 
790  // team_3 = 1
791  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x33, 0x00,
792  0x31, 0x00,
793 
794  // deaths_4 = 0
795  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x34, 0x00,
796  0x30, 0x00,
797 
798  // pid_4 = 10044547
799  0x70, 0x69, 0x64, 0x5f, 0x34, 0x00,
800  0x31, 0x30, 0x30, 0x34, 0x34, 0x35, 0x34, 0x37, 0x00,
801 
802  // ping_4 = 0
803  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x34, 0x00,
804  0x30, 0x00,
805 
806  // player_4 = SWEEPTHELEG
807  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x34, 0x00,
808  0x53, 0x57, 0x45, 0x45, 0x50, 0x54, 0x48, 0x45, 0x4c, 0x45, 0x47, 0x00,
809 
810  // score_4 = 0
811  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x34, 0x00,
812  0x30, 0x00,
813 
814  // skill_4 = rookie
815  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x34, 0x00,
816  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
817 
818  // team_4 = 0
819  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x34, 0x00,
820  0x30, 0x00,
821 
822  // deaths_5 = 2
823  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x35, 0x00,
824  0x32, 0x00,
825 
826  // pid_5 = 10042249
827  0x70, 0x69, 0x64, 0x5f, 0x35, 0x00,
828  0x31, 0x30, 0x30, 0x34, 0x32, 0x32, 0x34, 0x39, 0x00,
829 
830  // ping_5 = 0
831  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x35, 0x00,
832  0x30, 0x00,
833 
834  // player_5 = ]7rAgoN]-[aWk
835  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x35, 0x00,
836  0x5d, 0x37, 0x72, 0x41, 0x67, 0x6f, 0x4e, 0x5d, 0x2d, 0x5b, 0x61, 0x57, 0x6b, 0x00,
837 
838  // score_5 = 6
839  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x35, 0x00,
840  0x36, 0x00,
841 
842  // skill_5 = rookie
843  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x35, 0x00,
844  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
845 
846  // team_5 = 0
847  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x35, 0x00,
848  0x30, 0x00,
849 
850  // deaths_6 = 0
851  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x36, 0x00,
852  0x30, 0x00,
853 
854  // pid_6 = 10037784
855  0x70, 0x69, 0x64, 0x5f, 0x36, 0x00,
856  0x31, 0x30, 0x30, 0x33, 0x37, 0x37, 0x38, 0x34, 0x00,
857 
858  // ping_6 = 0
859  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x36, 0x00,
860  0x30, 0x00,
861 
862  // player_6 = TabsAnDabs
863  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x36, 0x00,
864  0x54, 0x61, 0x62, 0x73, 0x41, 0x6e, 0x44, 0x61, 0x62, 0x73, 0x00,
865 
866  // score_6 = 3
867  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x36, 0x00,
868  0x33, 0x00,
869 
870  // skill_6 = rookie
871  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x36, 0x00,
872  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
873 
874  // team_6 = 1
875  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x36, 0x00,
876  0x31, 0x00,
877 
878  // deaths_7 = 0
879  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x37, 0x00,
880  0x30, 0x00,
881 
882  // pid_7 = 10036819
883  0x70, 0x69, 0x64, 0x5f, 0x37, 0x00,
884  0x31, 0x30, 0x30, 0x33, 0x36, 0x38, 0x31, 0x39, 0x00,
885 
886  // ping_7 = 0
887  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x37, 0x00,
888  0x30, 0x00,
889 
890  // player_7 = IamLupo
891  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x37, 0x00,
892  0x49, 0x61, 0x6d, 0x4c, 0x75, 0x70, 0x6f, 0x00,
893 
894  // score_7 = 0
895  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x37, 0x00,
896  0x30, 0x00,
897 
898  // skill_7 = rookie
899  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x37, 0x00,
900  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
901 
902  // team_7 = 0
903  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x37, 0x00,
904  0x30, 0x00,
905 
906  // deaths_8 = 0
907  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x38, 0x00,
908  0x30, 0x00,
909 
910  // pid_8 = 10048589
911  0x70, 0x69, 0x64, 0x5f, 0x38, 0x00,
912  0x31, 0x30, 0x30, 0x34, 0x38, 0x35, 0x38, 0x39, 0x00,
913 
914  // ping_8 = 0
915  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x38, 0x00,
916  0x30, 0x00,
917 
918  // player_8 = Jeod
919  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x38, 0x00,
920  0x4a, 0x65, 0x6f, 0x64, 0x00,
921 
922  // score_8 = 0
923  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x38, 0x00,
924  0x30, 0x00,
925 
926  // skill_8 = rookie
927  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x38, 0x00,
928  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
929 
930  // team_8 = 0
931  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x38, 0x00,
932  0x30, 0x00,
933 
934  // deaths_9 = 0
935  0x64, 0x65, 0x61, 0x74, 0x68, 0x73, 0x5f, 0x39, 0x00,
936  0x30, 0x00,
937 
938  // pid_9 = 10037784
939  0x70, 0x69, 0x64, 0x5f, 0x39, 0x00,
940  0x31, 0x30, 0x30, 0x33, 0x37, 0x37, 0x38, 0x34, 0x00,
941 
942  // ping_9 = 0
943  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x39, 0x00,
944  0x30, 0x00,
945 
946  // player_9 = TabsAnDabs
947  0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x5f, 0x39, 0x00,
948  0x54, 0x61, 0x62, 0x73, 0x41, 0x6e, 0x44, 0x61, 0x62, 0x73, 0x00,
949 
950  // score_9 = 0
951  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x39, 0x00,
952  0x30, 0x00,
953 
954  // skill_9 = rookie
955  0x73, 0x6b, 0x69, 0x6c, 0x6c, 0x5f, 0x39, 0x00,
956  0x72, 0x6f, 0x6f, 0x6b, 0x69, 0x65, 0x00,
957 
958  // team_9 = 0
959  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x39, 0x00,
960  0x30, 0x00,
961 
962  // score_t0 = 447
963  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x30, 0x00,
964  0x34, 0x34, 0x37, 0x00,
965 
966  // team_t0 = AC
967  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x30, 0x00,
968  0x41, 0x43, 0x00,
969 
970  // score_t1 = 426
971  0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x74, 0x31, 0x00,
972  0x34, 0x32, 0x36, 0x00,
973 
974  // team_t1 = US
975  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x31, 0x00,
976  0x55, 0x53, 0x00,
977 
978  0x00,
979 };
980 
981 std::vector<unsigned char> example_F_request = {
982  0x01, 0x5e, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, 0x62, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x31, 0x39, 0x34, 0x32, 0x70, 0x73, 0x32, 0x00, 0x3a, 0x60, 0x6d, 0x70, 0x6d, 0x42, 0x47, 0x36, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x3d, 0x27, 0x56, 0x31, 0x2e, 0x33, 0x31, 0x61, 0x27, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3c, 0x3d, 0x32, 0x33, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x3e, 0x3d, 0x30, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x21, 0x3d, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6e, 0x72, 0x3c, 0x3d, 0x32, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x78, 0x72, 0x3e, 0x3d, 0x32, 0x29, 0x61, 0x6e, 0x64, 0x20, 0x28, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x20, 0x26, 0x20, 0x31, 0x29, 0x21, 0x3d, 0x30, 0x00, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x5c, 0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x5c, 0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5c, 0x74, 0x69, 0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x5c, 0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x5c, 0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x5c, 0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x5c, 0x70, 0x69, 0x6e, 0x67, 0x5f, 0x5c, 0x63, 0x30, 0x5c, 0x63, 0x31, 0x5c, 0x6e, 0x30, 0x5c, 0x6e, 0x31, 0x5c, 0x63, 0x30, 0x63, 0x5c, 0x63, 0x31, 0x63, 0x5c, 0x6e, 0x72, 0x5c, 0x78, 0x72, 0x5c, 0x66, 0x66, 0x5c, 0x6d, 0x63, 0x5c, 0x67, 0x63, 0x5c, 0x72, 0x63, 0x5c, 0x73, 0x72, 0x5c, 0x6e, 0x69, 0x5c, 0x78, 0x69, 0x5c, 0x71, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x80, 0x14, 0x00, 0x00, 0x00
983 };
984 
985 std::vector<unsigned char> example_F_response = {
986  0xe6,
987  0x16, 0x2f, 0xcd, 0x9e, 0x2f, 0x37, 0x03, 0x0c, 0xfe, 0xf5,
988 
989  0xf3,
990  0xea, 0x48, 0xaa, 0x7a, 0xb9, 0x1f, 0xd4, 0xdd, 0x34, 0xdd, 0xf0, 0x41, 0x57, 0xb1, 0x89, 0x53, 0x43, 0x86, 0x4e, 0x89, 0xa0, 0x65, 0x39, 0x6d, 0x03, 0xdd, 0x61, 0x4d, 0x42, 0x1d, 0x5a, 0xb9, 0xc1, 0x3f, 0x86, 0xb4, 0x41, 0x7f, 0x24, 0xd0, 0x6c, 0x8e, 0xa5, 0xd2, 0xfa, 0x22, 0x3f, 0xdc, 0x75, 0x48, 0x8b, 0x74, 0xb9, 0x42, 0x6a, 0xb2, 0x7a, 0x74, 0x71, 0x70, 0x89, 0xe6, 0xbf, 0x45, 0xea, 0x1b, 0x6c, 0x8e, 0x29, 0x29, 0x7c, 0xfc, 0x0d, 0xfa, 0x1d, 0xf0, 0x89, 0xb9, 0x17, 0x95, 0x55, 0x84, 0xa9, 0x4d, 0x03, 0x72, 0xe4, 0x35, 0xed, 0x21, 0x3a, 0xb5, 0x92, 0x27, 0x8f, 0xdb, 0x19, 0x3d, 0x3c, 0xf8, 0x43, 0x31, 0xfb, 0xad, 0xbb, 0x24, 0x81, 0x97, 0x7d, 0x4a, 0x39, 0x35, 0x66, 0xfe, 0x68, 0xa3, 0x5e, 0x2d, 0xe4, 0xcc, 0xe9, 0xe7, 0xbc, 0xdb, 0x68, 0xd4, 0x36, 0x38, 0x2d, 0x3f, 0x74, 0x9b, 0xbd, 0x98, 0x6a, 0xe5, 0x4a, 0x30, 0xac, 0x15, 0xa3, 0xf7, 0x8a, 0x5d, 0xb0, 0xa5, 0x10, 0xd3, 0x70, 0xdb, 0xe9, 0xf4, 0x15, 0x15, 0xad, 0xfc, 0x92, 0x5f, 0xa7, 0x70, 0x2f, 0x1f, 0xfd, 0x22, 0xa2, 0x6b, 0x07, 0x65, 0xfb, 0x1a, 0x25, 0x4d, 0x2b, 0x6c, 0x3f, 0x51, 0xa6, 0xe2, 0x6f, 0x29, 0xbb, 0x7b, 0xe9, 0x17, 0x25, 0x11, 0x6f, 0x17, 0x9a, 0x27, 0x7d, 0x49, 0x3b, 0x46, 0x1a, 0x17, 0x93, 0xe2, 0x75, 0x0f, 0x81, 0x2d, 0x47, 0xb3, 0x33, 0x22, 0x0d, 0x5b, 0xda, 0xc2, 0xe1, 0x29, 0x6c, 0x21, 0x86, 0x8e, 0xf1, 0x33, 0xf9, 0x09, 0x25, 0xbe, 0x7e, 0xf2, 0x46, 0x9d, 0x8d, 0xd4, 0x44, 0x3d, 0x6b, 0x0f, 0x9a, 0xdd, 0xe3, 0x2d, 0x96, 0x1b, 0x44, 0x85, 0x01, 0x58, 0xa6, 0x46, 0x82, 0xe8, 0xbd, 0x70, 0xff, 0x31, 0x71, 0x09, 0xee, 0x11, 0x31, 0x95, 0x34, 0x3a, 0x69
991 };
992 
993 std::vector<unsigned char> example_F_decrypt_data = {
994  0x56, 0x57, 0x8b, 0xeb,
995  0x19, 0x64,
996 
997  0x1c, 0x00,
998 
999  0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00,
1000  0x67, 0x61, 0x6d, 0x65, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00,
1001  0x67, 0x61, 0x6d, 0x65, 0x76, 0x65, 0x72, 0x00, 0x00,
1002  0x68, 0x6f, 0x73, 0x74, 0x70, 0x6f, 0x72, 0x74, 0x00, 0x00,
1003  0x74, 0x69, 0x6d, 0x65, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x00, 0x00,
1004  0x74, 0x69, 0x6d, 0x65, 0x65, 0x6c, 0x61, 0x70, 0x73, 0x65, 0x64, 0x00, 0x00,
1005  0x6d, 0x61, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00,
1006  0x6e, 0x75, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00,
1007  0x6d, 0x61, 0x78, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x00, 0x00,
1008  0x74, 0x65, 0x61, 0x6d, 0x70, 0x6c, 0x61, 0x79, 0x00, 0x00,
1009  0x74, 0x65, 0x61, 0x6d, 0x5f, 0x74, 0x00, 0x00,
1010  0x70, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00,
1011  0x63, 0x30, 0x00, 0x00,
1012  0x63, 0x31, 0x00, 0x00,
1013  0x6e, 0x30, 0x00, 0x00,
1014  0x6e, 0x31, 0x00, 0x00,
1015  0x63, 0x30, 0x63, 0x00, 0x00,
1016  0x63, 0x31, 0x63, 0x00, 0x00,
1017  0x6e, 0x72, 0x00, 0x00,
1018  0x78, 0x72, 0x00, 0x00,
1019  0x66, 0x66, 0x00, 0x00,
1020  0x6d, 0x63, 0x00, 0x00,
1021  0x67, 0x63, 0x00, 0x00,
1022  0x72, 0x63, 0x00, 0x00,
1023  0x73, 0x72, 0x00, 0x00,
1024  0x6e, 0x69, 0x00, 0x00,
1025  0x78, 0x69, 0x00, 0x00,
1026  0x71, 0x6d, 0x00, 0x00,
1027 
1028  0x3b,
1029  0xa8, 0x77, 0xbd, 0x95,
1030  0x0e, 0x4a,
1031  0xa8, 0x77, 0xbd, 0x95,
1032  0x0e, 0x4a, 0xa8, 0x77,
1033 
1034  0xbd, 0x95,
1035 
1036  0x3b,
1037  0x4e, 0x2f, 0xb8, 0x17,
1038  0x0e, 0x4a,
1039  0x4e, 0x2f, 0xb8, 0x17,
1040  0x0e, 0x4a,
1041  0x4e, 0x2f, 0xb8, 0x17,
1042 
1043  0x00,
1044 
1045  0xff, 0xff, 0xff, 0xff,
1046 };
1047 
1049 {
1050  int response_offset = 0;
1051  std::stringstream ss;
1052 
1053  //std::vector<unsigned char> request = example_A_request;
1054  //std::vector<unsigned char> response = example_A_response;
1055  // std::vector<unsigned char> request = example_B_request;
1056  // std::vector<unsigned char> response = example_B_response;
1057  //std::vector<unsigned char> request = example_C_request;
1058  //std::vector<unsigned char> response = example_C_response;
1059  //std::vector<unsigned char> request = example_D_request;
1060  //std::vector<unsigned char> response = example_D_response;
1061  //std::vector<unsigned char> request = example_E_request;
1062  //std::vector<unsigned char> response = example_E_response;
1063  std::vector<unsigned char> request = example_F_request;
1064  std::vector<unsigned char> response = example_F_response;
1065 
1066  uint32_t cryptlen = CHALLENGE_CRYPT_LEN;
1067  uint8_t cryptchal[CHALLENGE_CRYPT_LEN];
1068  uint32_t servchallen = CHALLENGE_SERVER_LEN;
1069  uint8_t servchal[CHALLENGE_SERVER_LEN];
1070  uint8_t m_challenge[CHALLENGE_CLIENT_LEN];
1071 
1072  // First conclusion:
1073  // buffer.WriteByte((uint8_t)(cryptlen ^ 0xEC));
1074  // buffer.WriteBuffer((uint8_t *)&cryptchal, cryptlen);
1075  ss << std::hex << (cryptlen ^ 0xEC); // Returns e6
1076  Logger::debug(ss.str());
1077  response_offset++;
1078 
1079  // copy crypt challenge
1080  ss.str("");
1081  for(int i = 0; i < CHALLENGE_CRYPT_LEN; i++)
1082  {
1083  cryptchal[i] = response[response_offset + i];
1084  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(cryptchal[i]);
1085  }
1086  response_offset += CHALLENGE_CRYPT_LEN;
1087  Logger::debug("cryptchal = " + ss.str());
1088 
1089  // Second conclusion
1090  // buffer.WriteByte((uint8_t)(servchallen ^ 0xEA));
1091  // buffer.WriteBuffer((uint8_t *)&servchal, servchallen);
1092  ss.str("");
1093  ss << std::hex << (servchallen ^ 0xEA) << std::endl; // Returns f3
1094  Logger::debug(ss.str());
1095  response_offset++;
1096 
1097  // copy crypt challenge
1098  ss.str("");
1099  for(int i = 0; i < CHALLENGE_SERVER_LEN; i++)
1100  {
1101  servchal[i] = response[response_offset + i];
1102  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(servchal[i]);
1103  }
1104  response_offset += CHALLENGE_SERVER_LEN;
1105  Logger::debug("servchal = " + ss.str());
1106 
1107  // Third: Find secret key
1108  // Found online:
1109  // https://github.com/devzspy/GameSpy-Openspy-Core/blob/master/Gamemaster.sql
1110  // size_t seckeylen = m_game.secretkey.length();
1111  // const char *seckey = m_game.secretkey.c_str();
1112  size_t seckeylen = 6;
1113  const char *seckey = "HpWx9z";
1114 
1115  // Get the challenge from the clients request
1116  ss.str("");
1117  for(int i = 0; i < CHALLENGE_CLIENT_LEN; i++)
1118  {
1119  m_challenge[i] = request[37 + i];
1120  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(m_challenge[i]);
1121  }
1122  Logger::debug("m_challenge = " + ss.str());
1123 
1124  // Update challenge
1125  for (uint32_t i = 0 ; i < servchallen ; i++)
1126  {
1127  m_challenge[(i * seckey[i % seckeylen]) % CHALLENGE_CLIENT_LEN] ^= (char)((m_challenge[i % CHALLENGE_CLIENT_LEN] ^ servchal[i]) & 0xFF);
1128  }
1129 
1130  GOACryptState m_crypt_state;
1131  int header_size = 1 + CHALLENGE_CRYPT_LEN + 1 + CHALLENGE_SERVER_LEN;
1132 
1133  ss.str("");
1134  for(int i = header_size; i < response.size(); i++)
1135  {
1136  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(response[i]);
1137  }
1138  Logger::debug("encrypted data = " + ss.str());
1139 
1140  // Initialization GOA crypt
1141  GOACryptInit(&(m_crypt_state), (unsigned char *)(&m_challenge), CHALLENGE_CLIENT_LEN);
1142 
1143  // Decrypt data
1144  GOADecrypt(&(m_crypt_state), (&response[header_size]), response.size() - header_size);
1145 
1146  ss.str("");
1147  for(int i = header_size; i < response.size(); i++)
1148  {
1149  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(response[i]);
1150  }
1151  Logger::debug("decrypted data = " + ss.str());
1152 
1153  /*
1154  // Encrypt the data again to confirm its the right encrypted data
1155  GOACryptState m_crypt_state2;
1156  GOACryptInit(&(m_crypt_state2), (unsigned char *)(&m_challenge), CHALLENGE_CLIENT_LEN);
1157  GOAEncrypt(&(m_crypt_state2), (&response[header_size]), response.size() - header_size);
1158 
1159  ss.str("");
1160  for(int i = header_size; i < response.size(); i++)
1161  {
1162  ss << std::hex << (int)(response[i]);
1163  }
1164  Logger::debug("encrypt data = " + ss.str());
1165  */
1166 }
1167 
1169 {
1170  std::stringstream ss;
1171 
1172  uint8_t crypt_challenge[CHALLENGE_CRYPT_LEN];
1173  uint8_t server_challenge[CHALLENGE_SERVER_LEN];
1174  uint8_t client_challenge[CHALLENGE_CLIENT_LEN];
1175  uint8_t key_challenge[CHALLENGE_CLIENT_LEN];
1176 
1177  std::vector<unsigned char> request = example_C_request;
1178  std::vector<unsigned char> response = example_C_response;
1179  std::vector<unsigned char> decrypted_data = example_C_decrypt_data;
1180 
1181  // copy crypt challenge
1182  ss.str("");
1183  for(int i = 0; i < CHALLENGE_CRYPT_LEN; i++)
1184  {
1185  crypt_challenge[i] = response[1 + i];
1186  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(crypt_challenge[i]);
1187  }
1188  Logger::debug("crypt_challenge = " + ss.str());
1189 
1190  ss.str("");
1191  for(int i = 0; i < CHALLENGE_SERVER_LEN; i++)
1192  {
1193  server_challenge[i] = response[12 + i];
1194  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(server_challenge[i]);
1195  }
1196  Logger::debug("server_challenge = " + ss.str());
1197 
1198  // Get the challenge from the clients request
1199  ss.str("");
1200  for(int i = 0; i < CHALLENGE_CLIENT_LEN; i++)
1201  {
1202  client_challenge[i] = request[37 + i];
1203  ss << std::hex << std::setfill('0') << std::setw(2) << (int)(client_challenge[i]);
1204  }
1205  Logger::debug("client_challenge = " + ss.str());
1206 
1207  /*
1208  Crack
1209  */
1210  std::string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
1211  std::vector<unsigned char> encryted_data(16, 0x0);
1212 
1213  while(true)
1214  {
1215  std::string secret_key = "123456";
1216 
1217  // Generate random secret key
1218  for(int i = 0; i < 6; i++)
1219  {
1220  secret_key[i] = alphabet[rand() % alphabet.size()];
1221  }
1222 
1223  // Copy backup challenge
1224  for(int i = 0; i < CHALLENGE_CLIENT_LEN; i++)
1225  {
1226  key_challenge[i] = client_challenge[i];
1227  }
1228 
1229  // Update challenge
1230  for (uint32_t i = 0 ; i < CHALLENGE_SERVER_LEN; i++)
1231  {
1232  key_challenge[(i * secret_key[i % 6]) % CHALLENGE_CLIENT_LEN] ^= (char)((key_challenge[i % CHALLENGE_CLIENT_LEN] ^ server_challenge[i]) & 0xFF);
1233  }
1234 
1235  // Copy encrypted data
1236  for(int i = 0; i < 8; i++)
1237  {
1238  encryted_data[i] = response[CHALLENGE_CRYPT_LEN + CHALLENGE_SERVER_LEN + 2 + i];
1239  }
1240 
1241  GOACryptState m_crypt_state2;
1242  GOACryptInit(&(m_crypt_state2), (unsigned char *)(&key_challenge), CHALLENGE_CLIENT_LEN);
1243  GOADecrypt(&(m_crypt_state2), &encryted_data[0], 8);
1244 
1245  bool correct = true;
1246  for(int i = 0; i < 8 && correct; i++)
1247  if(encryted_data[i] != decrypted_data[i])
1248  correct = false;
1249 
1250  if(correct)
1251  {
1252  Logger::debug("Found!! secret_key = " + secret_key);
1253 
1254  return;
1255  }
1256  }
1257 }
1258 
static void Crack()
Cracking function to find the secret key from a package.
static void Test()
Testing function to encrypt/decrypt a package.