milkekxdd's Instant Messenger: Docs
MIMP 1.0 Protocol specification

Basis:

  • Protocol: TCP
  • Port: 3290
  • Header byte order: Little Endian

Packet structure:

  • A MIMP packet is defined as a 10-byte header and a variable packet body

Header structure:

  • Magic - uint16 - 0xB00B
  • Protocol version - uint16 - 0x0001
  • Packet ID - uint16
  • Body length - uint32

Security:

  • Every single packet body (except for ID 0x0AA0 - Secure Connection Handshake) is encrypted with the encryption key using Circular XOR method

Secure Connection Handshake:

  • To obtain the current encrypton key, the client must receive and solve a 256-byte key puzzle
  • The puzzle must be solved by taking its first byte as a Start and its last byte as an Offset:
    • start = puzzle[0]
    • offset = puzzle[255]
  • Then, the client must make the following search:
    • for i in range(24):
      • puzzle[start + (i * offset)] <-- that would be the right byte of the key
  • After successfully retrieving the key, the client must be encrypting any packet body it sends and decrypting any packet body the server answers (except for 0x0AA0 packet) using the Circular XOR method:
    • for i in body:
      • body[i] ^ key[i % len(key)]

Authentication Handshake:

  • After a successful Secure Connection Handshake, the client must authenticate
  • To simplify the authentication of the client, MIMP uses a session-token method (instead of putting credentials into every single request). That makes the protocol more secure and works way more easy
  • If the credentials are valid, the server responds with the 16-byte token that should be saved by the client while holding the TCP connection
  • The client must include the token in every single JSON request after the authentication

Packet IDs:

  • 0x0AA0 - Secure Connection Handshake (SCH)
  • 0xA00F - Authentication Handshake (AH)
  • 0x00AF - Send Message (SM)
  • 0x0CCF - Get Unread (GU)
  • 0xBEEF (Server-only) - Error

Packet body JSON examples:

  • 0xA00F (Authentication Handshake):
  • {
    • "uf": <userFrom>,
    • "up": <userPassword>
  • }
  • 0x00AF (Send Message):
  • {
    • "uf": <userFrom>,
    • "ut": <userTo>,
    • "ms": <message>,
    • "token": <token>
  • }
  • 0x0CCF (Get Unread):
  • {
    • "uf": <userFrom>,
    • "token": <token>
  • }