Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AIDojoCoordinator/worlds/NSEGameCoordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ async def reset(self)->bool:
args = parser.parse_args()
print(args)
# Set the logging
log_filename = Path("NSG_coordinator.log")
log_filename = Path("logs/NSG_coordinator.log")
if not log_filename.parent.exists():
os.makedirs(log_filename.parent)

Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ WORKDIR ${DESTINATION_DIR}

# Install any necessary Python dependencies
# If a requirements.txt file is in the repository
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
RUN if [ -f pyproject.toml ]; then pip install . ; fi

# change the server ip to 0.0.0.0
RUN sed -i 's/"host": "127.0.0.1"/"host": "0.0.0.0"/' coordinator.conf
# Expose the port the coordinator will run on
EXPOSE 9000

# Run the Python script when the container launches
CMD ["python3", "coordinator.py"]
CMD ["python3", "-m", "AIDojoCoordinator.worlds.NSEGameCoordinator", "--task_config=netsecenv_conf.yaml", "--game_port=9000", "--game_host=0.0.0.0"]

46 changes: 35 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,52 @@ The main part of he NetSecGame is the Game coordinator. It creates the enivronem

## Installation and Dependencies
To run this code you need an environment and access to cyst code. However, the venv needs to be created for your own user

- If you don't have your environment

### Installing in Pyton virtual environment
1. Create the [virual envtironment](https://docs.python.org/3/library/venv.html):
```bash
python -m venv ai-dojo-venv-<yourusername>
```

- The environment can be activated with

2. Activate the venv:
```bash
source ai-dojo-venv<yourusername>/bin/activate
```

- Install using pip by running following in the **root** directory

3. Install with pip:
```bash
pip install -e .
```

- If you use conda use
### Installing with Conda
1. Create conda environment
```bash
conda create --name aidojo python==3.12
```
2. Activate it
```bash
conda activate aidojo
```
3. Install the package
```bash
pip install -e .
```

### Running in Docker
You can run the coordinator in a Docker container
Build the Contaier (run from the *root* of the project) locally.
```bash
docker build -t aidojo-nsg-coordinator:latest .
```

or pull the image from Dockerhub
```bash
docker pull lukasond/aidojo-coordinator:1.0.2
```

## Running the game:
There are currently two variants of how you can run the game:
- Network Security Game - pure simulation
- CYST-based Environment - simulation + emulation

### Running Network Security Game
1. Prepare the task configuration file (see )
## Components of the NetSecGame Environment
The architecture of the environment can be seen [here](docs/Architecture.md).
The NetSecGame environment has several components in the following files:
Expand Down Expand Up @@ -77,6 +97,7 @@ Predefined scenario configurations:
- `scenario_configuration.py`: The main scenario configuration.
- `three_net_configuration.py`: Configuration for a three-network scenario. Used for evaluation of the model overfitting.
Implements the network game's configuration of hosts, data, services, and connections. It is taken from [CYST](https://pypi.org/project/cyst/).

#### **`utils/`**
Helper modules:
- `utils.py`: General-purpose utilities.
Expand All @@ -87,6 +108,9 @@ Helper modules:
The [scenarios](#definition-of-the-network-topology) define the **topology** of a network (number of hosts, connections, networks, services, data, users, firewall rules, etc.) while the [task-configuration](#task-configuration) is to be used for definition of the exact task for the agent in one of the scenarios (with fix topology).
- Agents compatible with the NetSecGame are located in a separate repository [NetSecGameAgents](https://github.com/stratosphereips/NetSecGameAgents/tree/main)




### Assumptions of the NetSecGame
1. NetSecGame works with the closed-world assumption. Only the defined entities exist in the simulation.
2. If the attacker does a successful action in the same step that the defender successfully detects the action, the priority goes to the defender. The reward is a penalty, and the game ends.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies = [
"kaleido==0.2.1",
"MarkupSafe==3.0.2",
"matplotlib==3.9.1",
"netaddr==1.3.0",
"netaddr==0.9.0",
"networkx==3.4.2",
"numpy==1.26.4",
"pandas==2.2.2",
Expand Down