shell

Execute local shell commands.

vars:
  $SERVER_ADDRESS: 192.42.0.254
  $NMAP: /usr/bin/nmap

commands:
  - type: shell
    cmd: $NMAP $SERVER_ADDRESS
cmd

The command line to execute locally. Supports variable substitution.

Type:

str

Required:

True

command_shell

The shell used to execute commands.

Type:

str

Default:

/bin/sh

Required:

False

Interactive Mode

interactive

Run the command in interactive mode.

Type:

bool

Default:

False

Required:

False

Instead of waiting for the command to finish, AttackMate reads output until no new output appears for command_timeout seconds. Useful for commands that require follow-up keystrokes (e.g. opening vim and sending input in a subsequent command).

This mode works only on Unix and Unix-like systems.

Warning

Commands executed in interactive mode MUST end with a newline character (\n).

commands:
  # Open nmap in interactive mode and create a named session:
  - type: shell
    cmd: "nmap --interactive\n"
    interactive: True
    creates_session: attacker

  # Send a command to the open interactive session:
  - type: shell
    cmd: "!sh\n"
    interactive: True
    session: attacker
creates_session

Name to assign to the interactive session opened by this command. Can be reused in subsequent commands via session.

Only meaningful when interactive is True.

Type:

str

Required:

False

session

Name of an existing interactive session to reuse. The session must have been created previously via creates_session with interactive set to True.

Type:

str

Required:

False

command_timeout

Seconds to wait for new output before stopping in interactive mode.

Type:

int

Default:

15

Required:

False

read

Wait for output after executing the command. Set to False to return immediately with an empty result, useful for fire-and-forget interactive commands that produce no output.

Type:

bool

Default:

True

Required:

False

Binary Mode

bin

Enable binary mode. In this mode, cmd must be a hex-encoded string representing the raw bytes to execute.

Type:

bool

Default:

False

Required:

False

commands:
  # "6964" is the hex encoding of "id":
  - type: shell
    cmd: "6964"
    bin: true