2023-05-25 11:42:19 +01:00
# PrimAITE
2023-06-20 11:19:05 +01:00
2023-07-28 09:41:29 +01:00

2023-07-27 14:57:08 +01:00
2023-07-27 11:40:29 +01:00
The ARCD Primary-level AI Training Environment (**PrimAITE**) provides an effective simulation capability for the purposes of training and evaluating AI in a cyber-defensive role. It incorporates the functionality required of a primary-level ARCD environment, which includes:
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- The ability to model a relevant platform / system context;
2023-07-27 08:59:24 +01:00
2023-07-31 09:16:24 +01:00
- The ability to model key characteristics of a platform / system by representing connections, IP addresses, ports, traffic loading, operating systems and services;
2023-07-27 08:59:24 +01:00
- Operates at machine-speed to enable fast training cycles.
2023-07-27 11:40:29 +01:00
PrimAITE presents the following features:
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- Highly configurable (via YAML files) to provide the means to model a variety of platform / system laydowns and adversarial attack scenarios;
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- A Reinforcement Learning (RL) reward function based on (a) the ability to counter the specific modelled adversarial cyber-attack, and (b) the ability to ensure success;
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- Provision of logging to support AI evaluation and metrics gathering;
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- Uses the concept of Information Exchange Requirements (IERs) to model background pattern of life and adversarial behaviour;
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- An Access Control List (ACL) function, mimicking the behaviour of a network firewall, is applied across the model, following standard ACL rule format (e.g. DENY/ALLOW, source IP address, destination IP address, protocol and port);
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- Application of IERs to the platform / system laydown adheres to the ACL ruleset;
2023-07-27 08:59:24 +01:00
2023-07-31 09:17:48 +01:00
- Presents an OpenAI gym or RLLib interface to the environment, allowing integration with any compliant defensive agents;
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- Full capture of discrete logs relating to agent training (full system state, agent actions taken, instantaneous and average reward for every step of every episode);
2023-07-27 08:59:24 +01:00
2023-07-27 11:40:29 +01:00
- NetworkX provides laydown visualisation capability.
2023-07-27 08:59:24 +01:00
2023-06-20 11:19:05 +01:00
## Getting Started with PrimAITE
2023-07-26 21:49:36 +01:00
### 💫 Install & Run
**PrimAITE** is designed to be OS-agnostic, and thus should work on most variations/distros of Linux, Windows, and MacOS.
2023-07-27 11:40:29 +01:00
Currently, the PrimAITE wheel can only be installed from GitHub. This may change in the future with release to PyPi.
2023-07-26 19:49:24 +01:00
2023-07-26 21:49:36 +01:00
#### Windows (PowerShell)
2023-06-20 11:19:05 +01:00
2023-07-26 21:49:36 +01:00
**Prerequisites:**
* Manual install of Python >= 3.8 < 3.11
2023-06-20 11:19:05 +01:00
2023-07-26 21:49:36 +01:00
**Install:**
``` powershell
mkdir ~\primaite
cd ~\primaite
python3 -m venv .venv
attrib +h .venv /s /d # Hides the .venv directory
.\.venv\Scripts\activate
pip install https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/releases/download/v2.0.0/primaite-2.0.0-py3-none-any.whl
primaite setup
```
2023-07-26 22:10:59 +01:00
**Run:**
``` bash
primaite session
```
2023-07-26 21:49:36 +01:00
#### Unix
**Prerequisites:**
* Manual install of Python >= 3.8 < 3.11
``` bash
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10
sudo apt-get install python3-pip
sudo apt-get install python3-venv
```
**Install:**
``` bash
mkdir ~/primaite
cd ~/primaite
python3 -m venv .venv
source .venv/bin/activate
pip install https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/releases/download/v2.0.0/primaite-2.0.0-py3-none-any.whl
primaite setup
```
2023-06-20 11:19:05 +01:00
2023-07-26 22:10:59 +01:00
**Run:**
``` bash
primaite session
```
2023-06-20 11:19:05 +01:00
2023-07-26 21:49:36 +01:00
### Developer Install from Source
To make your own changes to PrimAITE, perform the install from source (developer install)
#### 1. Clone the PrimAITE repository
``` unix
git clone git@github .com:Autonomous-Resilient-Cyber-Defence/PrimAITE.git
```
#### 2. CD into the repo directory
``` unix
cd PrimAITE
```
#### 3. Create a new python virtual environment (venv)
2023-06-20 11:19:05 +01:00
```unix
2023-07-26 19:49:24 +01:00
python3 -m venv venv
2023-06-20 11:19:05 +01:00
```
2023-07-26 21:49:36 +01:00
#### 4. Activate the venv
2023-06-20 11:19:05 +01:00
##### Unix
```bash
2023-07-26 19:49:24 +01:00
source venv/bin/activate
2023-06-20 11:19:05 +01:00
```
2023-07-26 19:49:24 +01:00
##### Windows (Powershell)
2023-06-20 11:19:05 +01:00
```powershell
2023-07-26 19:49:24 +01:00
.\venv\Scripts\activate
2023-06-20 11:19:05 +01:00
```
2023-07-26 21:49:36 +01:00
#### 5. Install `primaite` with the dev extra into the venv along with all of it's dependencies
2023-06-20 11:19:05 +01:00
```bash
2023-07-26 19:49:24 +01:00
python3 -m pip install -e .[dev]
2023-06-20 11:19:05 +01:00
```
2023-07-26 21:49:36 +01:00
#### 6. Perform the PrimAITE setup:
2023-06-20 11:19:05 +01:00
```bash
2023-07-26 19:49:24 +01:00
primaite setup
2023-06-20 11:22:29 +01:00
```
2023-06-20 11:19:05 +01:00
2023-07-26 21:49:36 +01:00
## 📚 Building documentation
2023-06-20 11:19:05 +01:00
The PrimAITE documentation can be built with the following commands:
##### Unix
```bash
cd docs
make html
```
2023-07-26 19:49:24 +01:00
##### Windows (Powershell)
2023-06-20 11:19:05 +01:00
```powershell
cd docs
.\make.bat html
```