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.
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).
addArgBool(string flag, string description = "");
// or
addArgBool(string flag, string description, bool value);
flag
- command's flag namedescription
- description of the arguments.value
- default value.
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.
addArgInt(string name, bool required, string description = "");
// or
addArgInt(string name, string description, int value);
addArgFlagInt(string flag, string name, bool required, string description = "");
// or
addArgFlagInt(string flag, string name, string description, int value);
flag
- command's flag namename
- command argument's name.required
- iftrue
, then the argument must be specified in the commanddescription
- description of the arguments.value
- default value.
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.
addArgString(string name, bool required, string description = "");
// or
addArgString(string name, string description, string value);
addArgFlagString(string flag, string name, bool required, string description = "");
// or
addArgFlagString(string flag, string name, string description, string value);
flag
- command's flag namename
- command argument's name.required
- iftrue
, then the argument must be specified in the commanddescription
- description of the arguments.value
- default value.
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.
addArgFile(string name, bool required, string description = "");
// or
addArgFlagFile(string flag, string name, bool required, string description = "");
flag
- command's flag namename
- command argument's name.required
- iftrue
, then the argument must be specified in the commanddescription
- description of the arguments.
SubCommand
The AxCommand object has an addSubCommands
method for adding subcommands to a command.
addSubCommands(AxCommand[] subcommands)
subcommands
- array of AxCommand objects
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.
AxCommandsGroup ax.create_commands_group(string name, AxCommand[] commands);
name
- command group namecommands
- array of AxCommand objects
ax.register_commands_group(AxCommandsGroup group, string[] agents, string[] os, string[] listeners);
group
- AxCommandsGroup objectagents
- 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.
Last updated