For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

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 addArgFlagFile method adds a file type argument that must be specified after the flag.

The argument is a path. On the client, a file smaller than 3 MiB is read and placed in the argument as a base64 string, and <name>_path is set to that path. A file of 3 MiB or larger is not inlined: the argument is {__file_path, __file_size}. The value __payload:#<id> is a Payload Store reference, not a local path. A teamserver script reads the file inside its sandbox and always sends base64, including for __payload:#<id>. The teamserver also accepts a trailing (filename) after the id.

  • 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