Skip to content

Cmd_UserAuth

GigaToni edited this page Jul 14, 2017 · 5 revisions

Client->Server = Cmd_UserAuth (20)

The first packet the auth server is receiving is the Cmd_UserAuth packet. This packet contains information about the user that is trying to log-in.

  • The first 4-Bytes are an int containing the protocol version the client is talking in
  • It follows by 80 bytes/chars of data for the username (UNICODE! So 40-Bytes * 2)
  • Then the password follows (ASCII! Null-terminated!)
  • At the end are 62-Bytes that are currently unknown

Answer Packets (In order):

Raw packet data sent by client

000000: 09 28 00 00 61 00 64 00 6D 00 69 00 6E 00 00 00  · ( · · a · d · m · i · n · · · 
000016: 00 00 80 3F 00 00 00 00 00 00 00 00 00 00 80 3F  · · · ? · · · · · · · · · · · ? 
000032: 00 00 00 00 00 00 00 00 00 00 80 3F 00 00 00 00  · · · · · · · · · · · ? · · · · 
000048: 00 00 00 00 00 00 80 3F 00 00 00 00 00 00 00 00  · · · · · · · ? · · · · · · · · 
000064: 00 00 80 3F 00 00 00 00 00 00 00 00 00 00 80 3F  · · · ? · · · · · · · · · · · ? 
000080: 00 00 00 00 61 64 6D 69 6E 00 00 00 00 00 00 00  · · · · a d m i n · · · · · · · 
000096: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  · · · · · · · · · · · · · · · · 
000112: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  · · · · · · · · · · · · · · · · 
000128: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  · · · · · · · · · · · · · · · · 
000144: 00 00 00 00 47 7E 10 00  · · · · G · · · 

Disassembled (Pre-Alpha)

/* 2364 */
struct __cppobj __unaligned __declspec(align(2)) BS_PktUserAuth : BS_PktBody
{
  unsigned int m_Version;
  wchar_t m_ID[40];
  char m_PW[64];
};

*(_DWORD *)(lpBuffer + 2) >= (unsigned int)BS_Global::AuthProtocolVersion

Pseudo struct

typedef struct 
{
	unsigned int protocolVersion;
	char username[80];
	string password;
    char unknown1[62];
} UserAuth;

Pseudo C# Class

public class UserAuthPacket
{
	public readonly int ProtocolVersion;
	public readonly string Username;
	public readonly string Password;

	public UserAuthPacket(Packet packet)
	{
		ProtocolVersion = packet.Reader.ReadInt32();

		Username = packet.Reader.ReadUnicodeStatic(40);

		Password = packet.Reader.ReadAscii();
		Password = Password.Substring(0, Password.Length - 1);
	}
}
Clone this wiki locally