AxCommand type

Command

The ax.create_command function creates an AxCommand object that will be converted into a command for AdaptixC2 agents.

AxCommand ax.create_command(string name, string description, string example = "", string message = "");
  • name - сonsole command name.

  • description - description of the command.

  • example - example of command input.

  • message - the message that will be displayed in the agent console when the command is sent.

Example

This code creates the pwd command.

ax.create_command("pwd", "Print current working directory", "pwd", "Task: print working directory");

Arguments

The AxCommand object has methods for adding arguments to a command.

bool

The addArgBool method adds a flag argument to the command, which can have two values: true (if the flag is specified) and false (if the flag is not specified).

  • flag - command's flag name

  • description - description of the arguments.

  • value - default value.

Example

This code creates the potato-dcom command with the bool --token arguments.

int

The addArgInt method adds a numeric argument to the command. The addArgFlagInt method adds a numeric argument to the command, which must be specified after the flag.

  • flag - command's flag name

  • name - command argument's name.

  • required - if true, then the argument must be specified in the command

  • description - description of the arguments.

  • value - default value.

Example

This code creates the kill command with the int pid arguments.

string

The addArgString method adds a string argument to the command. The addArgFlagString method adds a string argument to the command, which must be specified after the flag.

  • flag - command's flag name

  • name - command argument's name.

  • required - if true, then the argument must be specified in the command

  • description - description of the arguments.

  • value - default value.

Example

This code creates the cp command with the two string src and dst arguments.

file

The addArgFile method adds a file type argument to the command. The addArgFlagString method adds a file type argument to the command, which must be specified after the flag.

The file-type argument is the path to the file that will be read and sent to the server in base64.

  • flag - command's flag name

  • name - command argument's name.

  • required - if true, then the argument must be specified in the command

  • description - description of the arguments.

Example

This code creates the upload command with the file-type local_file and the string remote_path arguments .


SubCommand

The AxCommand object has an addSubCommands method for adding subcommands to a command.

  • subcommands - array of AxCommand objects

Example

This code creates the smb and tcp commands, then creates the link command and adds smb and tcp as subcommands.


PreHook

See here.


Registering commands

In order for the created commands to be used in the agent console, they must be combined into command groups using the create_commands_group function, and then the group must be registered using the register_commands_group function.

  • name - command group name

  • commands - array of AxCommand objects

  • group - AxCommandsGroup object

  • agents - an array of strings of agent names for which the command group will be available. The following options are available: "beacon", "gopher", etc.

  • os - an array of strings with the names of the operating systems for which the command group will be available. The following options are available: "windows", "linux", "macos". If an empty array [] is specified, the command group will be registered for all operating systems.

  • listeners - An array of strings with the names of registered listeners for which the command group will be available. The following options are available: "BeaconHTTP", "BeaconSMB", etc. If an empty array [] is specified, the command group will be registered for all listeners.

Example

The following code creates three commands uptime, useridletime and whoami. It then combines them into a group Test-Register-Group and registers it for beacon and gopher agents, but only running on Windows OS.

Last updated