TuoniCommand

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

A class that provides data and functionality for a sent command.

command_id

The unique identifier of the command.

Type:

int

configuration

The configuration settings for the command.

Type:

dict

execConf

The execution configuration for the command.

Type:

dict

created

The time, as a string, indicating when the command was created.

Type:

str

sent

The time, as a string, indicating when the command was sent.

Type:

str

result

The result data returned from the command execution.

Type:

TuoniResult

get_result(reload=True)[source]

Retrieve the result object of the command.

Parameters:

reload (bool) – If True, reload the command result data from the server.

Returns:

The result object containing the data from the command execution.

Return type:

TuoniResult

is_done(reload_from_server=False)[source]

Checks has the command done/finished

Parameters:

reload_from_server (bool) – Should command data be reloaded from server.

Returns:

Is command done

Return type:

bool

is_failed(reload_from_server=False)[source]

Checks did the command fail

Parameters:

reload_from_server (bool) – Should command data be reloaded from server.

Returns:

Did command fail

Return type:

bool

is_ongoing(reload_from_server=False)[source]

Checks is the command running as ongoing command

Parameters:

reload_from_server (bool) – Should command data be reloaded from server.

Returns:

Is command ongoing

Return type:

bool

is_sent(reload_from_server=False)[source]

Checks was the command sent to the agent

Parameters:

reload_from_server (bool) – Should command data be reloaded from server.

Returns:

Is command sent to agent

Return type:

bool

is_success(reload_from_server=False)[source]

Checks was the command successful

Parameters:

reload_from_server (bool) – Should command data be reloaded from server.

Returns:

Was command successful

Return type:

bool

reload()[source]

Reload the command data from the C2 server.

result_status_done(reload=True)[source]

Check if the command has completed.

Parameters:

reload (bool) – If True, reload the command data from the server to verify the current status.

result_status_ongoing(reload=True)[source]

Check if the command is still ongoing.

Parameters:

reload (bool) – If True, reload the command data from the server to verify the current status.

wait_done(interval=1, maxWait=0)[source]

Wait for the command to be done (success or failed).

Parameters:
  • interval (int) – The interval, in seconds, to reload the data from the server.

  • maxWait (int) – The maximum time to wait, in seconds, before giving up. A value of 0 means wait indefinitely.

Returns:

The result object containing the data from the command execution, if available within the specified time.

Return type:

TuoniResult

wait_result(interval=1, maxWait=0)[source]

Wait for the command result object to be available (command done or in case of ongoing result, the initial results)

Parameters:
  • interval (int) – The interval, in seconds, to reload the data from the server.

  • maxWait (int) – The maximum time to wait, in seconds, before giving up. A value of 0 means wait indefinitely.

Returns:

The result object containing the data from the command execution, if available within the specified time.

Return type:

TuoniResult

wait_sent(interval=1, maxWait=0)[source]

Wait for the command to be sent

Parameters:
  • interval (int) – The interval, in seconds, to reload the data from the server.

  • maxWait (int) – The maximum time to wait, in seconds, before giving up. A value of 0 means wait indefinitely.

Returns:

Was command sent

Return type:

bool