TuoniAgent

class tuoni.TuoniAgent(conf, c2)[source]

A class that encapsulates the data and functionality of a connected agent.

guid

A unique identifier (GUID) assigned to the agent.

Type:

GUID

first_registration_time

The time, in string format, when the agent first connected.

Type:

str

last_callback_time

The time, in string format, of the agent’s most recent connection.

Type:

str

metadata

A dictionary containing metadata about the agent.

Type:

dict

active

A boolean flag indicating whether the agent is currently active.

Type:

bool

recentListeners

A list of listeners that the agent uses to maintain its connection.

Type:

list

availableCommands

A dictionary of commands that the agent is capable of executing.

Type:

dict

delete()[source]

Deletes agent.

get_commands()[source]

Retrieves a list of all commands associated with the agent.

Returns:

List of commands sent to the agent.

Return type:

list[TuoniCommand]

send_command(command_type, command_conf=None, execution_conf=None, files=None)[source]

Send command to agent.

Parameters:
  • command_type (str | TuoniAlias | TuoniDefaultCommand) – What command to send.

  • command_conf (dict) – Command configuration.

  • execution_conf (dict) – Execution configuration.

  • files (dict) – Files to send with command.

Returns:

An object representing the created command.

Return type:

TuoniCommand

Examples

>>> command1 = agent.send_command(TuoniCommandLs(".\subdir", 2))
>>> command2 = agent.send_command(TuoniCommandProcinfo(), execution_conf ={"execType": "NEW"})
>>> command3 = agent.send_command(TuoniCommandProcinfo(), execution_conf = {"execType": "EXISTING", "pid": 1234})
>>> command4 = agent.send_command("ls", {"dir": ".\subdir", "depth": 2})
>>> command5 = agent.send_command(alias_object, {"conf_value_name": "conf_value"})