Skip to content

Commit 7d0abac

Browse files
Merge pull request #252 from ait-testbed/main
up version in development
2 parents 7e0f7d8 + 5043bca commit 7d0abac

8 files changed

Lines changed: 1247 additions & 920 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
AttackMate <img alt="Logo" src="/images/AttackMate_logo_no_logo.png" align="right" height="90">
22
==========
3-
[![Build Status](https://aecidjenkins.ait.ac.at/buildStatus/icon?job=AECID%2FAECID%2Fattackmate%2Fmain)]( "https://aecidjenkins.ait.ac.at/job/AECID/job/AECID/job/attackmate/job/main/")
43

54
AttackMate is a tool to automate cyber attack scenarios that supports scripting of attack techniques across all phases of the Cyber Kill Chain. AttackMate's design principles aim to integrate with penetration testing and attack emulation frameworks such as Metasploit and Sliver Framework and enables simple execution of commands via shell or ssh. For example, AttackMate enables to execute Metasploit modules or generate payloads and run commands in Metasploit sessions. Moreover, it is able to generate Sliver implants, automatize Sliver to send C2 commands, and configure and compile LD_PRELOAD-rootkits. AttackMate also offers a simple interface to automate shell or ssh interaction, run commands in background mode, transfer files via sftp, and start http clients or servers. All attack steps may be scheduled, chained, and repeatedly executed using a simple configuration file that supports variable declarations and conditional workflows.
65

create_hashes.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/source/configuration/remote_config.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ the configuration is used as the default.
2020
.. code-block:: yaml
2121
2222
remote_config:
23-
remote_server:
24-
url: "https://10.0.0.5:5000"
23+
attackmate-server:
24+
url: "https://10.0.0.5:8445"
2525
username: admin
2626
password: securepassword
2727
cafile: "/path/to/cert.pem"
28-
another_server:
29-
url: "https://10.0.0.6:5000"
28+
another-server:
29+
url: "https://10.0.0.6:8445"
3030
username: user
3131
password: anotherpassword
3232
cafile: "/path/to/another_cert.pem"
@@ -38,15 +38,15 @@ default connection is used when none is specified:
3838
.. code-block:: yaml
3939
4040
commands:
41-
# Executed on 'another_server'
41+
# Executed on 'another-server'
4242
- type: remote
43-
connection: another_server
43+
connection: another-server
4444
cmd: execute_command
4545
remote_command:
4646
type: shell
4747
cmd: "whoami"
4848
49-
# Executed on 'remote_server' (defaults to first remote_config entry))
49+
# Executed on 'attackmate-server' (defaults to first remote_config entry))
5050
- type: remote
5151
cmd: execute_playbook
5252
playbook_path: path/to/playbook.yml

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Welcome to AttackMate's documentation!
2222
preparation/index
2323
configuration/index
2424
basic
25+
remote_api_intro
2526

2627
.. toctree::
2728
:maxdepth: 4

docs/source/remote_api_intro.rst

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
.. _remote_api_intro:
2+
3+
==========
4+
Remote API
5+
==========
6+
7+
AttackMate can execute commands and playbooks on a remote AttackMate
8+
instance. This is useful when the tools required by a playbook, such as
9+
Metasploit, Sliver, browsers, or network access to a target environment, are
10+
available on another host.
11+
12+
The remote setup uses two components:
13+
14+
* `attackmate-api-server <https://github.com/ait-testbed/attackmate-api-server>`__:
15+
runs on the remote AttackMate host and exposes an HTTPS API.
16+
* `attackmate-client <https://github.com/ait-testbed/attackmate-client>`__:
17+
runs on the local/client host and sends commands or playbooks to the API
18+
server.
19+
20+
`attackmate-client` offers a CLI and a python library to execute commands and playbooks on a
21+
remote AttackMate server. It is only required on the client when you want to use the Remote API
22+
on an attackmate-api-server.
23+
24+
The `attackmate-ansible <https://github.com/ait-testbed/attackmate-ansible>`__
25+
role can install and configure both sides.
26+
27+
Requirements
28+
============
29+
30+
A working remote setup needs at least:
31+
32+
* AttackMate installed on the server.
33+
* attackmate-api-server installed and running on the server.
34+
* attackmate-client installed on the client, to access the remote API.
35+
* The server TLS certificate copied to the client.
36+
* A valid ``remote_config`` entry on the client, or provided as cli argument to ``attackmate-client``.
37+
* Any tools used by the remote playbook installed on the server, for example
38+
``msfrpcd`` for Metasploit commands.
39+
40+
If you installed ``Attackmate`` on the client, it is not recommended to install ``attackmate-client``, as it will
41+
already have pulled that in as a dependency.
42+
43+
You can install just the ``attackmate-client``, if all you want to do on the client is to send remote commands
44+
and playbooks to the attackmate-api-server via CLI or the python library.
45+
46+
Architecture
47+
============
48+
49+
When a remote playbook uses ``cmd: execute_playbook``, the referenced
50+
``playbook_path`` is read on the client machine. The client then sends the
51+
playbook YAML content to the API server.
52+
53+
The commands inside that submitted playbook run on the server. Therefore paths
54+
inside the submitted playbook, such as payload paths, temporary files, local
55+
uploads, or tool configuration, are resolved on the server.
56+
57+
Sample Config
58+
=============
59+
60+
Save this as ``/etc/attackmate.yml`` on the client:
61+
62+
.. code-block:: yaml
63+
64+
msf_config:
65+
server: localhost
66+
password: hackerman
67+
68+
cmd_config:
69+
command_delay: 2
70+
71+
remote_config:
72+
attackmate-server:
73+
url: "https://10.0.0.5:8445"
74+
username: admin
75+
password: securepassword
76+
cafile: "/etc/ssl/certs/attackmate.pem"
77+
78+
The ``cafile`` must point to the certificate used by the API server. If the
79+
certificate is missing or does not match the server, HTTPS verification will
80+
fail.
81+
82+
First Run
83+
=========
84+
85+
Create a small local wrapper playbook on the client:
86+
87+
.. code-block:: yaml
88+
89+
commands:
90+
- type: remote
91+
cmd: execute_playbook
92+
connection: attackmate-server
93+
playbook_path: examples/remote_put.yml
94+
95+
Run it with:
96+
97+
.. code-block:: console
98+
99+
uv run attackm8 --debug remote_wrapper.yml
100+
101+
The local attackmate should log in to the remote API server, send the referenced playbook, and
102+
print the remote execution result.
103+
104+
Testing The API Server
105+
======================
106+
107+
Check that the API service is reachable:
108+
109+
.. code-block:: console
110+
111+
curl -k https://10.0.0.5:8445/
112+
113+
Metasploit
114+
==========
115+
116+
If a playbook uses Metasploit commands, ``msfrpcd`` must be running on the
117+
server and the AttackMate server configuration must match it.
118+
119+
Example:
120+
121+
.. code-block:: yaml
122+
123+
msf_config:
124+
server: localhost
125+
port: 55553
126+
password: hackerman
127+
ssl: true
128+
129+
A common symptom of a wrong Metasploit configuration, or msfrpcd not running, is:
130+
131+
.. code-block:: text
132+
133+
2026-05-20 11:01:37 INFO | Login successful for 'admin' at https://192.168.0.30:8445. Token stored.
134+
2026-05-20 11:02:37 ERROR | Request Error (POST https://192.168.0.30:8445/playbooks/execute/yaml): The read operation timed out
135+
136+
137+
Troubleshooting
138+
===============
139+
140+
``The read operation timed out``
141+
142+
The client waited longer than its configured HTTP timeout. This can happen when
143+
the remote playbook is still running, waiting for a session, or stuck in a tool
144+
such as Metasploit. Check the server logs and any AttackMate playbook logs.
145+
146+
You can also increase the timeout period of attackmate-client by changing DEFAULT_TIMEOUT in ``/usr/local/share/attackmate/.venv/lib/python3.12/site-packages/attackmate_client/attackmate_client.py``
147+
148+
Server Logs
149+
===========
150+
151+
If file logging is enabled for API playbook runs, inspect the configured log
152+
directory, for example:
153+
154+
.. code-block:: console
155+
156+
tail -f /var/log/attackmate-api/*_output.log

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ dependencies = [
2525
"playwright",
2626
"argon2-cffi",
2727
"uvicorn",
28-
"dotenv",
28+
"python-dotenv>=1.1.0",
2929
"passlib",
30-
"python-multipart",
30+
"python-multipart>=0.0.32",
3131
"attackmate-client>=0.1.2",
3232
]
3333
dynamic = ["version"]

src/attackmate/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
__license__ = 'GPLv3'
99
__maintainer__ = 'Wolfgang Hotwagner, Max Landauer, Markus Wurzenberger, Florian Skopik'
1010
__status__ = 'Production'
11-
__version__ = '1.0.1'
11+
__version__ = '1.0.2'
1212
__version_string__ = (
1313
f'(Austrian Institute of Technology)\t'
1414
f'{__website__}\tVersion: {__version__}')

0 commit comments

Comments
 (0)