AxMenu type
AxScripts can also complement the AdaptixClient menu structure. The menu
namespace allows you to create a menu structure with actions and separators.
AxItem
AxItem create_menu(string text)
- Create a submenu item in the context menu. This item can contain a submenu, an action, or a separator.
AxItem create_separator()
- Create a separator.
AxItem create_action(string text, handler(){})
- Creates an action that the handler
will execute when this menu item is selected.
To add an AxItem
object to any use the function.
void menu.add_MENU_TYPE(AxItem item, string[] agents, string[] os = [], string[] listeners = []);
item
- AxItem objectagents
- an array of strings containing the names of agents for which the menu item will be displayed. Available options are "beacon", "gopher", etc.os
- an array of strings with the names of the operating systems for which the menu item will be displayed. 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 menu item will be displayed. The following options are available: "BeaconHTTP", "BeaconSMB", etc. If an empty array [] is specified, the command group will be registered for all listeners.
Sessions Table and Graph menu
menu.add_session_main
- Addsitem
to the context menu after the Access item.menu.add_session_agent
- Adds anitem
as a submenu to the Agent menu.menu.add_session_browser
- Adds anitem
as a submenu to the Browsers menu.menu.add_session_access
- Adds anitem
as a submenu to the Access menu.
For these context menu items, the action must have a handler
in the following format.
function handler(string[] ids)
ids
- array of selected agent ids
Example
This code adds a Process Browser action to the Browser menu, which opens Process Browser for all selected sessions.
let process_browser_action = menu.create_action("Process Browser", function(value) { value.forEach(v => ax.open_browser_process(v)) });
menu.add_session_browser(process_browser_action, ["beacon"])
File Browser menu
menu.add_filebrowser
- Addsitem
to the context menu
For these context menu items, the action must have a handler
in the following format.
function handler(FILE_INFO[] files)
files
- array of selected files
// FILE_INFO STRUCTURE:
string file["agent_id"] // agent ID
string file["path"] // file directory
string file["name"] // filename
string file["type"] // type: "file" or "dir"
Example
This code adds a Download action to the File Browser context menu, which executes a command to download a file.
let download_action = menu.create_action("Download", function(files_list) {
files_list.forEach((file) => {
if(file.type == "file") {
ax.execute_command(file.agent_id, "download " + file.path + file.name);
}
});
});
menu.add_filebrowser(download_action, ["beacon"])
Process Browser menu
menu.add_processbrowser
- Addsitem
to the context menu
For these context menu items, the action must have a handler
in the following format.
function handler(PROC_INFO[] processes)
processes
- array of selected processes
// PROC_INFO STRUCTURE:
string proc["agent_id"] // agent ID
string proc["pid"]
string proc["ppid"]
string proc["arch"] // if unix, then empty
string proc["session_id"] // if unix, then TTY
string proc["context"]
string proc["process"]
Example
This code adds a "Steal Token" action to the Process Browser context menu that performs the token steal
BOF.
let token_steal_action = menu.create_action("Steal token", function(process_list) {
if (process_list.length > 0 ) {
let proc = process_list[0];
ax.execute_command(proc.agent_id, "token steal " + proc.pid);
}
});
menu.add_processbrowser(token_steal_action, ["beacon", "gopher"], ["windows"]);
Downloads Table menu
menu.add_downloads_running
- Adds anitem
to the context menu if the file is in the download stage.menu.add_downloads_finished
- Adds anitem
to the context menu if the file is already downloaded.
For these context menu items, the action must have a handler
in the following format.
function handler(DOWNLOAD[] files)
files
- array of selected downloads
// DOWNLOAD STRUCTURE:
string file["agent_id"]
string file["file_id"]
string file["path"]
string file["state"] // "finished", "running" or "stopped"
Example
This code adds the actions Pause, Resume, Cancel and a separator
to the context menu of the Downloads Table.
let download_stop_action = menu.create_action("Pause", function(files_list) { files_list.forEach( file => ax.execute_command(file.agent_id, "exfil stop " + file.file_id) ) });
let download_start_action = menu.create_action("Resume", function(files_list) { files_list.forEach( file => ax.execute_command(file.agent_id, "exfil start " + file.file_id) ) });
let download_separator1 = menu.create_separator()
let download_cancel_action = menu.create_action("Cancel", function(files_list) { files_list.forEach( file => ax.execute_command(file.agent_id, "exfil cancel " + file.file_id) ) });
menu.add_downloads_running(download_stop_action, ["beacon"])
menu.add_downloads_running(download_start_action, ["beacon"])
menu.add_downloads_running(download_separator1, ["beacon"])
menu.add_downloads_running(download_cancel_action, ["beacon"])
Task Manager menu
menu.add_tasks
- Adds anitem
to the context menu for all tasks.menu.add_tasks_job
- Adds anitem
to the context menu if the task is of type JOB and is in the running state.
For these context menu items, the action must have a handler
in the following format.
function handler(TASK[] tasks)
tasks
- array of selected tasks
// TASK STRUCTURE:
string file["agent_id"]
string file["task_id"]
string file["state"] // "Hosted", "Running", "Success", "Error" or "Canceled"
string file["type"] // "TASK", "JOB", "TUNNEL" or "unknown"
Example
This code adds the action Stop job to the context menu of the Tasks Manager.
let job_stop_action = menu.create_action("Stop job", function(tasks_list) {
tasks_list.forEach((task) => {
if(task.type == "JOB" && task.state == "Running") {
ax.execute_command(task.agent_id, "jobs kill " + task.task_id);
}
});
});
menu.add_tasks_job(job_stop_action, ["beacon"])
Last updated