Function Reference¶
Complete reference for all Stentor CNA scripting functions. This page documents 310+ CNA functions and 46 Sleep language builtins organized by category. Each entry includes the function signature, parameter descriptions, return value, and a usage example.
Naming Conventions
- Functions prefixed with
bare beacon interaction functions that queue tasks for a specific beacon. They all take a beacon ID ($bid) as the first argument. - Functions prefixed with
-(dash) are predicate functions that returnTRUEorFALSEbased on beacon state. - Optional parameters are shown in square brackets:
[$param]. - Many
b*functions accept an optional callback[$cb]as the last argument, invoked when the task result returns.
Category Index¶
| Category | Count | Description |
|---|---|---|
| Beacon: Execution | 10 | Shell, run, execute, PowerShell, BOF, assembly, extensions |
| Beacon: File Operations | 11 | Upload, download, ls, rm, cp, mv, mkdir, drives, cancel |
| Beacon: Process Management | 4 | Process list, kill, jobs, job kill |
| Beacon: Configuration | 18 | Sleep, spawnto, ppid, blockdlls, mode, exit, link, argue |
| Beacon: Credentials | 27 | Hashdump, DCSync, Kerberoast, mimikatz, tickets, delegation |
| Beacon: Injection | 6 | Inject, shinject, shspawn, DLL injection, DLL load |
| Beacon: Jobs | 3 | Job logging, data, and error |
| Beacon: Lateral Movement | 6 | Jump, remote-exec, PsExec, WMI, WinRM |
| Beacon: Network | 13 | Port scan, SOCKS, port forwarding, VPN, P2P |
| Beacon: Output | 4 | Task, input, log, error |
| Beacon: PowerShell | 2 | psinject, powershell-import clear |
| Beacon: Privilege Escalation | 5 | Getsystem, elevate, runasadmin, spawnas, runas |
| Beacon: Queue | 3 | Clear, read_pipe, blog2 |
| Beacon: Reconnaissance | 25 | Screenshot, keylogger, desktop, LDAP, EDR, BITS, browser |
| Beacon: Registry & Services | 6 | Registry query, set, delete, service management |
| Beacon: Spawn & Identity | 4 | Spawn, spawnu, runu, elevate_command |
| Beacon: SSH | 4 | SSH connect, command, key auth, sudo |
| Beacon: Token | 11 | Steal token, make token, token store operations |
| Beacon: Data / Info | 5 | Beacon metadata, data store |
| Data Model | 14 | Beacons, credentials, targets, listeners, downloads |
| Dialog & UI | 38 | Dialogs, prompts, form builders, navigation |
| Output & Events | 9 | Say, elog, action, custom events |
| Tab & Visualization | 3 | addTab, addVisualization, showVisualization |
| Menu | 2 | popup_clear, menubar |
| Registration | 12 | Command, exploit, remote exploit registration and query |
| Payload Generation | 7 | Stager, payload, artifact generation |
| PE Manipulation | 18 | PE dump, mask, patch, stomp, checksum |
| Process Injection Config | 16 | pi_spawn/explicit get/set/info, user variants |
| Report DSL | 15 | Report, page, headings, tables, layout |
| Report Data | 7 | agCredentials, agTargets, agSessions, etc. |
| Utility: General | 8 | base64, timestamp, nick, script_resource |
| Utility: String | 6 | dstamp, format_size, encode, xor |
| Utility: Network | 6 | sync_download, tokenToEmail, url_open |
| Utility: Compression | 2 | gzip, gunzip |
| Utility: Transform | 2 | transform, transform_vbs |
| PowerShell Utility | 4 | powershell_command, compress, encode |
| Attack (MITRE) | 6 | attack_describe, attack_name, tactics, URL |
| Predicates | 6 | Beacon state predicates (-is64, -isadmin, etc.) |
| Preferences | 2 | pref_get, pref_set |
| Setup | 2 | setup_strings, setup_transformations |
| Listener Lifecycle | 6 | listener_create, delete, describe, restart |
| VPN | 3 | vpn_tap_create, vpn_tap_delete, vpn_interfaces |
| SSH Registration | 2 | ssh_command_register, ssh_command_describe |
| Credentials & Host | 5 | credential_add/remove, arch, host_update, localip |
| Range | 2 | range, iprange |
| Reflective Loader | 1 | setup_reflective_loader |
| Sleep Builtins | 46 | Core language: print, push, split, keys, rand, etc. |
Beacon: Execution¶
bshell¶
bshell($bid, $cmd, [$cb]) -- Execute a command via cmd.exe /C.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cmd | string | Command to execute |
$cb | function | Optional callback for task result |
Returns: $null
Dispatches: exec task to implant. Wraps command in cmd.exe /C.
brun¶
brun($bid, $cmd, [$cb]) -- Execute a command directly without cmd.exe wrapper.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cmd | string | Command to execute directly |
$cb | function | Optional callback |
Returns: $null
Dispatches: exec task to implant.
bexecute¶
bexecute($bid, $cmd, [$cb]) -- Execute a command without output capture.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cmd | string | Command to execute |
$cb | function | Optional callback |
Returns: $null
Dispatches: exec task to implant.
bpowershell¶
bpowershell($bid, $cmd, [$cb]) -- Execute a PowerShell command via -EncodedCommand.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cmd | string | PowerShell command |
$cb | function | Optional callback |
Returns: $null
Dispatches: exec task. Encodes as UTF-16LE base64. Prepends imported script if set via bpowershell_import.
bpowershell_import¶
bpowershell_import($bid, $script_content) -- Import a PowerShell script for prepending to subsequent bpowershell calls.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$script_content | string | PowerShell script content |
Returns: $null
Note: Server-side only. Does NOT enqueue a task. The imported script is prepended to all subsequent bpowershell and bpowerpick calls.
$script = openf("/opt/scripts/PowerView.ps1");
bpowershell_import($1, readAll($script));
bpowershell($1, "Get-DomainUser -Identity admin");
bpowerpick¶
bpowerpick($bid, $cmd, [$cb]) -- Execute PowerShell via CLR shellcode injection (unmanaged PowerShell).
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cmd | string | PowerShell command |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task with CLR shellcode. Falls back to encoded PowerShell if relay unavailable.
bexecute_assembly¶
bexecute_assembly($bid, $assembly, [$args], [$cb]) -- Execute a .NET assembly in memory.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$assembly | string | File path or raw assembly bytes |
$args | string | Optional arguments to the assembly |
$cb | function | Optional callback |
Returns: $null
Dispatches: exec_asm task. Converts assembly to shellcode via relay.
binline_execute¶
binline_execute($bid, $bof_data, $args, [$cb]) -- Execute a Beacon Object File (BOF) inline.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$bof_data | string | BOF binary data |
$args | string | Packed arguments |
$cb | function | Optional callback |
Returns: $null
Dispatches: bof task with entry point go.
bext_execute¶
bext_execute($bid, $ext_name, [$args], [$cb]) -- Execute an installed extension on a beacon.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$ext_name | string | Extension name |
$args | string | Optional arguments |
$cb | function | Optional callback |
Returns: $null
Dispatches: extension task.
bext_list¶
bext_list() -- List installed extensions.
Returns: @() -- Empty Sleep array (stub). Extension listing is done via REST API.
Beacon: File Operations¶
bupload¶
bupload($bid, $path, [$cb]) -- Upload a file to the beacon.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$path | string | Local file path to upload |
$cb | function | Optional callback |
Returns: $null
Dispatches: upload task.
bupload_raw¶
bupload_raw($bid, $remote_path, $data, [$cb]) -- Upload raw data to a remote path.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$remote_path | string | Destination path on target |
$data | string | Raw file content |
$cb | function | Optional callback |
Returns: $null
Dispatches: upload task with raw content.
bdownload¶
bdownload($bid, $path, [$cb]) -- Download a file from the beacon.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$path | string | Remote file path to download |
$cb | function | Optional callback |
Returns: $null
Dispatches: download task.
bdownload_cancel¶
bdownload_cancel($bid, [$pattern]) -- Cancel an in-progress file download.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pattern | string | Optional filename pattern to match |
Returns: $null
bcancel¶
bcancel($bid, [$pattern]) -- Cancel pending downloads for a beacon.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pattern | string | Optional filename pattern |
Returns: $null
brm¶
brm($bid, $path, [$cb]) -- Remove a file on the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$path | string | File path to remove |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation rm.
bmkdir¶
bmkdir($bid, $path, [$cb]) -- Create a directory on the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$path | string | Directory path to create |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation mkdir.
bcp¶
bcp($bid, $src, $dst, [$cb]) -- Copy a file on the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$src | string | Source file path |
$dst | string | Destination file path |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation cp.
bmv¶
bmv($bid, $src, $dst, [$cb]) -- Move a file on the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$src | string | Source path |
$dst | string | Destination path |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation mv.
bdrives¶
bdrives($bid, [$cb]) -- List drives on the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation drives.
bls¶
bls($bid, $path, [$cb]) -- List directory contents.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$path | string | Directory path |
$cb | function | Optional callback |
Returns: $null
Dispatches: fileops task with operation ls.
Beacon: Process Management¶
bps¶
bps($bid, [$cb]) -- List running processes.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: ps task.
bkill¶
bkill($bid, $pid, [$cb]) -- Kill a process by PID.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Process ID to kill |
$cb | function | Optional callback |
Returns: $null
Dispatches: kill task.
bjobs¶
bjobs($bid, [$cb]) -- List active post-exploitation jobs.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: jobs task.
bjobkill¶
bjobkill($bid, $job_id, [$cb]) -- Kill a specific job.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$job_id | string | Job ID to kill |
$cb | function | Optional callback |
Returns: $null
Dispatches: jobkill task.
Beacon: Configuration¶
bsleep¶
bsleep($bid, $interval, [$jitter]) -- Set beacon sleep interval and jitter.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$interval | int | Sleep interval in seconds |
$jitter | int | Jitter percentage (0-99) |
Returns: $null
Note: Registry-only update. Beacon picks up new values on next check-in.
bsleepu¶
bsleepu($bid, $sleep_string) -- Set sleep using human-readable duration string.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$sleep_string | string | Duration: "2d 13h 45m 8s 30j" (d=days, h=hours, m=minutes, s=seconds, j=jitter) |
Returns: $null
bspawnto¶
bspawnto($bid, $arch, $path) -- Set the fork-and-run sacrificial process.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$arch | string | Architecture: "x86" or "x64" |
$path | string | Process path (e.g., "C:\\Windows\\System32\\svchost.exe") |
Returns: $null
bargue¶
bargue($bid, $action, [$process], [$fake_args]) -- Manage argument spoofing rules.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$action | string | "add", "remove", or "list" |
$process | string | Process name (required for add/remove) |
$fake_args | string | Spoofed argument string (required for add) |
Returns: $null
Dispatches: argue task.
bargue_add¶
bargue_add($bid, $process, $fake_args) -- Add an argument spoofing rule.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$process | string | Process name |
$fake_args | string | Spoofed arguments |
Returns: $null
bargue_list¶
bargue_list($bid) -- List all argument spoofing rules.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
bargue_remove¶
bargue_remove($bid, $process) -- Remove an argument spoofing rule.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$process | string | Process name to remove rule for |
Returns: $null
bppid¶
bppid($bid, $pid) -- Set PPID spoofing target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Parent PID to spoof (0 to disable) |
Returns: $null
bblockdlls¶
bblockdlls($bid, $enabled) -- Toggle BlockDLLs policy for fork-and-run operations.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$enabled | bool | true to enable, false to disable |
Returns: $null
bmode¶
bmode($bid, $mode) -- Change the beacon's DNS transport mode.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$mode | string | "dns", "dns6", or "dns-txt" |
Returns: $null
Dispatches: transport_mode task.
bexit¶
bexit($bid) -- Instruct the beacon to terminate.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
Dispatches: exit task.
bcheckin¶
bcheckin($bid) -- Force the beacon to call home and re-send metadata.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
Dispatches: checkin task.
blink¶
blink($bid, $target, [$pipename]) -- Connect to a P2P beacon via SMB named pipe.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target hostname or IP |
$pipename | string | Pipe name (default: \\.\pipe\stentor) |
Returns: $null
Dispatches: p2p_connect task.
bunlink¶
bunlink($bid, $child_beacon_id) -- Disconnect a child P2P beacon link.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$child_beacon_id | string | Child beacon ID to unlink |
Returns: $null
Dispatches: p2p_unlink task.
bpause¶
bpause($bid, $ms) -- Enqueue a one-off pause task.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$ms | int | Pause duration in milliseconds |
Returns: $null
Dispatches: pause task.
bsyscall_method¶
bsyscall_method($bid, $method) -- Set the beacon's syscall invocation method.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$method | string | "None", "Direct", or "Indirect" |
Returns: $null
bbeacon_config¶
bbeacon_config($bid) -- Get beacon configuration as a hash.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: %hash with keys: sleep, jitter, arch, os, hostname, username, ip, pid, id, syscall_method.
bbeacon_gate¶
bbeacon_gate($bid, $enabled) -- Toggle BeaconGate (indirect syscalls on sensitive APIs).
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$enabled | bool | true to enable, false to disable |
Returns: $null
Beacon: Credentials¶
bhashdump¶
bhashdump($bid, [$cb]) -- Dump SAM hashes from the target.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method sam_dump.
blogonpasswords¶
blogonpasswords($bid, [$cb]) -- Dump logon passwords from LSASS.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method lsass.
bdcsync¶
bdcsync($bid, $domain, $user, [$cb]) -- Perform DCSync replication attack.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Target domain |
$user | string | User to replicate (e.g., "krbtgt") |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method dcsync.
bmimikatz¶
bmimikatz($bid, $command, [$cb]) -- Run a Mimikatz command.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$command | string | Mimikatz command string |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method lsass.
bmimikatz_small¶
bmimikatz_small($bid, $command, [$cb]) -- Run Mimikatz in-process (smaller footprint).
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$command | string | Mimikatz command |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method mimikatz_small.
bkerberoast¶
bkerberoast($bid, [$domain, $user, $password], [$cb]) -- Perform Kerberoasting attack.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Optional domain (SSPI mode if omitted) |
$user | string | Optional username for explicit creds |
$password | string | Optional password |
$cb | function | Optional callback |
Returns: $null
Dispatches: creds task with method kerberoast.
bkerberos_ccache_use¶
bkerberos_ccache_use($bid, $ccache_path, [$cb]) -- Import a ccache file for Kerberos auth.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$ccache_path | string | Path to ccache file |
$cb | function | Optional callback |
Returns: $null
bkerberos_ticket_purge¶
bkerberos_ticket_purge($bid, [$cb]) -- Purge all Kerberos tickets.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
bkerberos_ticket_use¶
bkerberos_ticket_use($bid, $ticket_data, [$cb]) -- Apply a base64-encoded Kerberos ticket.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$ticket_data | string | Base64-encoded ticket |
$cb | function | Optional callback |
Returns: $null
bpassthehash¶
bpassthehash($bid, $domain, $user, $ntlm_hash, [$cb]) -- Pass-the-Hash attack.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain name |
$user | string | Username |
$ntlm_hash | string | NTLM hash |
$cb | function | Optional callback |
Returns: $null
Dispatches: identity task with technique pth.
bloginuser¶
bloginuser($bid, $domain, $user, $password, [$cb]) -- Log in with explicit credentials.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$user | string | Username |
$password | string | Password |
$cb | function | Optional callback |
Returns: $null
Dispatches: identity task with technique login_user.
bprinterbug¶
bprinterbug($bid, $target, $listener, [$domain_user, $password], [$cb]) -- Trigger PrinterBug (MS-RPRN) coercion.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target server |
$listener | string | Capture listener |
$domain_user | string | Optional DOMAIN\user for auth |
$password | string | Optional password |
$cb | function | Optional callback |
Returns: $null
Dispatches: coerce task with method printerbug.
bpetitpotam¶
bpetitpotam($bid, $target, $listener, [$domain_user, $password], [$cb]) -- Trigger PetitPotam (MS-EFSRPC) coercion.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target server |
$listener | string | Capture listener |
$domain_user | string | Optional DOMAIN\user |
$password | string | Optional password |
$cb | function | Optional callback |
Returns: $null
Dispatches: coerce task with method petitpotam.
bfind_delegation¶
bfind_delegation($bid, [$dc, $domain, $cb]) -- Enumerate delegation configurations via LDAP.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$dc | string | Optional domain controller |
$domain | string | Optional domain |
$cb | function | Optional callback |
Returns: $null
Dispatches: discovery task with method find_delegation.
bticket_dump¶
bticket_dump($bid, [$cb]) -- Extract TGTs from LSASS ticket cache.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: kerberos task with method ticket_dump.
bs4u¶
bs4u($bid, $impersonate_user, $target_spn, $svc_user, $svc_password, $domain, [$dc, $cb]) -- S4U2Self + S4U2Proxy constrained delegation abuse.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$impersonate_user | string | User to impersonate |
$target_spn | string | Target SPN |
$svc_user | string | Service account username |
$svc_password | string | Service account password |
$domain | string | Domain |
$dc | string | Optional domain controller |
$cb | function | Optional callback |
Returns: $null
brbcd¶
brbcd($bid, $target, [$impersonate_user, $domain, $dc, $cb]) -- RBCD attack chain.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target machine |
$impersonate_user | string | Optional user to impersonate |
$domain | string | Optional domain |
$dc | string | Optional DC |
$cb | function | Optional callback |
Returns: $null
bgpo¶
bgpo($bid, $gpo_name, $command, [$arguments, $domain, $dc, $cb]) -- GPO abuse for domain-wide code execution.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$gpo_name | string | Target GPO name |
$command | string | Command to deploy |
$arguments | string | Optional arguments |
$domain | string | Optional domain |
$dc | string | Optional DC |
$cb | function | Optional callback |
Returns: $null
bdcshadow¶
bdcshadow($bid, $target_dn, $attribute, $value, [$domain, $dc, $cb]) -- DCShadow attack.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target_dn | string | Target distinguished name |
$attribute | string | Attribute to modify |
$value | string | New value |
$domain | string | Optional domain |
$dc | string | Optional DC |
$cb | function | Optional callback |
Returns: $null
bdiamondticket¶
bdiamondticket($bid, $domain, $domain_sid, $dc, $krbtgt_key, [$impersonate, $cb]) -- Forge a Diamond Ticket.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$domain_sid | string | Domain SID |
$dc | string | Domain controller |
$krbtgt_key | string | krbtgt AES256 key |
$impersonate | string | Optional user to impersonate |
$cb | function | Optional callback |
Returns: $null
bsapphireticket¶
bsapphireticket($bid, $domain, $dc, $krbtgt_key, $impersonate, [$cb]) -- Forge a Sapphire Ticket.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$dc | string | DC |
$krbtgt_key | string | krbtgt key |
$impersonate | string | User to impersonate |
$cb | function | Optional callback |
Returns: $null
bskeletonkey¶
bskeletonkey($bid, [$password, $cb]) -- Inject skeleton key into LSASS.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$password | string | Optional skeleton key password |
$cb | function | Optional callback |
Returns: $null
blaps¶
blaps($bid, [$target, $cb]) -- Read LAPS passwords via LDAP.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Optional target computer |
$cb | function | Optional callback |
Returns: $null
bgmsa¶
bgmsa($bid, [$target, $cb]) -- Read gMSA passwords via LDAP.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Optional target account |
$cb | function | Optional callback |
Returns: $null
btrustenum¶
btrustenum($bid, [$cb]) -- Enumerate AD trusts.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
bgoldenticket¶
bgoldenticket($bid, $domain, $domain_sid, $dc, $krbtgt_key, [$extra_sids, $cb]) -- Forge a Golden Ticket.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$domain_sid | string | Domain SID |
$dc | string | DC |
$krbtgt_key | string | krbtgt key |
$extra_sids | string | Optional comma-separated extra SIDs |
$cb | function | Optional callback |
Returns: $null
bsidhistory¶
bsidhistory($bid, $target, $sids, [$mode, $cb]) -- Inject SID History attributes.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target user DN |
$sids | string | Comma-separated SIDs |
$mode | string | "ldap" (default) or "dcshadow" |
$cb | function | Optional callback |
Returns: $null
Beacon: Injection¶
binject¶
binject($bid, $pid, $listener, $arch, [$cb]) -- Inject a beacon into a running process.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Target process ID |
$listener | string | Listener name |
$arch | string | Architecture ("x86" or "x64") |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task. Generates beacon shellcode via relay.
bshinject¶
bshinject($bid, $pid, $arch, $shellcode, [$cb]) -- Inject raw shellcode into a process.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Target PID |
$arch | string | Architecture |
$shellcode | string | Raw shellcode bytes |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task with method shinject.
bshspawn¶
bshspawn($bid, $arch, $shellcode, [$cb]) -- Spawn sacrificial process and inject shellcode (fork-and-run).
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$arch | string | Architecture |
$shellcode | string | Raw shellcode bytes |
$cb | function | Optional callback |
Returns: $null
Dispatches: shspawn task.
bdllspawn¶
bdllspawn($bid, $dll, $arg, $desc, $timeout, $arch, [$cb]) -- Fork-and-run DLL execution.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$dll | string | DLL data (raw bytes) |
$arg | string | DLL argument |
$desc | string | Description for logging |
$timeout | int | Timeout in seconds |
$arch | string | Architecture |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task with method dllspawn.
bdllinject¶
bdllinject($bid, $pid, $dll_path, [$cb]) -- Inject a DLL into a process by path.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Target PID |
$dll_path | string | DLL file path on target |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task with method dllinject.
bdllload¶
bdllload($bid, $pid, $path, [$cb]) -- Load a DLL via LoadLibrary.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Target PID |
$path | string | DLL path on target |
$cb | function | Optional callback |
Returns: $null
Dispatches: interop task with method dllload.
Beacon: Jobs¶
bjoblog¶
bjoblog($bid, $message) -- Broadcast job output to console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Job output message |
Returns: $null
Note: Console-only, no task enqueued.
bjob_send_data¶
bjob_send_data($bid, $job_id, $data, [$cb]) -- Send data to a running job.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$job_id | string | Job ID |
$data | string | Data to send |
$cb | function | Optional callback |
Returns: $null
Dispatches: postex task with method job_send_data.
bjoberror¶
bjoberror($bid, $message) -- Broadcast job error to console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Error message |
Returns: $null
Note: Console-only, no task enqueued.
Beacon: Lateral Movement¶
bjump¶
bjump($bid, $method, $target, $listener, [$cb]) -- Lateral movement with payload generation.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$method | string | "psexec", "psexec64", "psexec_psh", "winrm", "winrm64" |
$target | string | Target hostname |
$listener | string | Listener name |
$cb | function | Optional callback |
Returns: $null
Dispatches: lateral task. Generates payload via relay.
bremote_exec¶
bremote_exec($bid, $method, $target, $command, [$cb]) -- Execute command on remote host.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$method | string | Execution method (e.g., "wmi", "winrm", "psexec") |
$target | string | Target hostname |
$command | string | Command to execute |
$cb | function | Optional callback |
Returns: $null
Dispatches: lateral task.
bpsexec¶
bpsexec($bid, $target, $listener, $service_name, [$cb]) -- Service-based lateral movement.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target hostname |
$listener | string | Listener name |
$service_name | string | Service name (empty for auto) |
$cb | function | Optional callback |
Returns: $null
Dispatches: lateral task. Generates service EXE via relay.
bwmi¶
bwmi($bid, $target, $command, [$cb]) -- WMI remote command execution.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target hostname |
$command | string | Command to run |
$cb | function | Optional callback |
Returns: $null
bwinrm¶
bwinrm($bid, $target, $command, [$cb]) -- WinRM remote command execution.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target hostname |
$command | string | Command to run |
$cb | function | Optional callback |
Returns: $null
bpsexec_command¶
bpsexec_command($bid, $target, $command, [$cb]) -- PsExec command execution (no payload).
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$target | string | Target hostname |
$command | string | Command to execute |
$cb | function | Optional callback |
Returns: $null
Beacon: Network¶
bportscan¶
bportscan($bid, $targets, $ports, $method, $maxconn, [$cb]) -- Port scan targets.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$targets | string | Target IPs/ranges |
$ports | string | Port ranges (e.g., "1-1024,3389,8080") |
$method | string | Discovery: "arp", "icmp", "none" |
$maxconn | int | Max concurrent connections |
$cb | function | Optional callback |
Returns: $null
Dispatches: discovery task with method portscan.
bnet¶
bnet($bid, $command, [$arg1], [$arg2]) -- Network enumeration commands.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$command | string | One of: domain, group, user, localgroup, logons, sessions, share, time, dclist, computers, domain_trusts, view |
$arg1 | string | Optional target |
$arg2 | string | Optional parameter |
Returns: $null
Dispatches: discovery task with method net_<command>.
bsocks_start¶
bsocks_start($bid, $port, [$user, $pass]) -- Start a SOCKS proxy.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$port | int | Local SOCKS port |
$user | string | Optional username for auth |
$pass | string | Optional password |
Returns: $null
Note: Server-side operation. No beacon task enqueued.
bsocks_stop¶
bsocks_stop($bid) -- Stop the SOCKS proxy.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
bsocks¶
bsocks($bid, $port, [$user, $pass]) -- Alias for bsocks_start.
brportfwd¶
brportfwd($bid, $bind_port, $dest_host, $dest_port) -- Reverse port forward.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$bind_port | int | Port to bind on beacon |
$dest_host | string | Forward destination host |
$dest_port | int | Forward destination port |
Returns: $null
Dispatches: rportfwd task.
brportfwd_stop¶
brportfwd_stop($bid, $bind_port) -- Stop a reverse port forward.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$bind_port | int | Port to stop |
Returns: $null
brportfwd_local¶
brportfwd_local($bid, $bind_port, $dest_host, $dest_port, [$cb]) -- Local reverse port forward.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$bind_port | int | Bind port |
$dest_host | string | Destination host |
$dest_port | int | Destination port |
$cb | function | Optional callback |
Returns: $null
bipconfig¶
bipconfig($bid, [$cb]) -- Query network configuration.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: discovery task with method ipconfig.
bconnect¶
bconnect($bid, $host, $port, [$cb]) -- TCP P2P beacon connection.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$host | string | Target host |
$port | int | Target port |
$cb | function | Optional callback |
Returns: $null
Dispatches: p2p_connect task with protocol tcp.
bcovertvpn¶
bcovertvpn($bid, $interface, [$cb]) -- Covert VPN (not yet supported).
Note: Returns an error message. Use brportfwd instead.
bspunnel¶
bspunnel($bid, $target, $port, $listener, [$cb]) -- Reverse port forward tunnel (not yet supported).
Note: Returns an error message. Use brportfwd instead.
bspunnel_local¶
bspunnel_local($bid, $target, $port, $listener, [$cb]) -- Local reverse port forward tunnel (not yet supported).
Note: Returns an error message. Use brportfwd_local instead.
Beacon: Output¶
btask¶
btask($bid, $description, [$tactic]) -- Display task description in console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$description | string | Task description text |
$tactic | string | Optional MITRE tactic tag |
Returns: $null
Note: Console-only, no task enqueued.
binput¶
binput($bid, $message) -- Display input message in console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Input text to display |
Returns: $null
blog¶
blog($bid, $message) -- Display output message in console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Output text |
Returns: $null
berror¶
berror($bid, $message) -- Display error message in console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Error text |
Returns: $null
Beacon: PowerShell¶
bpsinject¶
bpsinject($bid, $pid, $command, [$cb]) -- Inject PowerShell into a specific process.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pid | int | Target PID |
$command | string | PowerShell command |
$cb | function | Optional callback |
Returns: $null
Dispatches: inject task with technique psinject.
bpowershell_import_clear¶
bpowershell_import_clear($bid) -- Clear the imported PowerShell script.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
Beacon: Privilege Escalation¶
bgetsystem¶
bgetsystem($bid, [$cb]) -- Elevate to SYSTEM via named pipe impersonation.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$cb | function | Optional callback |
Returns: $null
Dispatches: privesc task with method getsystem. Requires High integrity.
belevate¶
belevate($bid, $exploit, $listener, [$cb]) -- Run a UAC bypass exploit.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$exploit | string | Exploit name (e.g., "uac-token-duplication", "uac-cmstplua") |
$listener | string | Listener for elevated beacon |
$cb | function | Optional callback |
Returns: $null
Dispatches: privesc task. Generates EXE payload via relay.
brunasadmin¶
brunasadmin($bid, $exploit, $command, [$cb]) -- Run a command with admin privileges via UAC bypass.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$exploit | string | Exploit name |
$command | string | Command to run elevated |
$cb | function | Optional callback |
Returns: $null
Dispatches: privesc task with method runasadmin.
bspawnas¶
bspawnas($bid, $domain, $user, $password, $listener, [$cb]) -- Spawn a beacon as another user.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$user | string | Username |
$password | string | Password |
$listener | string | Listener name |
$cb | function | Optional callback |
Returns: $null
Dispatches: identity task with method spawnas. Generates shellcode via relay.
brunas¶
brunas($bid, $domain, $user, $password, $command, [$cb]) -- Run a command as another user.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$domain | string | Domain |
$user | string | Username |
$password | string | Password |
$command | string | Command to run |
$cb | function | Optional callback |
Returns: $null
Dispatches: identity task with method runas.
Beacon: Queue¶
bclear¶
bclear($bid) -- Clear all pending tasks for a beacon.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
Returns: $null
Note: Server-side queue operation.
bread_pipe¶
bread_pipe($bid, $pipename, [$cb]) -- Read from a named pipe.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$pipename | string | Named pipe path |
$cb | function | Optional callback |
Returns: $null
Dispatches: postex task with method read_pipe.
blog2¶
blog2($bid, $message) -- Display secondary output in console.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$message | string | Secondary output text |
Returns: $null
Note: Console-only (type output2). Distinct from blog (type output).
Beacon: Reconnaissance¶
Full Reconnaissance Functions (25 functions)
bscreenshot¶
bscreenshot($bid, [$cb]) -- Take a screenshot.
Dispatches: collect task with technique screenshot.
bscreenwatch¶
bscreenwatch($bid, $interval, [$cb]) -- Start continuous screenshots.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$interval | int | Capture interval in seconds |
Dispatches: collect task with technique screenwatch.
bkeylogger¶
bkeylogger($bid, [$cb]) -- Start keylogger.
Dispatches: collect task with technique keylogger.
bchromiumdump¶
bchromiumdump($bid, [$cb]) -- Dump Chromium browser credentials and cookies.
Dispatches: chromedump task.
bdesktop¶
bdesktop($bid, [$cb]) -- Start VNC-like desktop viewing.
Dispatches: collect task with technique desktop.
bnote¶
bnote($bid, $note) -- Set beacon note. Registry-only, no task enqueued.
bcd¶
bcd($bid, $path, [$cb]) -- Change working directory.
Dispatches: fileops task with operation cd.
bpwd¶
bpwd($bid, [$cb]) -- Print working directory.
Dispatches: fileops task with operation pwd.
bsetenv¶
bsetenv($bid, $name, $value, [$cb]) -- Set environment variable.
btimestomp¶
btimestomp($bid, $target, $source, [$cb]) -- Copy timestamps from source to target file.
Dispatches: fileops task with operation timestomp.
bchmod¶
bchmod($bid, $path, $mode, [$cb]) -- Change file permissions.
bldap_query¶
bldap_query($bid, $base_dn, $filter, [$attributes], [$scope], [$dc], [$domain], [$cb]) -- Execute LDAP query.
Dispatches: discovery task with method ldap_query.
bedr_query¶
bedr_query($bid, [$cb]) -- Scan for EDR userland hooks.
Dispatches: evasion task with method edr_query.
bedr_unhook¶
bedr_unhook($bid, [$strategy], [$function], [$dll], [$cb]) -- Remove EDR hooks.
| Parameter | Type | Description |
|---|---|---|
$strategy | string | "knowndlls" (default), "remap", "direct" |
$function | string | Optional specific function |
$dll | string | Target DLL (default: ntdll.dll) |
bhwbp¶
bhwbp($bid, $target, [$enable], [$cb]) -- Hardware breakpoint evasion (AMSI/ETW bypass).
| Parameter | Type | Description |
|---|---|---|
$target | string | Target function (e.g., "amsi", "etw") |
$enable | bool | true to enable (default), false to clear |
bsleep_config¶
bsleep_config($bid, $setting, $value, [$cb]) -- Control sleep masking options.
| Parameter | Type | Description |
|---|---|---|
$setting | string | "sleep_mask", "heap_mask", "stack_spoof", "method", "stack_depth" |
$value | string | "on"/"off" for toggles, method name, or depth number |
bprintscreen¶
bprintscreen($bid, [$cb]) -- Take screenshot via PrintScreen API.
bclipboard¶
bclipboard($bid, [$cb]) -- Grab clipboard contents.
bbrowser¶
bbrowser($bid, [$cb]) -- Dump browser credentials and cookies.
bbrowserpivot¶
bbrowserpivot($bid, $pid, $port, [$cb]) -- Start browser pivot.
| Parameter | Type | Description |
|---|---|---|
$pid | int | Browser process PID |
$port | int | Local proxy port |
bbrowserpivot_stop¶
bbrowserpivot_stop($bid) -- Stop browser pivot.
bbits_download¶
bbits_download($bid, $url, $path, [$cb]) -- BITS download job.
bbits_persist¶
bbits_persist($bid, $url, $path, $command, [$cb]) -- Persistent BITS job with notification command.
bbits_list¶
bbits_list($bid, [$cb]) -- Enumerate active BITS jobs.
bbits_cancel¶
bbits_cancel($bid, [$job_name], [$cb]) -- Cancel BITS jobs.
Beacon: Registry & Services¶
breg_query¶
breg_query($bid, $hive, $path, [$cb]) -- Query a registry key.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$hive | string | Registry hive (e.g., "HKLM", "HKCU") |
$path | string | Key path |
$cb | function | Optional callback |
Returns: $null
Dispatches: registry task with operation query.
breg_queryv¶
breg_queryv($bid, $hive, $path, $name, [$cb]) -- Query a specific registry value.
breg_set¶
breg_set($bid, $hive, $path, $name, $type, $value, [$cb]) -- Set a registry value.
| Parameter | Type | Description |
|---|---|---|
$type | string | Registry type: "REG_SZ", "REG_DWORD", "REG_EXPAND_SZ" |
breg_set($1, "HKCU", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", "Updater", "REG_SZ", "C:\\temp\\svc.exe");
breg_delete¶
breg_delete($bid, $hive, $path, [$name], [$cb]) -- Delete a registry key or value.
bservice_register¶
bservice_register($bid, $name, $display, $exe, [$cb]) -- Register a Windows service.
bservice_delete¶
bservice_delete($bid, $name, [$cb]) -- Delete a Windows service.
Beacon: Spawn & Identity¶
bspawn¶
bspawn($bid, $listener, [$arch], [$cb]) -- Spawn a new beacon session.
| Parameter | Type | Description |
|---|---|---|
$bid | string | Beacon ID |
$listener | string | Listener name |
$arch | string | Architecture (default "x64") |
$cb | function | Optional callback |
Dispatches: spawn task. Generates shellcode via relay.
bspawnu¶
bspawnu($bid, $pid, $listener, [$cb]) -- Spawn beacon under another process (PPID spoofing).
brunu¶
brunu($bid, $pid, $command, [$cb]) -- Run command in context of another process.
belevate_command¶
belevate_command($bid, $exploit, $command, [$cb]) -- Elevate and run a command.
Beacon: SSH¶
bssh¶
bssh($bid, $host, $port, $user, $pass, [$cb]) -- Initiate SSH session.
bssh_command¶
bssh_command($bid, $command, [$cb]) -- Execute command in SSH session.
bssh_key¶
bssh_key($bid, $host, $port, $user, $key_path, [$cb]) -- SSH with key-based auth.
bsudo¶
bsudo($bid, $password, $command, [$cb]) -- Execute command with sudo.
Beacon: Token¶
bsteal_token¶
bsteal_token($bid, $pid, [$cb]) -- Steal a token from a process.
Dispatches: identity task with technique steal_token.
bmake_token¶
bmake_token($bid, $domain, $user, $password, [$cb]) -- Create a token with credentials.
Dispatches: identity task with technique make_token.
bgetuid¶
bgetuid($bid, [$cb]) -- Get current user identity.
brev2self¶
brev2self($bid, [$cb]) -- Revert to original token.
bgetprivs¶
bgetprivs($bid, [$cb]) -- Query token privileges.
btoken_store_steal¶
btoken_store_steal($bid, $pid, [$cb]) -- Steal and store a token.
btoken_store_use¶
btoken_store_use($bid, $token_id, [$cb]) -- Apply a stored token.
btoken_store_remove¶
btoken_store_remove($bid, $token_id, [$cb]) -- Remove a stored token.
btoken_store_show¶
btoken_store_show($bid, [$cb]) -- List all stored tokens.
btoken_store_remove_all¶
btoken_store_remove_all($bid, [$cb]) -- Clear all stored tokens.
btoken_store_steal_and_use¶
btoken_store_steal_and_use($bid, $pid, [$cb]) -- Steal, store, and immediately apply a token.
Beacon: Data / Info¶
bdata¶
bdata($bid) -- Get all beacon metadata as a hash.
Returns: %hash with keys: id, computer, user, internal, os, barch, pid, note, sleep, jitter, last, alive.
binfo¶
binfo($bid, $key) -- Get a specific beacon metadata field.
| Parameter | Type | Description |
|---|---|---|
$key | string | "computer", "user", "internal", "os", "barch", "pid", "note", "last" |
Returns: The field value, or $null if not found.
bdata_store_load¶
bdata_store_load($bid, $slot, [$cb]) -- Load a data store slot.
bdata_store_unload¶
bdata_store_unload($bid, $slot, [$cb]) -- Unload a data store slot.
bdata_store_list¶
bdata_store_list($bid, [$cb]) -- List all data store slots.
Data Model¶
beacons¶
beacons() -- Get all active beacons.
Returns: @array of %hash entries with beacon metadata.
beacon_info¶
beacon_info($bid, $key) -- Get beacon info by key (alias for binfo).
data_keys¶
data_keys() -- List available data model keys.
Returns: @array of available key names.
data_query¶
data_query($key) -- Query a data model key.
Returns: Data for the specified key.
credentials¶
credentials() -- Get all harvested credentials.
Returns: @array of %hash credential entries.
targets¶
targets() -- Get all discovered targets.
Returns: @array of %hash target entries.
downloads¶
downloads() -- Get all file downloads.
Returns: @array of download records.
keystrokes¶
keystrokes() -- Get all captured keystrokes.
Returns: @array of keystroke records.
screenshots¶
screenshots() -- Get all captured screenshots.
Returns: @array of screenshot records.
archives¶
archives() -- Get all archived data.
Returns: @array of archive records.
applications¶
applications() -- Get discovered applications.
Returns: @array of application records.
listeners¶
listeners() -- Get all configured listeners.
Returns: @array of %hash listener entries.
listener_info¶
listener_info($name, $key) -- Get listener info by key.
sites¶
sites() -- Get all hosted sites.
Returns: @array of site records.
Dialog & UI¶
Dialog & UI Functions (38 functions)
openBeaconConsole¶
openBeaconConsole($bid) -- Navigate UI to beacon console.
openPayloadDialog / openListenerDialog / openPayloadGeneratorDialog¶
Navigation functions that open the corresponding UI dialog.
openPreferencesDialog / openAboutDialog / openApplicationManager¶
Navigation functions for settings and info dialogs.
openPayloadHelper / openListenerManager¶
Navigation functions for payload and listener management.
openWindowsExecutableDialog / openWindowsExecutableStageDialog¶
Navigation functions for executable generation.
openJavaSignedAppletDialog / openJavaSmartAppletDialog / openHTMLApplicationDialog / openScriptedWebDeliveryDialog¶
Navigation functions for attack package dialogs.
prompt_text¶
prompt_text($title, $message, $callback) -- Show text input prompt.
prompt_confirm¶
prompt_confirm($title, $message, $callback) -- Show confirmation dialog.
prompt_file_open¶
prompt_file_open($title, $callback) -- Show file open dialog.
dialog¶
dialog($title, %defaults, $callback) -- Create a custom dialog.
Returns: $dialog handle for adding fields.
dialog_description¶
dialog_description($dialog, $text) -- Set dialog description text.
dialog_show¶
dialog_show($dialog) -- Display the dialog to the operator.
drow_text / drow_text_big¶
drow_text($dialog, $key, $label) -- Add text input field.
drow_text_big($dialog, $key, $label) -- Add multiline text area.
drow_combobox¶
drow_combobox($dialog, $key, $label, @options) -- Add dropdown selector.
drow_checkbox¶
drow_checkbox($dialog, $key, $label) -- Add checkbox.
drow_file¶
drow_file($dialog, $key, $label) -- Add file selector.
drow_listener / drow_listener_smb / drow_listener_stage¶
drow_listener($dialog, $key, $label) -- Add listener dropdown.
drow_beacon / drow_exploits / drow_interface¶
Specialized dropdowns for beacons, exploits, and network interfaces.
drow_krbtgt / drow_mailserver / drow_proxyserver / drow_site¶
Specialized dropdowns for Kerberos, mail, proxy, and site selectors.
dbutton_action¶
dbutton_action($dialog, $label) -- Add action button.
dbutton_help¶
dbutton_help($dialog, $url) -- Add help button linking to URL.
Output & Events¶
say¶
say($message) -- Broadcast a chat message to all operators.
elog¶
elog($message) -- Log an event message.
action¶
action($message) -- Broadcast an action message (IRC-style).
privmsg¶
privmsg($target, $message) -- Send a private message.
custom_event¶
custom_event($event_name, $data) -- Fire a custom event.
custom_event_private¶
custom_event_private($event_name, $data) -- Fire a private custom event.
chat_private¶
chat_private($target, $message) -- Send private chat.
event_private¶
event_private($event_name, $data) -- Fire private event.
event_notify¶
event_notify($title, $message) -- Show UI notification.
Tab & Visualization¶
addTab¶
addTab($title, $callback) -- Add a custom tab to the UI.
addVisualization¶
addVisualization($name, $callback) -- Register a custom visualization.
showVisualization¶
showVisualization($name) -- Display a registered visualization.
Menu¶
popup_clear¶
popup_clear($hook) -- Clear all popup menu items from a hook.
menubar¶
menubar($label, $callback) -- Add a top-level menu bar item.
Registration¶
beacon_command_register¶
beacon_command_register($name, $description, $usage) -- Register a custom beacon command.
beacon_exploit_register¶
beacon_exploit_register($name, $description, $callback) -- Register an elevation exploit.
beacon_remote_exploit_register¶
beacon_remote_exploit_register($name, $description, $arch, $callback) -- Register a lateral movement technique.
beacon_remote_exec_method_register¶
beacon_remote_exec_method_register($name, $callback) -- Register a remote-exec method.
beacon_command_describe¶
beacon_command_describe($name) -- Get command description.
Returns: string description or "".
beacon_command_detail¶
beacon_command_detail($name) -- Get command usage details.
Returns: string usage or "".
beacon_command_group¶
beacon_command_group($name) -- Get command group/category.
Returns: string (stub, returns "").
beacon_commands¶
beacon_commands() -- List all available commands.
Returns: @array of sorted command names.
beacon_exploits¶
beacon_exploits() -- List registered elevation exploits.
Returns: @array of exploit names.
beacon_elevators¶
beacon_elevators() -- Alias for beacon_exploits().
beacon_remote_exploits¶
beacon_remote_exploits() -- List registered lateral movement techniques.
Returns: @array of remote exploit names.
beacon_remote_exec_methods¶
beacon_remote_exec_methods() -- List remote-exec methods.
Returns: @array of method names (built-in + CNA-registered).
Payload Generation¶
stager¶
stager($listener, $arch) -- Generate a stager payload.
Returns: Raw stager bytes.
payload¶
payload($listener, $arch) -- Generate a full payload.
Returns: Raw payload bytes.
artifact_payload¶
artifact_payload($listener, $type, $arch) -- Generate an artifact payload (EXE, DLL).
Returns: Artifact bytes.
artifact_stager¶
artifact_stager($listener, $type, $arch) -- Generate an artifact stager.
Returns: Stager artifact bytes.
artifact_general¶
artifact_general($data, $type) -- Generate a general artifact from raw data.
Returns: Artifact bytes.
payload_local¶
payload_local($listener, $arch) -- Generate a local payload.
Returns: Payload bytes.
payload_bootstrap_hint¶
payload_bootstrap_hint($listener) -- Get bootstrap hint for a listener.
Returns: Bootstrap data string.
PE Manipulation¶
PE Manipulation Functions (18 functions)
pedump¶
pedump($data) -- Dump PE header information.
Returns: %hash with PE metadata.
pe_mask¶
pe_mask($data, $key) -- XOR mask entire PE.
Returns: Masked PE bytes.
pe_mask_section¶
pe_mask_section($data, $section, $key) -- XOR mask a specific PE section.
pe_mask_string¶
pe_mask_string($data, $string, $key) -- XOR mask a specific string in PE.
pe_set_long¶
pe_set_long($data, $offset, $value) -- Set a 32-bit value at offset.
pe_set_short¶
pe_set_short($data, $offset, $value) -- Set a 16-bit value at offset.
pe_set_string¶
pe_set_string($data, $offset, $value) -- Set a string at offset.
pe_set_stringz¶
pe_set_stringz($data, $offset, $value) -- Set a null-terminated string at offset.
pe_set_value_at¶
pe_set_value_at($data, $offset, $value, $size) -- Set value at offset with size.
pe_stomp¶
pe_stomp($data) -- Stomp PE headers for evasion.
Returns: Stomped PE bytes.
pe_patch_code¶
pe_patch_code($data, $offset, $patch) -- Patch code at offset.
pe_insert_rich_header¶
pe_insert_rich_header($data, $header) -- Insert Rich header.
pe_remove_rich_header¶
pe_remove_rich_header($data) -- Remove Rich header.
pe_set_compile_time_with_long¶
pe_set_compile_time_with_long($data, $timestamp) -- Set compile time (epoch).
pe_set_compile_time_with_string¶
pe_set_compile_time_with_string($data, $timestr) -- Set compile time (string).
pe_set_export_name¶
pe_set_export_name($data, $name) -- Set PE export name.
pe_update_checksum¶
pe_update_checksum($data) -- Recalculate PE checksum.
Returns: PE bytes with corrected checksum.
setup_reflective_loader¶
setup_reflective_loader($data) -- Configure reflective loader.
Process Injection Config¶
Process Injection Config Functions (16 functions)
pi_spawn_get / pi_spawn_set / pi_spawn_info¶
Get, set, and query process injection spawn configuration.
pi_explicit_get / pi_explicit_set / pi_explicit_info¶
Get, set, and query explicit injection configuration.
pi_user_spawn_get / pi_user_spawn_set / pi_user_spawn_clear¶
Per-user spawn injection overrides: get, set, and clear.
pi_user_spawn_get_map / pi_user_spawn_get_names¶
Get the full user spawn map or list of configured names.
pi_user_explicit_get / pi_user_explicit_set / pi_user_explicit_clear¶
Per-user explicit injection overrides: get, set, and clear.
pi_user_explicit_get_map / pi_user_explicit_get_names¶
Get the full user explicit map or list of configured names.
Report DSL¶
Report DSL Functions (15 functions)
report¶
report($title) -- Create a new report.
page¶
page($report, $title) -- Add a page to a report.
h1 / h2 / h3 / h4¶
h1($page, $text) through h4($page, $text) -- Add headings.
p¶
p($page, $text) -- Add a paragraph.
br¶
br($page) -- Add a line break.
describe¶
describe($page, $text) -- Add a description block.
table¶
table($page, @headers, @rows) -- Add a data table.
kvtable¶
kvtable($page, %data) -- Add a key-value table.
layout¶
layout($page, @columns) -- Set page layout.
bookmark¶
bookmark($page, $name) -- Add a bookmark.
report_save¶
report_save($report, $path) -- Save report to file.
report_generate¶
report_generate($report) -- Generate report output.
Report Data¶
agCredentials¶
agCredentials() -- Get credentials for reporting.
Returns: @array of credential records.
agTargets¶
agTargets() -- Get targets for reporting.
agSessions¶
agSessions() -- Get session history for reporting.
agApplications¶
agApplications() -- Get applications for reporting.
agTokens¶
agTokens() -- Get token data for reporting.
agC2info¶
agC2info() -- Get C2 infrastructure info for reporting.
agServices¶
agServices() -- Get service data for reporting.
Utility: General¶
base64_encode¶
base64_encode($data) -- Base64 encode data.
Returns: string base64-encoded result.
base64_decode¶
base64_decode($data) -- Base64 decode data.
Returns: Decoded bytes as string.
str_encode¶
str_encode($data, $encoding) -- Encode string to specified encoding.
mynick¶
mynick() -- Get current operator nickname.
Returns: string nickname.
tstamp¶
tstamp($epoch) -- Format epoch timestamp as human-readable string.
Returns: Formatted date string.
ticks¶
ticks() -- Get current time in milliseconds.
Returns: long milliseconds since epoch.
script_resource¶
script_resource($path) -- Resolve a path relative to the running script.
Returns: Absolute path string.
formatDate¶
formatDate($epoch, $format) -- Format epoch timestamp with pattern.
Returns: Formatted date string.
Utility: String¶
dstamp¶
dstamp($epoch) -- Format epoch as short date stamp.
format_size¶
format_size($bytes) -- Format byte count as human-readable size.
Returns: string like "1.5 MB".
encode¶
encode($data, $encoding) -- Encode data with specified encoding.
str_chunk¶
str_chunk($data, $size) -- Split string into chunks.
Returns: @array of chunk strings.
str_decode¶
str_decode($data, $encoding) -- Decode encoded data.
str_xor¶
str_xor($data, $key) -- XOR string with key.
Returns: XOR result bytes.
Utility: Network¶
sync_download¶
sync_download($url) -- Download a URL synchronously.
Returns: Downloaded content as string.
tokenToEmail¶
tokenToEmail($token) -- Extract email from JWT token.
Returns: Email string.
url_open¶
url_open($url) -- Open a URL in the default browser.
users¶
users() -- Get connected operator users.
Returns: @array of user info.
closeClient¶
closeClient() -- Disconnect from the teamserver.
fireEvent¶
fireEvent($event_name, $args...) -- Fire a named event.
Utility: Compression¶
gzip¶
gzip($data) -- Gzip compress data.
Returns: Compressed bytes.
gunzip¶
gunzip($data) -- Gzip decompress data.
Returns: Decompressed bytes.
Utility: Transform¶
transform¶
transform($data, $transform_name) -- Apply a named transform to data.
Returns: Transformed bytes.
transform_vbs¶
transform_vbs($data) -- Transform data to VBScript format.
Returns: VBScript-encoded string.
PowerShell Utility¶
powershell_command¶
powershell_command($cmd) -- Build a PowerShell one-liner command string.
Returns: string powershell command.
powershell_compress¶
powershell_compress($script) -- Compress PowerShell script for delivery.
Returns: Compressed script string.
powershell_encode_oneliner¶
powershell_encode_oneliner($cmd) -- Encode as PowerShell -EncodedCommand.
Returns: string encoded one-liner.
powershell_encode_stager¶
powershell_encode_stager($cmd) -- Encode as PowerShell stager.
Returns: string stager command.
Attack (MITRE)¶
attack_describe¶
attack_describe($technique_id) -- Get ATT&CK technique description.
Returns: string description.
attack_name¶
attack_name($technique_id) -- Get ATT&CK technique name.
Returns: string name.
attack_detect¶
attack_detect($technique_id) -- Get detection guidance.
Returns: string detection methods.
attack_mitigate¶
attack_mitigate($technique_id) -- Get mitigation guidance.
Returns: string mitigations.
attack_tactics¶
attack_tactics($technique_id) -- Get associated tactics.
Returns: @array of tactic names.
attack_url¶
attack_url($technique_id) -- Get ATT&CK page URL.
Returns: string URL.
Predicates¶
Predicate functions evaluate beacon properties and return TRUE or FALSE. Available with both - prefix (CS convention) and without.
-is64 / is64¶
-is64($bid) -- Check if beacon is 64-bit.
-isadmin / isadmin¶
-isadmin($bid) -- Check if beacon has admin privileges.
-isactive / isactive¶
-isactive($bid) -- Check if beacon is active (within 3x sleep interval).
-isbeacon / isbeacon¶
-isbeacon($bid) -- Check if entry is a beacon (always true for beacons).
-isssh / isssh¶
-isssh($bid) -- Check if session is SSH.
-islinux / islinux¶
-islinux($bid) -- Check if beacon is on Linux.
Preferences¶
pref_get¶
pref_get($key) -- Get a preference value.
Returns: Preference value or $null.
pref_set¶
pref_set($key, $value) -- Set a preference value.
Setup¶
setup_strings¶
setup_strings() -- Get setup string configuration.
Returns: Setup strings hash.
setup_transformations¶
setup_transformations() -- Get setup transformation configuration.
Returns: Setup transformations data.
Listener Lifecycle¶
listener_create¶
listener_create($name, $type, %config) -- Create a new listener.
listener_create_ext¶
listener_create_ext($name, $type, %config) -- Create an external listener.
listener_delete¶
listener_delete($name) -- Delete a listener.
listener_describe¶
listener_describe($name) -- Get listener details (alias for listener_info).
Returns: %hash of listener configuration.
listener_restart¶
listener_restart($name) -- Restart a listener.
listener_pivot_create¶
listener_pivot_create($name, $type, %config) -- Create a pivot listener.
VPN¶
vpn_tap_create¶
vpn_tap_create($bid, $interface) -- Create a VPN TAP interface.
vpn_tap_delete¶
vpn_tap_delete($interface) -- Delete a VPN TAP interface.
vpn_interfaces¶
vpn_interfaces() -- List VPN interfaces.
Returns: @array of interface info.
SSH Registration¶
ssh_command_register¶
ssh_command_register($name, $callback) -- Register a custom SSH command.
ssh_command_describe¶
ssh_command_describe($name) -- Get SSH command description.
Returns: string description.
Credentials & Host¶
credential_add¶
credential_add($user, $password, $realm, $source) -- Add a credential to the data model.
credential_remove¶
credential_remove($user, $realm) -- Remove a credential.
arch¶
arch($bid) -- Get beacon architecture.
Returns: string -- "x64" or "x86".
host_update¶
host_update($address, $key, $value) -- Update host information in the data model.
localip¶
localip() -- Get local IP address.
Returns: string IP address.
Range¶
range¶
range($start, $end) -- Generate a numeric range.
Returns: @array of integers from start to end.
iprange¶
iprange($cidr) -- Expand a CIDR range to individual IPs.
Returns: @array of IP address strings.
Reflective Loader¶
setup_reflective_loader¶
setup_reflective_loader($loader_data) -- Configure the reflective DLL loader.
Sleep Builtins¶
These are the core Sleep language functions available in all CNA scripts.
Output¶
println¶
println($value) -- Print a value followed by a newline.
print¶
print($value) -- Print a value without a trailing newline.
Type Conversion¶
casti¶
casti($value) -- Cast value to integer.
Returns: int
castd¶
castd($value) -- Cast value to double.
Returns: double
castl¶
castl($value) -- Cast value to long.
Returns: long
asc¶
asc($char) -- Get ASCII code of a character.
Returns: int ASCII value.
chr¶
chr($code) -- Get character from ASCII code.
Returns: string single character.
typeof¶
typeof($value) -- Get type name of a value.
Returns: string type name.
String Manipulation¶
charAt¶
charAt($string, $index) -- Get character at index.
Returns: string single character.
indexOf¶
indexOf($string, $search, [$start]) -- Find index of substring.
Returns: int index or -1.
lc¶
lc($string) -- Convert to lowercase.
Returns: string
uc¶
uc($string) -- Convert to uppercase.
Returns: string
left¶
left($string, $count) -- Get leftmost characters.
Returns: string
right¶
right($string, $count) -- Get rightmost characters.
Returns: string
substr¶
substr($string, $start, [$end]) -- Extract substring.
Returns: string
strlen¶
strlen($string) -- Get string length.
Returns: int
strrep¶
strrep($string, $old, $new) -- Replace all occurrences of a substring.
Returns: string
trim¶
trim($string) -- Remove leading/trailing whitespace.
Returns: string
replace¶
replace($string, $pattern, $replacement) -- Regex replace.
Returns: string
split¶
split($delimiter, $string) -- Split string by delimiter.
Returns: @array
join¶
join($delimiter, @array) -- Join array elements.
Returns: string
format¶
format($format_string, $args...) -- Format string (printf-style).
Returns: string
matches¶
matches($string, $pattern) -- Regex match test.
Returns: @array of matches or $null.
Array Operations¶
push¶
push(@array, $value) -- Push value onto end of array.
pop¶
pop(@array) -- Remove and return last element.
Returns: Removed element.
shift¶
shift(@array) -- Remove and return first element.
Returns: Removed element.
add¶
add(@array, $value, [$index]) -- Add value at index (or end).
addAll¶
addAll(@dest, @source) -- Add all elements from source to dest.
copy¶
copy(@array) -- Create a shallow copy.
Returns: @array new copy.
removeAll¶
removeAll(@array, @to_remove) -- Remove matching elements.
removeAt¶
removeAt(@array, $index) -- Remove element at index.
Returns: Removed element.
retainAll¶
retainAll(@array, @to_keep) -- Keep only matching elements.
reverse¶
reverse(@array) -- Reverse array in place.
size¶
size($collection) -- Get size of array, hash, or string.
Returns: int element count.
sorta¶
sorta(@array) -- Sort array alphabetically (ascending).
sortd¶
sortd(@array) -- Sort array alphabetically (descending).
sortn¶
sortn(@array) -- Sort array numerically.
sublist¶
sublist(@array, $start, [$end]) -- Extract a sublist.
Returns: @array slice.
Hash Operations¶
keys¶
keys(%hash) -- Get all keys from a hash.
Returns: @array of key strings.
values¶
values(%hash) -- Get all values from a hash.
Returns: @array of values.
putAll¶
putAll(%dest, %source) -- Merge source hash into dest.
ohash¶
ohash() -- Create an ordered hash (preserves insertion order).
Returns: %hash ordered hash.
Math¶
rand¶
rand($max) -- Generate random integer.
Returns: int from 0 to max-1.
expr¶
expr($expression) -- Evaluate a math expression.
Returns: Numeric result.
Miscellaneous¶
sleep¶
sleep($ms) -- Pause execution for milliseconds.
ticks¶
ticks() -- Get current time in milliseconds.
Returns: long epoch milliseconds.
$start = ticks();
# ... do work ...
$elapsed = ticks() - $start;
println("Took " . $elapsed . "ms");
Cross-references: Language Guide for Sleep syntax basics, Hooks & Events for event-driven scripting patterns.