Patch WinMX ::: Developer Center ::: WinMX Chat Protocol
Patch WinMX ::: Developer Center ::: Encryption

WinMX Chat Protocol Documentation:

 

The HashCode Process:


Connecting to a WinMX chat room is relatively easy, it's just the encryption and the protocol that is difficult to understand. First, you have to know what IPAddress and port to connect to. This is what the last 12 characters on a channel name is for.

 

Hashcode translation:
The hashcode is the _XXXXXXXXXXXX that comes after the channel name. This holds the IPAddress and port of the chat room you want to connect to. To Extract the information you have to know the format of the data.

Example: Some Room Name_E94AB3E4DAD0

_E94AB3E4DAD0 is the hash code of the chat room. Now we need to split it into IPAddress and port.

The first 8 characters are the IPAddress and the last 4 is the port. You simple need to convert them from hexadecimal to decimal.

IPAddress:

E9 = 223
4A = 74
B3 = 179
EA = 228

Now once you get it converted you would think it's the ipaddress 223.74.179.228, but in fact the WinMX network reverses it so the ipaddress is 228.179.74.223.

Port:

DAD0 = 56016

So now we know the port is 56016, so we now need to connect to 228.179.74.223:56016.

The Connection Process:


Now that we have the address to connect to we now connect to the server.

Receive WinMX Server Verification:
When you first connect, the server will automatically send one byte containing (0x31) which tells you that it's in fact a real WinMX server.

The Encryption/Handshaking Process:


Now that we have connected to the chat server and received the verification byte(0x31), we can now tell the chat server that we are a chat client, and we understand that there is encryption.

CryptkeyID's:
The WinMX network uses cryptkeyid's to indentify which kind of client's and servers are communicating with each other. There are 7 of them used in the network.

PrimaryClient:        0x50
PrimaryServer:       0x51
SecondaryClient:    0x52
SecondaryServer:   0x53
NodeList:              0x54
ChatClient:            0x57
ChatServer:           0x58

You might notice that 0x55 and 0x56 are missing, the reason is unknown, but its most likely they were used in an older protocol used by WinMX 3.3 and before.

Sending ChatClient Key:
We now need to send the 16 byte key to the server. (0x57)

Receive ChatServer Key:
If the server accepts our key it will then send a 16 byte key with a ChatServer ID (0x58).

Extract Encryption Keys:
Along with the 0x58 ID, the 16 bytes the server sends includes the information needed to extract the two encryption keys you need to communicate with the chat server.

All data after this 16 bytes received has to be encrypted.

Joining the chat room:


Now that we have extracted the encryption keys, we now need to send the join packet. The format for the packets sent to and from the server is as follows.

[Packet Type:2][Packet Length:2][Data:X]

Packet Types & Information:

Below are all the packet types that the WinMX chat room's use.

Note: 3.31 protocol messages are shown below in a separate section.

Note:
.
When looking in at the data information items ending with :N are null terminated.
. Even though file counts are 4 bytes, WinMX only allows up to 65535.
. Some Data sections are blank, which means you can send anything.

Join Request:   (Used for joining a chat room)
Type: 0x0064
Sender:
Client
Data:
[RoomName:N][Connection:2][PrimaryIP:4][PrimaryPort:2][Files:4][UserName:N]

 

Join Reply:   (Verification that you have joined the chat room.)
Type: 0x0066
Sender:
Server
Data:
[]

 

3.53 Supported:   (Indicates the server supports the 3.53 protocol)
Type: 0x0068
Sender:
Server
Data:
[]

 

User Entered:   (User entered channel (No IP Show)
Type: 0x0071
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2][Connection:2][Files:4][Rank:1]

 

User Notificiation:   (For sending the initial user list to a client)
Type:    0x0072
Sender:
Server
Data:
    [UserName:N][PrimaryIP:4][PrimaryPort:2][Connection:2][Files:4][Rank:1]

 

User Exited:   (User has left the room)
Type: 0x0073
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2]

 

User Rename   (User has changed names) (+ Also used for changing user rank)
Type: 0x0074
Sender:
Server
Data:
[OldName:N][OldPrimaryIP:4][OldPrimaryPort:2][NewName:N][NewPrimaryIP:4]
[NewPrimaryPort:2][Connection:2][Files:4][Rank:1]

 

