Skip to content

Instantly share code, notes, and snippets.

@Yepoleb
Created July 30, 2018 20:12
Show Gist options
  • Save Yepoleb/e53dc05a747a57c40c70086e3818b258 to your computer and use it in GitHub Desktop.
Save Yepoleb/e53dc05a747a57c40c70086e3818b258 to your computer and use it in GitHub Desktop.
const uint32_t CONNECTIONLESS_HEADER = 0xFFFFFFFF;
const uint8_t A2S_GETCHALLENGE = 'q';
const uint8_t S2C_CHALLENGE = 'A';
const uint8_t C2S_CONNECT = 'k';
const uint8_t S2C_CONNECTION = 'B';
const uint32_t PROTOCOL_HASHEDCDKEY = 0x02;
const uint32_t PROTOCOL_STEAM = 0x03;
const uint32_t NETPROTOCOL_VERSION = 24;
struct a2s_getchallenge
{
uint32_t header = CONNECTIONLESS_HEADER;
char msg_type = A2S_GETCHALLENGE;
uint32_t client_challenge; // Random value
char pad[11] = "0000000000"; // null terminated
};
struct s2c_challenge
{
uint32_t header = CONNECTIONLESS_HEADER;
char msg_type = S2C_CHALLENGE;
uint32_t source_protocol;
uint32_t server_challenge;
uint32_t client_challenge;
uint32_t auth_protocol = PROTOCOL_HASHEDCDKEY;
char pad[7] = "000000";
};
struct c2s_connect
{
uint32_t header = CONNECTIONLESS_HEADER;
char msg_type = C2S_CONNECT;
uint32_t protocol_version = NETPROTOCOL_VERSION;
uint32_t auth_type = PROTOCOL_HASHEDCDKEY;
uint32_t server_challenge;
uint32_t client_challenge;
char* name;
char pad = '\0';
char* password;
char* cdkey_hash; // md5_hash
};
struct s2c_connection
{
uint32_t header = CONNECTIONLESS_HEADER;
char msg_type = S2C_CONNECTION;
char pad[11] = "0000000000";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment