Network protocol (v1)
  • 08 Mar 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

Network protocol (v1)

  • Dark
    Light
  • PDF

Article Summary

This protocol is intended for use over bidirectional TCP.

Handshake

Upon connection, a client submits the following 24-byte handshake to the server:

Byte OffsetTypeDescription
0GuidProtocol ID: 6CEBD24E-4AF7-4A13-B9AF-81D3DFC644BE
16int32Protocol Version: 1000 (currently hardcoded)
20int32Session ID

If the protocol ID is not valid, the server will immediately disconnect. Otherwise, the server responds with:

Byte OffsetTypeDescription
0int8Required encryption mode. May be:
  • 0: none
  • 1: SSL
  • 2: AES
1int8[16]AES initialization vector if using AES encryption
17/1int32Session ID – may be same as requested but server is allowed to return a different one
21/5int32Server version - [major].[minor].[build].[revision] (assembly version of server)

Note: AES initialization vector is only included if using AES encryption. {.info}

Note: Session ID may be used in a future version to support reconnecting after a dropped connection, but it is currently ignored. {.info}

Once connected, the server waits to receive a message from the connected client.

Client to Server Message

All client to server messages take the following form:

Byte OffsetTypeDescription
0int32Data length (length of Data field in bytes)
4int8Agent type
5int32Command
9bytesData

When using no encryption or SSL encryption, messages are sent in this format over TCP directly. When using AES encryption, the message looks like this:

Byte OffsetTypeDescription
0int32Encrypted data length (length of full encrypted message, including every field after this one)
4*int8[16]Initialization vector for next message
20*int8Agent type
21*int32Command code
25*bytesData

*All fields after length are encrypted. Offsets are applicable after message has been decrypted

Server to Client Message

The server can send messages back to the client, with the following form:

Byte OffsetTypeDescription
0int32Data length (length of Data field in bytes)
4int32Command code
5bytesData

When using no encryption or SSL encryption, messages are sent in this format over TCP directly. When using AES encryption, the message looks like this:

Byte OffsetTypeDescription
0int32Encrypted data length (length of full encrypted message, including every field after this one)
4*int8[16]Initialization vector for next message
20*int32Command code
24*bytesData

*All fields after length are encrypted. Offsets are applicable after message has been decrypted


Was this article helpful?