AxEvent type

AdaptixClient generates events for various situations. To register a handler for a specific event, there are functions from the event namespace. Several handlers can be connected to one event.

To assign a handler to a specific event use the function

void event.on_EVENT_TYPE(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");
  • handler - a handler that will be triggered when the event occurs.

  • agents - an array of strings containing the names of agents for which the event will be triggered. Available options are "beacon", "gopher", etc.

  • os - an array of strings with the names of the operating systems for which the event will be triggered. 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 event will be triggered. The following options are available: "BeaconHTTP", "BeaconSMB", etc. If an empty array [] is specified, the command group will be registered for all listeners.

  • event_id - id for handler

You can remove a handler that has an id set.

void event.remove(string event_id);

on_new_agent

This event occurs every time a new agent registers.

void event.on_new_agent(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");

This event must have a handler assigned in the following format.

function handler(string id);
  • id - agent ID

Example

var event_ag = function(id) {
    ax.show_message("New agent", id);
}
event.on_new_agent(event_ag, ["beacon", "gopher"]);

on_filebrowser_disks

This event occurs when the user clicks the Disks button in the File Browser.

void event.on_filebrowser_disks(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");

This event must have a handler assigned in the following format.

function handler(string id);
  • id - agent ID

Example

var event_disks_action = function(id) {
    ax.execute_browser(id, "disks");
}
event.on_filebrowser_disks(event_disks_action, ["beacon"]);

on_filebrowser_list

This event occurs whenever the user requests a list of files in the File Browser.

void event.on_filebrowser_list(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");

This event must have a handler assigned in the following format.

function handler(string id, string path);
  • id - agent ID

  • path - current path in File Browser

var event_files_action = function(id, path) {
    ax.execute_browser(id, "ls " + path);
}
event.on_filebrowser_list(event_files_action, ["beacon"]);

on_filebrowser_upload

This event occurs whenever the user requests a list of processes in the Process Browser.

void event.on_processbrowser_list(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");

This event must have a handler assigned in the following format.

function handler(string id, string path, string filepath );
  • id - agent ID

  • path - current path in File Browser

  • filepath - path to the local file to upload

Example

var event_upload_action = function(id, path, filepath) {
    let filename = ax.file_basename(filepath);
    ax.execute_browser(id, "upload " + filepath + " " + path + filename);
}
event.on_filebrowser_upload(event_upload_action, ["beacon"]);

on_processbrowser_list

This event occurs when a user uploads a file in a File Browser.

void event.on_filebrowser_upload(handler(){}, string[] agents, string[] os = [], string[] listeners = [], string event_id = "");

This event must have a handler assigned in the following format.

function handler(string id);
  • id - agent ID

Example

var event_process_action = function(id) {
    ax.execute_browser(id, "ps list");
}
event.on_processbrowser_list(event_process_action, ["beacon"]);

on_disconnect

This event occurs when a client disconnects from the server.

void event.on_disconnect(handler(){}, string event_id = "");

This event must have a handler assigned in the following format.

function handler();

Example

var event_disc = function() {
    ax.show_message("Event", "Client disconnected!");
}
event.on_disconnect(event_disc);

on_ready

This event occurs when the client has finished synchronizing with the server.

void event.on_ready(handler(){}, string event_id = "");

This event must have a handler assigned in the following format.

function handler();

Example

var event_ready = function() {
    ax.show_message("Event", "Client connected!");
}
event.on_ready(event_ready);

on_interval

The handler will be executed every n seconds. The method returns the ID with which the event was registered.

string on_interval(handler(){}, int n, string event_id = "");

This event must have a handler assigned in the following format.

function handler();

Example

var event_timer = function() {
    ax.show_message("Timeout", "5 seconds out");
}
event.on_interval(event_timer, 5);

on_timeout

The handler will be executed once in n seconds. The method returns the ID with which the event was registered.

string on_timeout(handler(){}, int n, string event_id = "");

This event must have a handler assigned in the following format.

function handler();

Example

var event_timer = function() {
    ax.show_message("Timeout", "5 seconds out");
}
event.on_timeout(event_timer, 5);

list

The method returns a list of IDs of all registered handlers.

string list();

Example


remove

The method removes handler for the event whose ID is provided.

string remove(string event_id);

Example


Last updated