2 Neo rs
opgl edited this page 2025-08-16 23:37:59 +02:00

Neo-rs Documentation

1. Overview

Neo-rs

A lightweight remote-access tool, written in rust


2. Protocol

  • Transport protocol: WTP
  • Default ports: 5000
  • Security: TLS

3. Payload usage

3.1 Message payload

Purpose: Message packets are used to transfer data between wpkg-studio and neo-rs. This data includes for example: CommandPayload that allow the use of the neo-rs functions

3.2 Action payload

Purpose: Action packets are used for communication between 'server' and 'neo-rs', and more specifically they are used to register, initialize, and manage the status of the connection to the server

3.3 Binary payload

Purpose: Binary packets are used to transfer binary data, most commonly used to transfer files

3.4 Ping payload

Purpose: Ping packets are used for keep-alive mechanism in server

4. Command payload

Purpose: Defines the format of command payloads used in neo-rs for communication between client and server.

Format:

<command_name>|<json>

Fields:

Field Type Description Example value
command_name string Identifier of the command in neo-rs new
json json JSON object containing command parameters {"id":"3f5b02bf-c644-46ee-8b3c-3dde19348afa"}

Example payload:

new|{"id":"3f5b02bf-c644-46ee-8b3c-3dde19348afa"}

Json structure: The JSON part of the payload must be compatible with HashMap<String, String>. This means that:

  • Keys must be of type String.
  • Values must also be of type String.
  • Nested objects or arrays are not allowed.

5. Client registration

Purpose: Before executing any other commands, the client must first register itself with the server. This ensures that the server recognizes the client and assigns it the necessary context for further communication.

Registration command:

The client must send a payload with the action init-rat.

Format:

init-rat|{"id":"<unique-client-id>"}

Fields:

Field Type Description Example value
id string Unique identifier of the client instance 3f5b02bf-c644-46ee-8b3c-3dde19348afa

Example:

init-rat|{"id":"3f5b02bf-c644-46ee-8b3c-3dde19348afa"}

Notes:

  • The id must be unique per client instance.
  • If the client does not register with init-rat, the server will reject subsequent commands.

6. Neo-rs features

6.1 Command: new

Purpose: Creates a new client socket and registers it with the server. This command is used when an additional client instance needs to be initialized and authenticated. After successful registration, the credentials (UUID) are returned and sent back to the requesting client.

Format:

new|{"id":"<client-id>"}

Fields:

Field Type Description Example value
id string Identifier of the client requesting new connection 3f5b02bf-c644-46ee-8b3c-3dde19348afa

Execution flow:

  1. A background task is spawned to create a new socket.
  2. The new socket registers itself to the server.
  3. If registration succeeds, the server returns credentials (UUID).
  4. The UUID is wrapped in a MessagePayload and sent back to the original client.
  5. If no credentials are received or an error occurs, the command logs debug information but continues execution.

Example payload:

new|{"id":"3f5b02bf-c644-46ee-8b3c-3dde19348afa"}

Notes:

  • The command always attempts to spawn a background socket regardless of input parameters.
  • If registration fails, no credentials will be sent back.
  • This command is asynchronous and non-blocking.