User Entered   (User has entered channel) (With IP Shown)
Type: 0x0075
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2][Connection:2][Files:4][Rank:1][IP:4]

 

Motd   (Used for sending the MOTD) (Initial and updates)
Type: 0x0078
Sender:
Server
Data:
[MOTD:N]

 

Normal Text   (For normal text in the chat room) (<Name> Hi.)
Type: 0x00C8
Sender:
Server
Data:
[UserName:N][Text:N]{[Rank:1]}

 

Action Text  (For Action Text)
Type: 0x00CB
Sender:
Server
Data:
[UserName:N][Text:N]

 

General/Color Text   (Used for opmsg, colored text, server responses, etc.)
Type: 0x00D2
Sender:
Server
Data:
[Text:N]

 

Admin Command Text   (Echo's back the command you enter)
Type: 0x00D3
Sender:
Server
Data:
[Text:N]

 

Topic  (Used for initial topic and topic changing.)
Type: 0x012C
Sender:
Server
Data:
[Topic:N]

 

Channel Renamed   (Used for changing the name of the chat room)
Type: 0x012D
Sender:
Server
Data:
[ChannelName:N]

 

Redirect   (Used for moving all the users to a new chat room)
Type: 0x0190
Sender:
Server
Data:
[ChannelName:N]

 

3.53 Support   (Sent by clients to tell the server it supports 3.53 commands)
*Note:  This should be sent before the login packet.

Type: 0x13ED
Sender:
Client
Data:
[0x31:1]

 

Redirected   (Sent by clients that have been redirected.)(+For Redirect Blocking)
Type: 0x13EE
Sender:
Client
Data:
[ChannelName:N]

 

Text  (Sent by clients to send text to the chat room.)
Type: 0x1450
Sender:
Client
Data:
[Text:N]

 

Ping  (Used to keep alive the connection) (Should be sent every 45 - 60 Seconds)
Type: 0xFDE8
Sender:
Client/Server
Data:
[]

 

Extended Protocol:


Several 3rd party chat server and chat clients have been developed, and they have incorporated these new protocol messages. The most commonly used one is 0x9905, which identifies the name of the client/server and the version.

Note: If you have added your own type please post it in the forum so it can be added.

IPSend Support  (When a user is admined, checks if they support IPSend)
Type: 0x9990
Sender:
Server
Data:
[]

 

IPSend Support (Response to IPSend Support from the server. Indicates it's supported)
Type: 0x9901
Sender:
Client
Data:
[]

 

User's IP (Packet including the user's ip & hostname.)
Type: 0x9902
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2][Files:4][Connection:2][Rank:1][IP &
 Hostname:N]

 

IP Send Complete (Tells the client that all IP's have been sent)
Type: 0x9903
Sender:
Server
Data:
[]

 

Indentify (Used for indentifying server/client name & version)
Type: 0x9905
Sender:
Server/Client
Data:
[Name:N][Version:N]

3.31 Protocol:


These are rarely used anymore, but some people still use older clients like Nushi, and sometimes using 3.31 user list for users with no admin status can save bandwidth.

 

User Entered (A new user has joined the room)
Type: 0x006E
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2][Connection:2][Files:4]

 

User Notification (Used for sending the initial userlist))
Type: 0x006F
Sender:
Server
Data:
[UserName:N][PrimaryIP:4][PrimaryPort:2][Connection:2][Files:4]

 

User Rename(User has changed names)
Type: 0x0070
Sender:
Server
Data:
[OldName:N][OldPrimaryIP:4][OldPrimaryPort:2][NewName:N][NewPrimaryIP:4]
[NewPrimaryPort:2][Connection:2][Files:4]

 

Normal Text (Used for sending normal text to the room)
Type: 0x00C9
Sender:
Client
Data:
[Text:N]

 

Action Text (Used for sending action text to the room)
Type: 0x00CA
Sender:
Client
Data:
[Text:N]

 

Indentify (Used for indentifying server/client name & version)
Type: 0x9905
Sender:
Server/Client
Data:
[Name:N][Version:N]

Note: If you find any problems or any questions please post in the forum under the protocol section. Thanks.

 
© Copyright 2008-2009 PatchWinMX.com, All Rights Reserved. © Copyright 2004-2009 MXTOOLS, All Rights Reserved.