AttackMate API Server
AttackMate API Server is a RESTful API built with FastAPI for remotely controlling AttackMate instances and executing attack playbooks. It provides secure endpoints to orchestrate attack chains, execute commands, and run attack playbook.
Features
- Execute AttackMate commands or playbooks remotely
- Automatic logging for requests, command execution, and playbooks.
- Supports SSL/TLS for secure communication.
Requirements
- Python 3.11+
- uv
- openssl
Installation
From PyPI:
uv tool install attackmate-api-server
This installs the attackmate-api command on your PATH. Configuration (.env, key.pem, cert.pem) is read
from the directory you start it in.
From source:
git clone https://github.com/ait-testbed/attackmate-api-server.git
cd attackmate-api-server
uv sync
## Developer setup
If you plan to contribute to the development of this package, follow these steps to set up the dev environment and install pre-commit hooks (using [prek](https://github.com/j178/prek))
```bash
uv sync --dev
uv run --dev prek install
Run the tests:
uv run --dev pytest -q
Run the tests with coverage (add --cov-report=html to generate an HTML report):
uv run --dev pytest --cov=. --cov-report=term-missing
Certificate generation
with open ssl
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
Common Name: server IP adress
Clients receive the cert.pem SSL certificate
By default the server looks for key.pem and cert.pem in the directory you start it from
(the same directory as .env). Set SSL_KEY_PATH and SSL_CERT_PATH to use files elsewhere.
Environment Configuration
Create an .env file in the project root with the following variables:
USERS='{"username": "<argon2_hash>", ...}'
ATTACKMATE_CONFIG_PATH="/path/to/attackmate.yml"
WRITE_PLAYBOOK_LOGS_TO_DISK="False"
LOG_DIR="/path/to/logs"
| Variable | Description |
|---|---|
USERS |
JSON object mapping usernames to Argon2-hashed passwords |
ATTACKMATE_CONFIG_PATH |
Absolute path to the AttackMate config YAML |
WRITE_PLAYBOOK_LOGS_TO_DISK |
Whether to persist playbook logs to disk (True/False) |
LOG_DIR |
Directory for log output |
ATTACKMATE_API_SERVER_PORT |
The port on which the server listens for incoming REST API requests. |
To generate a password hash for USERS, run this and type the password when asked:
uv run --with argon2-cffi python -c "import getpass; from argon2 import PasswordHasher; print(PasswordHasher().hash(getpass.getpass()))"
Put the printed hash into your .env file, keeping the outer single quotes (the hash contains $):
USERS='{"alice": "$argon2id$v=19$m=65536,t=3,p=4$..."}'
Running the application
attackmate-api # installed with uv tool install
uv run attackmate-api # from a source checkout
The server will run on https://0.0.0.0:8445 by default.
Can be changed via ATTACKMATE_API_SERVER_PORT in the .env file
Swagger UI: https://:8445/docs – interactive API documentation.
Authentication
The API uses token-based authentication.
Endpoint: POST /login
Request:
{
"username": "your_username",
"password": "your_password"
}
Response:
{
"access_token": "<TOKEN>",
"token_type": "bearer"
}
Use the token in the Authorization header for all protected endpoints
API Endpoints
POST /playbooks/execute/yaml – Execute a playbook provided as YAML content on an AttackMate instantiated for the duration of playbook execution.
POST /command/execute – Execute a command on a persistent AttackMate instance.
Request body must follow the RemotelyExecutableCommand schema
Client Usage
The recommended way to interact with the API is via the AttackMate Client, which provides a convenient interface for authentication, playbook submission, and result retrieval.
Security Notes
Use strong passwords. Anyone who can log in can run commands on the server.
Never commit .env to version control. Ensure .env is listed in .gitignore.
Use CA-signed certificates in production. Self-signed certificates should only be used for local testing.
Restrict network access to the API server to trusted hosts where possible.
Related Projects
AttackMate – the underlying attack orchestration engine AttackMate Client – recommended client for interacting with this API
License
This project is licensed under EUPL-1.2
Metadata
Release files for attackmate-api-server 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| attackmate_api_server-1.1.0.tar.gz | 20.4 kB | With provenance | Details for attackmate_api_server-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| attackmate_api_server-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for attackmate_api_server-1.1.0-py3-none-any.whl |
Total release size: 42.8 kB
Release files / attackmate_api_server-1.1.0.tar.gz
| Download URL | attackmate_api_server-1.1.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
734f7e67b8b72eb5fd114a5cfe04d0edae3f46406c45de2f204b0b251a001650
|
|
BLAKE2b-256 checksum How to use checksums |
1367888b74f576297afbaf8fafc97d3f7605c804f23c7c105c71f9dfb480c547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logRelease files / attackmate_api_server-1.1.0-py3-none-any.whl
| Download URL | attackmate_api_server-1.1.0-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc649e5966905268294187409cb57dc46c275063d44ab98e7302050bee205d46
|
|
BLAKE2b-256 checksum How to use checksums |
a17f5f4e86f355a827754a332327c4e0299aabeb3e8d53c695bc63effab57db1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logSecurity for attackmate-api-server 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for attackmate_api_server-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.