A Meta Attack Language (MAL) Simulator Prototype
Description
This code was used to produce results for the papers
- Cyber threat response using reinforcement learning in graph-based attack simulations
- Learning automated defense strategies using graph-based cyber attack simulations
Installation
pip install -i https://test.pypi.org/simple/ attack-simulator
If you want to run it from the repo then continue with the instructions below.
Packaging and dependency managament.
This Python project uses poetry for packaging and dependency managament.
It also uses maturin to build the rust version of the simulator backend.
Prerequisites
Make sure you have Python (incuding pip) installed and run the following commands to get your environment set up.
$ pip install poetry
$ poetry install
The first command installs poetry itself, while the second one creates a virtual environment with all dependencies and development tools installed.
To build and install the rust package into the current venv, run
maturin develop
Running the code
run_demo.py contains a full example, showing how defender and attacker agents are set up with the simulator. It then runs a number of episodes.
Interface
The unwrapped Gymnasium environments DefenderEnv and AttackerEnv will provide sates on the following form, using a spaces.Dict
| Tables | spaces Class |
Shape | Type |
|---|---|---|---|
observation |
Box(-1, 1) | (n_objects_in_instance,) | np.int8 |
asset_id |
Box(0, n_assets_in_instance) | (n_objects_in_instance,) | np.int64 |
asset |
Box(0, n_object_types_in_domain) | (n_objects_in_instance,) | np.int64 |
step_name |
Box(0, n_step_names_in_domain) | (n_objects_in_instance,) | np.int64 |
edges |
Box(0, n_objects_in_instance) | (2, n_edges) | np.int64 |
action_mask |
Tuple((Box(0, 1, shape=(n_actions,), dtype=np.int8,) Box(0, 1, shape=(n_objects,), dtype=np.int8,))) | (n_action, n_objects) | (np.int8, np.int8) |
The wrapper wrappers.GraphWrapper will give the output as a spaces.Graph. The action mask is moved to the info dictionary.
| Tables | spaces Class |
Shape | Type |
|---|---|---|---|
nodes |
Box(0, MAXINT) | (n_objects_in_instance, 4) | np.int64 |
edges |
Box(0, n_objects_in_instance) | (2, n_edges) | np.int64 |
Files
cyber-attack-simulator-master.zip
Files
(5.7 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:8137d04584c302f96b273fd6ba8b80de
|
5.7 MB | Preview Download |
Additional details
Identifiers
Related works
- Is previous version of
- Software: 10.71775/kth.hp777-8rw38 (DOI)
- Is referenced by
- Publication: 10.1109/NOMS54207.2022.9789835 (DOI)
- Publication: 10.14722/wosoc.2023.23006 (DOI)