51 Commits

Author SHA1 Message Date
Christopher McCarthy
cfec1fdd7e Merged PR 479: merged 3.1.0 into main for git history alignment
merged 3.1.0 into main for git history alignment

Related work items: #1847, #2502, #2610, #2618, #2628, #2646, #2658, #2659, #2660, #2661, #2682
2024-07-22 13:33:10 +00:00
Chris McCarthy
9dd1d6b742 merged 3.0.0 into 3.1.0 for git history alignment [skip ci] 2024-07-22 13:50:29 +01:00
Defence Science and Technology Laboratory UK
3f7d6c6ba6 Automated benchmark output commit for version 3.1.0 [skip ci] 2024-07-20 18:36:58 +00:00
Chris McCarthy
fba85cebfd retrospectively benchmarked 3.1.0 using the new benchmark process 2024-07-20 17:15:53 +01:00
Marek Wolan
e915d5e090 Updated VERSION 2024-06-25 10:44:15 +00:00
Marek Wolan
9b195ea0f4 Merged PR 431: #2682 Backport changes to core PrimAITE
Related work items: #2682
2024-06-25 10:32:10 +00:00
Marek Wolan
a861ccb1ee Fix typo in log message 2024-06-25 10:31:28 +00:00
Marek Wolan
28dabad66b #2682 Backport changes to core PrimAITE 2024-06-25 11:04:52 +01:00
Marek Wolan
4a81dc3b2c Merged PR 424: fix infini-ARP bug when pinging broadcast/network address
Related work items: #2661
2024-06-19 11:09:52 +00:00
Chris McCarthy
636ec0cdd4 #26661 - Added tests for testing arp doesn't work but also doesn't crash the network if attempting to resolve a broadcast or network address 2024-06-19 11:31:13 +01:00
Marek Wolan
7375bb383a #2661 Improve style on ARP check code to be more concise 2024-06-18 10:09:06 +01:00
Marek Wolan
c90c059411 fix infini-ARP bug when pinging broadcast/network address 2024-06-14 14:48:28 +00:00
Charlie Crane
923d2629ca Merged PR 418: Update Pre-Commit to check for valid copyright
## Summary
Updates Pre-commit with the a check to ensure valid copyright headers

## Test process
*How have you tested this (if applicable)?*

## Checklist
- [X] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2646
2024-06-13 18:54:48 +00:00
Czar Echavez
4ac352bf3b Merged PR 419: integrate NIC traffic into observation space
## Summary
- Integrates the NIC traffic into the observation space
- Added `monitored_traffic` property into agent config which specifies which traffic is going to be included in observation

## Test process
https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/419?_a=files&path=/tests/integration_tests/game_layer/observations/test_nic_observations.py

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2658
2024-06-13 17:53:43 +00:00
Czar Echavez
101fa3ebdb #2658: change key of observation to match what is in CAOS document 2024-06-13 16:29:02 +01:00
Marek Wolan
823e7d81a6 Merged PR 385: #2502 add more info about config placeholders
## Summary
Add to the config placeholder notebook. Now we also explain how to vary the simulation between episodes.

## Test process
precommit pass. notebook runs.

## Checklist
- [ ] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2502 add more info about config placeholders

Related work items: #2502
2024-06-13 15:19:31 +00:00
Czar Echavez
65d9cfa7dc #2658: I cast uncast on NIC space 2024-06-13 15:11:34 +01:00
Charlie Crane
d095138ef7 Merged PR 413: One line change to try and resolve build docs pipeline failure
## Summary
The build-docs pipeline has been failing to run. This PR corrects it.

## Test process
Link to successfully running:
https://dev.azure.com/ma-dev-uk/PrimAITE/_build/results?buildId=4849&view=results

Previous failures can be seen in the pipeline history.

## Checklist
- [ ] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

One line change to try and resolve build docs pipeline failure

Related work items: #2659
2024-06-13 13:11:03 +00:00
Charlie Crane
3c8e1d1035 #2646 - Amending a merge conflict resolution in preparation for review 2024-06-13 13:25:29 +01:00
Marek Wolan
d22117a614 Merge remote-tracking branch 'origin/dev' into bugfix/fix_pipeline_bug 2024-06-13 12:53:33 +01:00
Marek Wolan
0bd52b1c15 Merge remote-tracking branch 'origin/dev' into feature/2502-placeholders-docs 2024-06-13 12:52:59 +01:00
Marek Wolan
fad8d936e6 Merge remote-tracking branch 'origin/dev' into feature/2646_Update-pre-commit-to-check-for-valid-copyright 2024-06-13 12:52:09 +01:00
Czar Echavez
1798674d39 #2658: fix space 2024-06-13 12:37:20 +01:00
Charlie Crane
6762fd805e #2646 - Adding back the dns client/server python that was deleted 2024-06-13 12:13:16 +01:00
Czar Echavez
539577ddc3 #2658: added monitored traffic into config + default obs space 2024-06-13 11:48:13 +01:00
Marek Wolan
ae2bbd3e00 Merged PR 416: Fix database client uninstall failing due to persistent connection
## Summary
Change the way db client uninstall happens.

Now if a client_connection disconnect fails, we just drop it anyway, not sure if this causes other issues so pls review this diligently, especially @<Charlie Crane> . in case there's a potential issue with not fully dropping connections.

## Test process
pytest is running very nicely

## Checklist
- [x] PR is linked to a **work item**
- [x] **acceptance criteria** of linked ticket are met
- [x] performed **self-review** of the code
- [x] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [x] ran **pre-commit** checks for code style
- [x] attended to any **TO-DOs** left in the code

Fix database client uninstall failing due to persistent connection
2024-06-13 10:23:24 +00:00
Marek Wolan
c070bcc253 Fix database client uninstall failing due to persistent connection 2024-06-13 10:33:59 +01:00
Charlie Crane
0dce49484d Pip install command doesn't work.Trying a different fix 2024-06-12 08:36:42 +01:00
Charlie Crane
eeca9e4555 One line change to try and resolve build docs pipeline failure 2024-06-12 08:20:12 +01:00
Czar Echavez
969daeb490 Merged PR 412: NMAP application
## Summary
NMAP application added which will be utilised by red agents

## Test process
*How have you tested this (if applicable)?*

## Checklist
- [ ] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #1847, #2618, #2628
2024-06-11 16:19:44 +00:00
Czar Echavez
bbcde47fa5 #1847: fix test 2024-06-11 16:43:38 +01:00
Czar Echavez
76e954d1a1 Merge remote-tracking branch 'origin/dev' into feature/1847-more-red-agents 2024-06-11 14:26:11 +01:00
Marek Wolan
da7d93a892 Merged PR 411: merge 3.0.0 into dev :) 2024-06-11 13:22:27 +00:00
Marek Wolan
935b6bd343 Merge remote-tracking branch 'origin/release/3.0.0' into merge-3.0.0-to-dev 2024-06-11 11:55:01 +01:00
Czar Echavez
578d790c87 Merged PR 401: 2628 update benchmark script
## Summary
Updated the benchmark script so that it's compatible with PrimAITE v3.0.0

Chris also ran the benchmark and included the results

the script should also now work via cli (`python ./benchmark/primaite_benchmark.py`)

## Test process
n/a

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2628
2024-06-06 18:46:50 +00:00
Christopher McCarthy
477d7fe58e Merged PR 388: #2618 - NMAP
## Summary
Added NMAP application, documentation, and tests.

## Test process
*Multiple tests for ping and port scan. Predefined expected results against actual results.

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [X] updated the **documentation** if this PR changes or adds functionality
- [X] written/updated **design docs** if this PR implements new functionality
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2618 - Added NMAP application, documentation, and tests.

Related work items: #2618
2024-06-06 13:44:59 +00:00
Chris McCarthy
85325361b3 #2618 - Fixed the error that had NIC traffic describe state with enums as keys in the dict 2024-06-06 14:13:26 +01:00
Czar Echavez
6f655631e3 Merged PR 404: #2610: removed tap logic from ransomware script
## Summary
Removed irrelevant stages from the ransomware script application

## Test process
no big changes, so existing tests were used. only a minor change in test, which no longer applies

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2610: removed tap logic from ransomware script

Related work items: #2610
2024-06-06 11:32:18 +00:00
Czar Echavez
3d63c30b75 #2610: remove irrelevant params in doc 2024-06-06 11:45:17 +01:00
Czar Echavez
e1ba0ff125 #2610: apply suggestions from PR 2024-06-06 01:46:42 +01:00
Chris McCarthy
86092604e2 #2628 - ran the primaite v3 benchmarking script 2024-06-05 19:39:39 +01:00
Christopher McCarthy
e55f52742d Apply suggestions from code review 2024-06-05 15:25:24 +00:00
Christopher McCarthy
ace67894b2 Apply suggestions from code review 2024-06-05 14:57:00 +00:00
Czar Echavez
dbc30fc296 #2628: commit 2024-06-05 11:03:39 +01:00
Chris McCarthy
81bcf99855 #2646 - Added a custom pre-commit hook that ensure the copyright clause is added to .py and .rst files. 2024-06-05 09:11:37 +01:00
Chris McCarthy
3c17ef0a69 #2628 - added _can_perform_network_action to nmap.py. made some changes following PR suggestions. 2024-06-04 22:29:00 +01:00
Czar Echavez
5c23276be5 #2610: removed tap logic from ransomware script 2024-06-04 13:17:26 +01:00
Chris McCarthy
5eea5bf4f9 #2618 - Integrated the NMAP into the action and requests functionality to enable agent usage. added NMAP agents tests. 2024-05-31 13:53:18 +01:00
Chris McCarthy
9c4d47b0b9 #2618 - Fixed up some formatting in the nmap.rst documentation 2024-05-29 13:29:08 +01:00
Chris McCarthy
716f3ece1e #2618 - Added NMAP application, documentation, and tests. 2024-05-29 13:13:42 +01:00
Marek Wolan
4d1f84dc27 #2502 add more info about config placeholders 2024-05-28 15:45:26 +01:00
377 changed files with 15703 additions and 608 deletions

View File

@@ -30,7 +30,7 @@ jobs:
displayName: 'Install PrimAITE for docs autosummary' displayName: 'Install PrimAITE for docs autosummary'
- script: | - script: |
apt-get install pandoc sudo apt-get install pandoc
displayName: 'Install Pandoc' displayName: 'Install Pandoc'
- script: | - script: |

View File

@@ -1,8 +1,8 @@
name: build-sphinx-to-github-pages name: build-sphinx-to-github-pages
env: env:
GITHUB_ACTOR: Autonomous-Resilient-Cyber-Defence GITHUB_ACTOR: {todo:fill in URL}
GITHUB_REPOSITORY: Autonomous-Resilient-Cyber-Defence/PrimAITE GITHUB_REPOSITORY: {todo:fill in URL}/PrimAITE
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
on: on:

View File

@@ -5,13 +5,11 @@ on:
branches: branches:
- main - main
- dev - dev
- dev-gui
- 'release/**' - 'release/**'
pull_request: pull_request:
branches: branches:
- main - main
- dev - dev
- dev-gui
- 'release/**' - 'release/**'
jobs: jobs:
build: build:
@@ -19,7 +17,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.8", "3.9", "3.10"] python-version: ["3.9", "3.10", "3.11"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -54,13 +52,6 @@ jobs:
run: | run: |
primaite setup primaite setup
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Run tests - name: Run tests
run: | run: |
pytest tests/ pytest tests/

2
.gitignore vendored
View File

@@ -148,7 +148,7 @@ cython_debug/
# IDE # IDE
.idea/ .idea/
docs/source/primaite-dependencies.rst
.vscode/ .vscode/
# outputs # outputs

View File

@@ -1,9 +1,17 @@
repos: repos:
- repo: local
hooks:
- id: ensure-copyright-clause
name: ensure copyright clause
entry: python copyright_clause_pre_commit_hook.py
language: python
- repo: http://github.com/pre-commit/pre-commit-hooks - repo: http://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 rev: v4.4.0
hooks: hooks:
- id: check-yaml - id: check-yaml
exclude: scenario_with_placeholders/ exclude: |
| scenario_with_placeholders/
| mini_scenario_with_simulation_variation/
- id: end-of-file-fixer - id: end-of-file-fixer
- id: trailing-whitespace - id: trailing-whitespace
- id: check-added-large-files - id: check-added-large-files

View File

@@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added support for SQL INSERT command. - Added support for SQL INSERT command.
- Added ability to log each agent's action choices in each step to a JSON file. - Added ability to log each agent's action choices in each step to a JSON file.
- Removal of Link bandwidth hardcoding. This can now be configured via the network configuraiton yaml. Will default to 100 if not present. - Removal of Link bandwidth hardcoding. This can now be configured via the network configuraiton yaml. Will default to 100 if not present.
- Added NMAP application to all host and layer-3 network nodes.
### Bug Fixes ### Bug Fixes

View File

@@ -4,20 +4,20 @@
### **Did you find a bug?** ### **Did you find a bug?**
* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/issues). * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/{todo:fill in URL}/PrimAITE/issues).
* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=%5BBUG%5D+-+%3Cbug+title+goes+here%3E). Be sure to follow our bug report template with the headers **Describe the bug**, **To Reproduce**, **Expected behaviour**, **Screenshots/Outputs**, **Environment**, and **Additional context** * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/{todo:fill in URL}/PrimAITE/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=%5BBUG%5D+-+%3Cbug+title+goes+here%3E). Be sure to follow our bug report template with the headers **Describe the bug**, **To Reproduce**, **Expected behaviour**, **Screenshots/Outputs**, **Environment**, and **Additional context**
### **Do you have a solution to fix the bug?** ### **Do you have a solution to fix the bug?**
* [Fork the repository](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/fork). * [Fork the repository](https://github.com/{todo:fill in URL}/PrimAITE/fork).
* Install the pre-commit hook with `pre-commit install`. * Install the pre-commit hook with `pre-commit install`.
* Implement the bug fix. * Implement the bug fix.
* Update documentation where applicable. * Update documentation where applicable.
* Update the **UNRELEASED** section of the [CHANGELOG.md](CHANGELOG.md) file * Update the **UNRELEASED** section of the [CHANGELOG.md](CHANGELOG.md) file
* Write a suitable test/tests. * Write a suitable test/tests.
* Commit the bug fix to the dev branch on your fork. If the bug has an open issue under [Issues](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/issues), reference the issue in the commit message (e.g. #1 references issue 1). * Commit the bug fix to the dev branch on your fork. If the bug has an open issue under [Issues](https://github.com/{todo:fill in URL}/PrimAITE/issues), reference the issue in the commit message (e.g. #1 references issue 1).
* Submit a pull request from your dev branch to the Autonomous-Resilient-Cyber-Defence/PrimAITE dev branch. Again, if the bug has an open issue under [Issues](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/issues), reference the issue in the pull request description. * Submit a pull request from your dev branch to the {todo:fill in URL}/PrimAITE dev branch. Again, if the bug has an open issue under [Issues](https://github.com/{todo:fill in URL}/PrimAITE/issues), reference the issue in the pull request description.
### **Did you fix whitespace, format code, or make a purely cosmetic patch?** ### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
@@ -25,7 +25,7 @@ Changes that are cosmetic in nature and do not add anything substantial to the s
### **Do you intend to add a new feature or change an existing one?** ### **Do you intend to add a new feature or change an existing one?**
* Submit a [feature request issue](https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/issues/new?assignees=&labels=feature_request&projects=&template=feature_request.md&title=%5BREQUEST%5D+-+%3Crequest+title+goes+here%3E). * Submit a [feature request issue](https://github.com/{todo:fill in URL}/PrimAITE/issues/new?assignees=&labels=feature_request&projects=&template=feature_request.md&title=%5BREQUEST%5D+-+%3Crequest+title+goes+here%3E).
* Know how to implement the new feature or change? Follow the same steps in the bug fix section above to fork, build, document, test, commit, and submit a pull request. * Know how to implement the new feature or change? Follow the same steps in the bug fix section above to fork, build, document, test, commit, and submit a pull request.
### **Do you have questions about the source code?** ### **Do you have questions about the source code?**

22
LICENSE
View File

@@ -1,21 +1,27 @@
MIT License MIT License License
Copyright (c) 2023 - 2025 Defence Science and Technology Laboratory UK (https://dstl.gov.uk) MIT License Conditions
Permission is hereby granted, free of charge, to any person obtaining a copy These MIT License conditions confirm the provision of the following artefacts as MIT License by Defence Science and Technology
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights request to the QQ or FNC mailbox):
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
- Use Case Release Packs
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all Suppliers are required to read and confirm acceptance of the {todo:fill in URL} Foundry SyOPs (https://github.com/{todo:fill in URL}/foundry-syops) before being admitted access to material hosted on the {todo:fill in URL} Foundry GitHub site.
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
The material is supplied in confidence to QQ / FNC and their subcontractors under SERAPIS, and is issued to inform only those
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
of DSTL. The material must be stored and protected appropriately. All material must be destroyed at the end of the task.

View File

@@ -33,7 +33,7 @@ Currently, the PrimAITE wheel can only be installed from GitHub. This may change
#### Windows (PowerShell) #### Windows (PowerShell)
**Prerequisites:** **Prerequisites:**
* Manual install of Python >= 3.8 < 3.12 * Manual install of Python >= 3.9 < 3.12
**Install:** **Install:**
@@ -43,7 +43,7 @@ cd ~\primaite
python3 -m venv .venv python3 -m venv .venv
attrib +h .venv /s /d # Hides the .venv directory attrib +h .venv /s /d # Hides the .venv directory
.\.venv\Scripts\activate .\.venv\Scripts\activate
pip install primaite-3.0.0-py3-none-any.whl[rl] pip install primaite-{VERSION}-py3-none-any.whl[rl]
primaite setup primaite setup
``` ```
@@ -66,7 +66,7 @@ mkdir ~/primaite
cd ~/primaite cd ~/primaite
python3 -m venv .venv python3 -m venv .venv
source .venv/bin/activate source .venv/bin/activate
pip install primaite-3.0.0-py3-none-any.whl[rl] pip install primaite-{VERSION}-py3-none-any.whl[rl]
primaite setup primaite setup
``` ```
@@ -77,7 +77,7 @@ To make your own changes to PrimAITE, perform the install from source (developer
#### 1. Clone the PrimAITE repository #### 1. Clone the PrimAITE repository
``` unix ``` unix
git clone git@github.com:Autonomous-Resilient-Cyber-Defence/PrimAITE.git git clone git@github.com:{todo:fill in URL}/PrimAITE.git
``` ```
#### 2. CD into the repo directory #### 2. CD into the repo directory

View File

@@ -1006,4 +1006,4 @@
"999": 112.49999999999994, "999": 112.49999999999994,
"1000": 115.2500000000002 "1000": 115.2500000000002
} }
} }

View File

@@ -1006,4 +1006,4 @@
"999": 103.49999999999994, "999": 103.49999999999994,
"1000": 117.9500000000001 "1000": 117.9500000000001
} }
} }

View File

@@ -1006,4 +1006,4 @@
"999": 112.00000000000017, "999": 112.00000000000017,
"1000": 106.10000000000002 "1000": 106.10000000000002
} }
} }

View File

@@ -1006,4 +1006,4 @@
"999": 100.75000000000009, "999": 100.75000000000009,
"1000": 110.70000000000007 "1000": 110.70000000000007
} }
} }

View File

@@ -1006,4 +1006,4 @@
"999": 110.6500000000001, "999": 110.6500000000001,
"1000": 113.10000000000015 "1000": 113.10000000000015
} }
} }

View File

@@ -7433,4 +7433,4 @@
} }
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -0,0 +1,38 @@
# PrimAITE v3.1.0 Learning Benchmark
## PrimAITE Dev Team
### 2024-07-20
---
## 1 Introduction
PrimAITE v3.1.0 was benchmarked automatically upon release. Learning rate metrics were captured to be referenced during system-level testing and user acceptance testing (UAT).
The benchmarking process consists of running 5 training session using the same config file. Each session trains an agent for 1000 episodes, with each episode consisting of 128 steps.
The total reward per episode from each session is captured. This is then used to calculate an caverage total reward per episode from the 5 individual sessions for smoothing. Finally, a 25-widow rolling average of the average total reward per session is calculated for further smoothing.
## 2 System Information
### 2.1 Python
**Version:** 3.10.14 (main, Apr 6 2024, 18:45:05) [GCC 9.4.0]
### 2.2 System
- **OS:** Linux
- **OS Version:** #76~20.04.1-Ubuntu SMP Thu Jun 13 18:00:23 UTC 2024
- **Machine:** x86_64
- **Processor:** x86_64
### 2.3 CPU
- **Physical Cores:** 2
- **Total Cores:** 4
- **Max Frequency:** 0.00Mhz
### 2.4 Memory
- **Total:** 15.62GB
- **Swap Total:** 0.00B
## 3 Stats
- **Total Sessions:** 5
- **Total Episodes:** 5005
- **Total Steps:** 640000
- **Av Session Duration (s):** 1632.8888
- **Av Step Duration (s):** 0.0510
- **Av Duration per 100 Steps per 10 Nodes (s):** 5.1028
## 4 Graphs
### 4.1 v3.1.0 Learning Benchmark Plot
![PrimAITE 3.1.0 Learning Benchmark Plot](PrimAITE v3.1.0 Learning Benchmark.png)
### 4.2 Learning Benchmark of Minor and Bugfix Releases for Major Version 3
![Learning Benchmark of Minor and Bugfix Releases for Major Version 3](PrimAITE Learning Benchmark of Minor and Bugfix Releases for Major Version 3.png)
### 4.3 Performance of Minor and Bugfix Releases for Major Version 3
![Performance of Minor and Bugfix Releases for Major Version 3](PrimAITE Performance of Minor and Bugfix Releases for Major Version 3.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,154 @@
# -*- coding: utf-8 -*-
import datetime
import sys
from pathlib import Path
# Constants
CURRENT_YEAR = datetime.date.today().year
COPYRIGHT_PY_STR = f"# © Crown-owned copyright {CURRENT_YEAR}, Defence Science and Technology Laboratory UK"
COPYRIGHT_RST_LINES = [
".. only:: comment",
"",
f" © Crown-owned copyright {CURRENT_YEAR}, Defence Science and Technology Laboratory UK",
]
PATHS = {Path("./src"), Path("./tests"), Path("./docs"), Path("./benchmark")}
EXTENSIONS = {".py", ".rst"}
def _is_copyright_line(line: str) -> bool:
"""
Check if a line is a copyright line.
:param line: The line to check.
:return: True if the line is a copyright line, False otherwise.
"""
return line.startswith("#") and "copyright" in line.lower()
def _is_rst_copyright_lines(lines: list) -> bool:
"""
Check if the lines match the RST copyright format.
:param lines: The lines to check.
:return: True if the lines match the RST copyright format, False otherwise.
"""
return len(lines) >= 3 and lines[0] == ".. only:: comment" and "copyright" in lines[2].lower()
def process_py_file(file_path: Path) -> bool:
"""
Process a Python file to check and add/update the copyright clause.
:param file_path: The path to the file to check and update.
:return: True if the file was modified, False otherwise.
"""
modified = False
try:
content = file_path.read_text(encoding="utf-8")
lines = content.splitlines(keepends=True) # Keep line endings
if lines and _is_copyright_line(lines[0]):
if lines[0].strip() != COPYRIGHT_PY_STR:
lines[0] = COPYRIGHT_PY_STR + "\n"
modified = True
print(f"Updated copyright clause in {file_path}")
else:
lines.insert(0, COPYRIGHT_PY_STR + "\n")
modified = True
print(f"Added copyright clause to {file_path}")
if modified:
file_path.write_text("".join(lines), encoding="utf-8")
except Exception as e:
print(f"Failed to process {file_path}: {e}")
return False
return modified
def process_rst_file(file_path: Path) -> bool:
"""
Process an RST file to check and add/update the copyright clause.
:param file_path: The path to the file to check and update.
:return: True if the file was modified, False otherwise.
"""
modified = False
try:
content = file_path.read_text(encoding="utf-8")
lines = content.splitlines(keepends=True) # Keep line endings
existing_block = any(".. only:: comment" in line for line in lines)
if existing_block:
# Check if the block is correct
for i, line in enumerate(lines):
if line.strip() == ".. only:: comment":
if lines[i : i + 3] != [
COPYRIGHT_RST_LINES[0] + "\n",
COPYRIGHT_RST_LINES[1] + "\n",
COPYRIGHT_RST_LINES[2] + "\n",
]:
# Update the incorrect block
lines[i : i + 3] = [
COPYRIGHT_RST_LINES[0] + "\n",
COPYRIGHT_RST_LINES[1] + "\n",
COPYRIGHT_RST_LINES[2] + "\n",
]
modified = True
print(f"Updated copyright clause in {file_path}")
break
else:
# Insert new copyright block
lines = [line + "\n" for line in COPYRIGHT_RST_LINES] + ["\n"] + lines
modified = True
print(f"Added copyright clause to {file_path}")
if modified:
file_path.write_text("".join(lines), encoding="utf-8")
except Exception as e:
print(f"Failed to process {file_path}: {e}")
return False
return modified
def process_file(file_path: Path) -> bool:
"""
Check if a file has the correct copyright clause and add or update it if necessary.
:param file_path: The path to the file to check and update.
:return: True if the file was modified, False otherwise.
"""
if file_path.suffix == ".py":
return process_py_file(file_path)
elif file_path.suffix == ".rst":
return process_rst_file(file_path)
return False
def main() -> int:
"""
Main function to walk through the root directories, check files, and update the copyright clause.
:return: 1 if any file was modified, 0 otherwise.
"""
files_checked = 0
files_modified = 0
any_file_modified = False
for path in PATHS:
for file_path in path.rglob("*"):
if file_path.suffix in EXTENSIONS:
files_checked += 1
if process_file(file_path):
files_modified += 1
any_file_modified = True
if any_file_modified:
print(f"Files Checked: {files_checked}. Files Modified: {files_modified}")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())

View File

@@ -1,3 +1,4 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
# Minimal makefile for Sphinx documentation # Minimal makefile for Sphinx documentation
# You can set these variables from the command line, and also # You can set these variables from the command line, and also
# from the environment for the first two. # from the environment for the first two.

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. ..
Credit to https://github.com/JamesALeedham/Sphinx-Autosummary-Recursion for the custom templates. Credit to https://github.com/JamesALeedham/Sphinx-Autosummary-Recursion for the custom templates.

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. ..
Credit to https://github.com/JamesALeedham/Sphinx-Autosummary-Recursion for the custom templates. Credit to https://github.com/JamesALeedham/Sphinx-Autosummary-Recursion for the custom templates.

View File

@@ -2,7 +2,7 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. ..
DO NOT DELETE THIS FILE! It contains the all-important `.. autosummary::` directive with `:recursive:` option, without DO NOT DELETE THIS FILE! It contains the all-important `.. autosummary::` directive with `:recursive:` option, without

View File

@@ -1,3 +1,4 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
#!/bin/bash #!/bin/bash
set -x set -x
@@ -42,7 +43,7 @@ touch .nojekyll
# Add README # Add README
cat > README.md <<EOF cat > README.md <<EOF
# README for the Sphinx Docs GitHub Pages Branch # README for the Sphinx Docs GitHub Pages Branch
This branch is simply a cache for the website served from https://Autonomous-Resilient-Cyber-Defence.github.io/PrimAITE/, This branch is simply a cache for the website served from https://{todo:fill in URL}.github.io/PrimAITE/,
and is not intended to be viewed on github.com. and is not intended to be viewed on github.com.
For more information on how this site is built using Sphinx, Read the Docs, GitHub Actions/Pages, and demo For more information on how this site is built using Sphinx, Read the Docs, GitHub Actions/Pages, and demo
implementation from https://github.com/annegentle, see: implementation from https://github.com/annegentle, see:

View File

@@ -1,4 +1,4 @@
# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK # © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
# Configuration file for the Sphinx documentation builder. # Configuration file for the Sphinx documentation builder.
# #
# For the full list of built-in configuration values, see the documentation: # For the full list of built-in configuration values, see the documentation:
@@ -147,7 +147,7 @@ def copy_notebooks_to_docs() -> Any:
This allows developers to create new notebooks without having to worry about updating documentation when This allows developers to create new notebooks without having to worry about updating documentation when
a new notebook is included within PrimAITE. a new notebook is included within PrimAITE.
""" """
notebook_asset_types = [".ipynb", ".png"] notebook_asset_types = [".ipynb", ".png", ".svg"]
notebook_directories = [] notebook_directories = []
# find paths where notebooks are contained # find paths where notebooks are contained

View File

@@ -1,4 +1,5 @@
@ECHO OFF @ECHO OFF
REM © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``agents`` ``agents``

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``game`` ``game``

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``io_settings`` ``io_settings``

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``simulation`` ``simulation``

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _Node Attributes: .. _Node Attributes:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _common_host_node_attributes: .. _common_host_node_attributes:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _common_network_node_attributes: .. _common_network_node_attributes:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _common_node_attributes: .. _common_node_attributes:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``type`` ``type``
-------- --------

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _computer_configuration: .. _computer_configuration:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _firewall_configuration: .. _firewall_configuration:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _network_examples: .. _network_examples:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _router_configuration: .. _router_configuration:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _server_configuration: .. _server_configuration:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _switch_configuration: .. _switch_configuration:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``applications`` ``applications``
---------------- ----------------

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``services`` ``services``
------------ ------------

View File

@@ -1,3 +1,7 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
Customising Agents Customising Agents
****************** ******************

View File

@@ -1,3 +1,7 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
RL Environments RL Environments
*************** ***************

View File

@@ -77,6 +77,6 @@ The following extensions should now be installed
:width: 300 :width: 300
:align: center :align: center
VSCode will then ask for a Python environment version to use. PrimAITE is compatible with Python versions 3.8 - 3.11 VSCode will then ask for a Python environment version to use. PrimAITE is compatible with Python versions 3.9 - 3.11
You should now be able to interact with the notebook. You should now be able to interact with the notebook.

View File

@@ -1,3 +1,7 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
PrimAITE Game layer PrimAITE Game layer
******************* *******************
@@ -81,7 +85,6 @@ blue_agent:
weight: 1.0 weight: 1.0
options: options:
agent_name: client_2_green_user agent_name: client_2_green_user
``` ```
When defining agent reward sharing, users must be careful to avoid circular references, as that would lead to an infinite calculation loop. PrimAITE will prevent circular dependencies and provide a helpful error message if they are detected in the yaml. When defining agent reward sharing, users must be careful to avoid circular references, as that would lead to an infinite calculation loop. PrimAITE will prevent circular dependencies and provide a helpful error message if they are detected in the yaml.

View File

@@ -113,7 +113,7 @@ For example:
.. code-block:: bash .. code-block:: bash
git clone https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE git clone https://github.com/{todo:fill in URL}/PrimAITE
cd primaite cd primaite
2. Create and activate your Python virtual environment (venv) 2. Create and activate your Python virtual environment (venv)

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _Executed Notebooks: .. _Executed Notebooks:

View File

@@ -1,3 +1,7 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
+-------------------+---------+------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------------------------------+ +-------------------+---------+------------------------------------+-------------------------------------------------------------------------------------------------------+----------------------------------------------+
| Name | Version | License | Description | URL | | Name | Version | License | Description | URL |
+===================+=========+====================================+=======================================================================================================+==============================================+ +===================+=========+====================================+=======================================================================================================+==============================================+

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
############# #############
Base Hardware Base Hardware

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _network: .. _network:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
################################# #################################
Network Interface Hierarchy Model Network Interface Hierarchy Model

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
######## ########
Firewall Firewall

View File

@@ -1,3 +1,7 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
######### #########
Host Node Host Node

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
############ ############
Network Node Network Node

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
###### ######
Router Router

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
###### ######
Switch Switch

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
###### ######
Router Router

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
Transport Layer to Data Link Layer Transport Layer to Data Link Layer
================================== ==================================

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DataManipulationBot: .. _DataManipulationBot:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DatabaseClient: .. _DatabaseClient:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DoSBot: .. _DoSBot:

View File

@@ -0,0 +1,347 @@
.. only:: comment
© Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _NMAP:
NMAP
====
Overview
--------
The NMAP application is used to simulate network scanning activities. NMAP is a powerful tool that helps in discovering
hosts and services on a network. It provides functionalities such as ping scans to discover active hosts and port scans
to detect open ports on those hosts.
The NMAP application is essential for network administrators and security professionals to map out a network's
structure, identify active devices, and find potential vulnerabilities by discovering open ports and running services.
However, it is also a tool frequently used by attackers during the reconnaissance stage of a cyber attack to gather
information about the target network.
Scan Types
----------
Ping Scan
^^^^^^^^^
A ping scan is used to identify which hosts on a network are active and reachable. This is achieved by sending ICMP
Echo Request packets (ping) to the target IP addresses. If a host responds with an ICMP Echo Reply, it is considered
active. Ping scans are useful for quickly mapping out live hosts in a network.
Port Scan
^^^^^^^^^
A port scan is used to detect open ports on a target host or range of hosts. Open ports can indicate running services
that might be exploitable or require securing. Port scans help in understanding the services available on a network and
identifying potential entry points for attacks. There are three types of port scans based on the scope:
- **Horizontal Port Scan**: This scan targets a specific port across a range of IP addresses. It helps in identifying
which hosts have a particular service running.
- **Vertical Port Scan**: This scan targets multiple ports on a single IP address. It provides detailed information
about the services running on a specific host.
- **Box Scan**: This combines both horizontal and vertical scans, targeting multiple ports across multiple IP addresses.
It gives a comprehensive view of the network's service landscape.
Example Usage
-------------
The network we use for these examples is defined below:
.. code-block:: python
from ipaddress import IPv4Network
from primaite.simulator.network.container import Network
from primaite.simulator.network.hardware.nodes.host.computer import Computer
from primaite.simulator.network.hardware.nodes.network.router import Router
from primaite.simulator.network.hardware.nodes.network.switch import Switch
from primaite.simulator.system.applications.nmap import NMAP
from primaite.simulator.system.services.database.database_service import DatabaseService
# Initialize the network
network = Network()
# Set up the router
router = Router(hostname="router", start_up_duration=0)
router.power_on()
router.configure_port(port=1, ip_address="192.168.1.1", subnet_mask="255.255.255.0")
# Set up PC 1
pc_1 = Computer(
hostname="pc_1",
ip_address="192.168.1.11",
subnet_mask="255.255.255.0",
default_gateway="192.168.1.1",
start_up_duration=0
)
pc_1.power_on()
# Set up PC 2
pc_2 = Computer(
hostname="pc_2",
ip_address="192.168.1.12",
subnet_mask="255.255.255.0",
default_gateway="192.168.1.1",
start_up_duration=0
)
pc_2.power_on()
pc_2.software_manager.install(DatabaseService)
pc_2.software_manager.software["DatabaseService"].start() # start the postgres server
# Set up PC 3
pc_3 = Computer(
hostname="pc_3",
ip_address="192.168.1.13",
subnet_mask="255.255.255.0",
default_gateway="192.168.1.1",
start_up_duration=0
)
# Don't power on PC 3
# Set up the switch
switch = Switch(hostname="switch", start_up_duration=0)
switch.power_on()
# Connect devices
network.connect(router.network_interface[1], switch.network_interface[24])
network.connect(switch.network_interface[1], pc_1.network_interface[1])
network.connect(switch.network_interface[2], pc_2.network_interface[1])
network.connect(switch.network_interface[3], pc_3.network_interface[1])
pc_1_nmap: NMAP = pc_1.software_manager.software["NMAP"]
Ping Scan
^^^^^^^^^
Perform a ping scan to find active hosts in the `192.168.1.0/24` subnet:
.. code-block:: python
:caption: Ping Scan Code
active_hosts = pc_1_nmap.ping_scan(target_ip_address=IPv4Network("192.168.1.0/24"))
.. code-block:: python
:caption: Ping Scan Return Value
[
IPv4Address('192.168.1.11'),
IPv4Address('192.168.1.12'),
IPv4Address('192.168.1.1')
]
.. code-block:: text
:caption: Ping Scan Output
+-------------------------+
| pc_1 NMAP Ping Scan |
+--------------+----------+
| IP Address | Can Ping |
+--------------+----------+
| 192.168.1.1 | True |
| 192.168.1.11 | True |
| 192.168.1.12 | True |
+--------------+----------+
Horizontal Port Scan
^^^^^^^^^^^^^^^^^^^^
Perform a horizontal port scan on port 5432 across multiple IP addresses:
.. code-block:: python
:caption: Horizontal Port Scan Code
horizontal_scan_results = pc_1_nmap.port_scan(
target_ip_address=[IPv4Address("192.168.1.12"), IPv4Address("192.168.1.13")],
target_port=Port(5432 )
)
.. code-block:: python
:caption: Horizontal Port Scan Return Value
{
IPv4Address('192.168.1.12'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.POSTGRES_SERVER: 5432>
]
}
}
.. code-block:: text
:caption: Horizontal Port Scan Output
+--------------------------------------------------+
| pc_1 NMAP Port Scan (Horizontal) |
+--------------+------+-----------------+----------+
| IP Address | Port | Name | Protocol |
+--------------+------+-----------------+----------+
| 192.168.1.12 | 5432 | POSTGRES_SERVER | TCP |
+--------------+------+-----------------+----------+
Vertical Post Scan
^^^^^^^^^^^^^^^^^^
Perform a vertical port scan on multiple ports on a single IP address:
.. code-block:: python
:caption: Vertical Port Scan Code
vertical_scan_results = pc_1_nmap.port_scan(
target_ip_address=[IPv4Address("192.168.1.12")],
target_port=[Port(21), Port(22), Port(80), Port(443)]
)
.. code-block:: python
:caption: Vertical Port Scan Return Value
{
IPv4Address('192.168.1.12'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.FTP: 21>,
<Port.HTTP: 80>
]
}
}
.. code-block:: text
:caption: Vertical Port Scan Output
+---------------------------------------+
| pc_1 NMAP Port Scan (Vertical) |
+--------------+------+------+----------+
| IP Address | Port | Name | Protocol |
+--------------+------+------+----------+
| 192.168.1.12 | 21 | FTP | TCP |
| 192.168.1.12 | 80 | HTTP | TCP |
+--------------+------+------+----------+
Box Scan
^^^^^^^^
Perform a box scan on multiple ports across multiple IP addresses:
.. code-block:: python
:caption: Box Port Scan Code
# Power PC 3 on before performing the box scan
pc_3.power_on()
box_scan_results = pc_1_nmap.port_scan(
target_ip_address=[IPv4Address("192.168.1.12"), IPv4Address("192.168.1.13")],
target_port=[Port(21), Port(22), Port(80), Port(443)]
)
.. code-block:: python
:caption: Box Port Scan Return Value
{
IPv4Address('192.168.1.13'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.FTP: 21>,
<Port.HTTP: 80>
]
},
IPv4Address('192.168.1.12'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.FTP: 21>,
<Port.HTTP: 80>
]
}
}
.. code-block:: text
:caption: Box Port Scan Output
+---------------------------------------+
| pc_1 NMAP Port Scan (Box) |
+--------------+------+------+----------+
| IP Address | Port | Name | Protocol |
+--------------+------+------+----------+
| 192.168.1.12 | 21 | FTP | TCP |
| 192.168.1.12 | 80 | HTTP | TCP |
| 192.168.1.13 | 21 | FTP | TCP |
| 192.168.1.13 | 80 | HTTP | TCP |
+--------------+------+------+----------+
Full Box Scan
^^^^^^^^^^^^^
Perform a full box scan on all ports, over both TCP and UDP, on a whole subnet:
.. code-block:: python
:caption: Box Port Scan Code
# Power PC 3 on before performing the full box scan
pc_3.power_on()
full_box_scan_results = pc_1_nmap.port_scan(
target_ip_address=IPv4Network("192.168.1.0/24"),
)
.. code-block:: python
:caption: Box Port Scan Return Value
{
IPv4Address('192.168.1.11'): {
<IPProtocol.UDP: 'udp'>: [
<Port.ARP: 219>
]
},
IPv4Address('192.168.1.1'): {
<IPProtocol.UDP: 'udp'>: [
<Port.ARP: 219>
]
},
IPv4Address('192.168.1.12'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.HTTP: 80>,
<Port.DNS: 53>,
<Port.POSTGRES_SERVER: 5432>,
<Port.FTP: 21>
],
<IPProtocol.UDP: 'udp'>: [
<Port.NTP: 123>,
<Port.ARP: 219>
]
},
IPv4Address('192.168.1.13'): {
<IPProtocol.TCP: 'tcp'>: [
<Port.HTTP: 80>,
<Port.DNS: 53>,
<Port.FTP: 21>
],
<IPProtocol.UDP: 'udp'>: [
<Port.NTP: 123>,
<Port.ARP: 219>
]
}
}
.. code-block:: text
:caption: Box Port Scan Output
+--------------------------------------------------+
| pc_1 NMAP Port Scan (Box) |
+--------------+------+-----------------+----------+
| IP Address | Port | Name | Protocol |
+--------------+------+-----------------+----------+
| 192.168.1.1 | 219 | ARP | UDP |
| 192.168.1.11 | 219 | ARP | UDP |
| 192.168.1.12 | 21 | FTP | TCP |
| 192.168.1.12 | 53 | DNS | TCP |
| 192.168.1.12 | 80 | HTTP | TCP |
| 192.168.1.12 | 123 | NTP | UDP |
| 192.168.1.12 | 219 | ARP | UDP |
| 192.168.1.12 | 5432 | POSTGRES_SERVER | TCP |
| 192.168.1.13 | 21 | FTP | TCP |
| 192.168.1.13 | 53 | DNS | TCP |
| 192.168.1.13 | 80 | HTTP | TCP |
| 192.168.1.13 | 123 | NTP | UDP |
| 192.168.1.13 | 219 | ARP | UDP |
+--------------+------+-----------------+----------+

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _WebBrowser: .. _WebBrowser:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``ref`` ``ref``
======= =======

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _Database Payload List: .. _Database Payload List:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _internal_frame_processing: .. _internal_frame_processing:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``system applications`` ``system applications``
""""""""""""""""""""""" """""""""""""""""""""""

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
``system services`` ``system services``
""""""""""""""""""" """""""""""""""""""

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
PCAP PCAP
==== ====

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DatabaseService: .. _DatabaseService:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DNSClient: .. _DNSClient:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _DNSServer: .. _DNSServer:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _FTPClient: .. _FTPClient:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _FTPServer: .. _FTPServer:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _NTPClient: .. _NTPClient:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _NTPServer: .. _NTPServer:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
.. _WebServer: .. _WebServer:

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
Session and Software Manager Session and Software Manager
============================ ============================

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
Software Software

View File

@@ -1,6 +1,6 @@
.. only:: comment .. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
SysLog SysLog
====== ======

View File

@@ -7,17 +7,15 @@ name = "primaite"
description = "PrimAITE (Primary-level AI Training Environment) is a simulation environment for training AI under the ARCD programme." description = "PrimAITE (Primary-level AI Training Environment) is a simulation environment for training AI under the ARCD programme."
authors = [{name="Defence Science and Technology Laboratory UK", email="oss@dstl.gov.uk"}] authors = [{name="Defence Science and Technology Laboratory UK", email="oss@dstl.gov.uk"}]
license = {file = "LICENSE"} license = {file = "LICENSE"}
requires-python = ">=3.8, <3.12" requires-python = ">=3.9, <3.12"
dynamic = ["version", "readme"] dynamic = ["version", "readme"]
classifiers = [ classifiers = [
"License :: OSI Approved :: MIT License",
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
"Operating System :: Microsoft :: Windows", "Operating System :: Microsoft :: Windows",
"Operating System :: MacOS", "Operating System :: MacOS",
"Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Linux",
"Operating System :: Unix", "Operating System :: Unix",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
@@ -91,7 +89,7 @@ order_by_type = "False"
line-length = 120 line-length = 120
[project.urls] [project.urls]
Homepage = "https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE" Homepage = "https://github.com/{todo:fill in URL}/PrimAITE"
Documentation = "https://Autonomous-Resilient-Cyber-Defence.github.io/PrimAITE/" Documentation = "https://{todo:fill in URL}.github.io/PrimAITE"
Repository = "https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE" Repository = "https://github.com/{todo:fill in URL}/PrimAITE"
Changelog = "https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE/blob/dev/CHANGELOG.md" Changelog = "https://github.com/{todo:fill in URL}/PrimAITE/blob/main/CHANGELOG.md"

View File

@@ -1,4 +1,4 @@
[metadata] [metadata]
url = https://github.com/Autonomous-Resilient-Cyber-Defence/PrimAITE url = https://github.com/{todo:fill in URL}/PrimAITE
author = Defence Science and Technology Laboratory UK author = Defence Science and Technology Laboratory UK
author_email = oss@dstl.gov.uk author_email = oss@dstl.gov.uk

View File

@@ -1 +1 @@
3.0.0 3.1.0

View File

@@ -1,4 +1,4 @@
# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK # © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
import datetime as datetime import datetime as datetime
import logging import logging
import logging.config import logging.config
@@ -203,3 +203,6 @@ def getLogger(name: str) -> Logger: # noqa
logger.setLevel(PRIMAITE_CONFIG["logging"]["log_level"]) logger.setLevel(PRIMAITE_CONFIG["logging"]["log_level"])
return logger return logger
DEFAULT_BANDWIDTH: Final[int] = 100

View File

@@ -1,4 +1,4 @@
# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK # © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
"""Provides a CLI using Typer as an entry point.""" """Provides a CLI using Typer as an entry point."""
import logging import logging
import os import os

View File

@@ -1,2 +1,2 @@
# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK # © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
"""Configuration parameters for running experiments.""" """Configuration parameters for running experiments."""

View File

@@ -188,6 +188,11 @@ agents:
num_nics: 2 num_nics: 2
include_num_access: false include_num_access: false
include_nmne: true include_nmne: true
monitored_traffic:
icmp:
- NONE
tcp:
- DNS
routers: routers:
- hostname: router_1 - hostname: router_1
num_ports: 0 num_ports: 0
@@ -471,7 +476,7 @@ agents:
46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1" 46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -484,7 +489,7 @@ agents:
47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2" 47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -497,7 +502,7 @@ agents:
48: # old action num: 24 # block tcp traffic from client 1 to web app 48: # old action num: 24 # block tcp traffic from client 1 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -510,7 +515,7 @@ agents:
49: # old action num: 25 # block tcp traffic from client 2 to web app 49: # old action num: 25 # block tcp traffic from client 2 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -523,7 +528,7 @@ agents:
50: # old action num: 26 50: # old action num: 26
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -536,7 +541,7 @@ agents:
51: # old action num: 27 51: # old action num: 27
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -549,52 +554,52 @@ agents:
52: # old action num: 28 52: # old action num: 28
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 0 position: 0
53: # old action num: 29 53: # old action num: 29
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
54: # old action num: 30 54: # old action num: 30
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
55: # old action num: 31 55: # old action num: 31
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
56: # old action num: 32 56: # old action num: 32
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
57: # old action num: 33 57: # old action num: 33
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
58: # old action num: 34 58: # old action num: 34
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
59: # old action num: 35 59: # old action num: 35
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 7 position: 7
60: # old action num: 36 60: # old action num: 36
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 8 position: 8
61: # old action num: 37 61: # old action num: 37
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 9 position: 9
62: # old action num: 38 62: # old action num: 38
action: "HOST_NIC_DISABLE" action: "HOST_NIC_DISABLE"

View File

@@ -470,7 +470,7 @@ agents:
46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1" 46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -483,7 +483,7 @@ agents:
47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2" 47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -496,7 +496,7 @@ agents:
48: # old action num: 24 # block tcp traffic from client 1 to web app 48: # old action num: 24 # block tcp traffic from client 1 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -509,7 +509,7 @@ agents:
49: # old action num: 25 # block tcp traffic from client 2 to web app 49: # old action num: 25 # block tcp traffic from client 2 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -522,7 +522,7 @@ agents:
50: # old action num: 26 50: # old action num: 26
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -535,7 +535,7 @@ agents:
51: # old action num: 27 51: # old action num: 27
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -548,52 +548,52 @@ agents:
52: # old action num: 28 52: # old action num: 28
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 0 position: 0
53: # old action num: 29 53: # old action num: 29
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
54: # old action num: 30 54: # old action num: 30
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
55: # old action num: 31 55: # old action num: 31
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
56: # old action num: 32 56: # old action num: 32
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
57: # old action num: 33 57: # old action num: 33
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
58: # old action num: 34 58: # old action num: 34
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
59: # old action num: 35 59: # old action num: 35
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 7 position: 7
60: # old action num: 36 60: # old action num: 36
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 8 position: 8
61: # old action num: 37 61: # old action num: 37
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 9 position: 9
62: # old action num: 38 62: # old action num: 38
action: "HOST_NIC_DISABLE" action: "HOST_NIC_DISABLE"
@@ -834,10 +834,10 @@ agents:
- type: NODE_RESET - type: NODE_RESET
- type: ROUTER_ACL_ADDRULE - type: ROUTER_ACL_ADDRULE
options: options:
target_router_nodename: router_1 target_router: router_1
- type: ROUTER_ACL_REMOVERULE - type: ROUTER_ACL_REMOVERULE
options: options:
target_router_nodename: router_1 target_router: router_1
- type: HOST_NIC_ENABLE - type: HOST_NIC_ENABLE
- type: HOST_NIC_DISABLE - type: HOST_NIC_DISABLE
@@ -1053,7 +1053,7 @@ agents:
46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1" 46: # old action num: 22 # "ACL: ADDRULE - Block outgoing traffic from client 1"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -1066,7 +1066,7 @@ agents:
47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2" 47: # old action num: 23 # "ACL: ADDRULE - Block outgoing traffic from client 2"
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -1079,7 +1079,7 @@ agents:
48: # old action num: 24 # block tcp traffic from client 1 to web app 48: # old action num: 24 # block tcp traffic from client 1 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -1092,7 +1092,7 @@ agents:
49: # old action num: 25 # block tcp traffic from client 2 to web app 49: # old action num: 25 # block tcp traffic from client 2 to web app
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -1105,7 +1105,7 @@ agents:
50: # old action num: 26 50: # old action num: 26
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
permission: 2 permission: 2
source_ip_id: 7 # client 1 source_ip_id: 7 # client 1
@@ -1118,7 +1118,7 @@ agents:
51: # old action num: 27 51: # old action num: 27
action: "ROUTER_ACL_ADDRULE" action: "ROUTER_ACL_ADDRULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
permission: 2 permission: 2
source_ip_id: 8 # client 2 source_ip_id: 8 # client 2
@@ -1131,52 +1131,52 @@ agents:
52: # old action num: 28 52: # old action num: 28
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 0 position: 0
53: # old action num: 29 53: # old action num: 29
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 1 position: 1
54: # old action num: 30 54: # old action num: 30
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 2 position: 2
55: # old action num: 31 55: # old action num: 31
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 3 position: 3
56: # old action num: 32 56: # old action num: 32
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 4 position: 4
57: # old action num: 33 57: # old action num: 33
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 5 position: 5
58: # old action num: 34 58: # old action num: 34
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 6 position: 6
59: # old action num: 35 59: # old action num: 35
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 7 position: 7
60: # old action num: 36 60: # old action num: 36
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 8 position: 8
61: # old action num: 37 61: # old action num: 37
action: "ROUTER_ACL_REMOVERULE" action: "ROUTER_ACL_REMOVERULE"
options: options:
target_router_nodename: router_1 target_router: router_1
position: 9 position: 9
62: # old action num: 38 62: # old action num: 38
action: "HOST_NIC_DISABLE" action: "HOST_NIC_DISABLE"

View File

@@ -0,0 +1,86 @@
game:
max_episode_length: 128
ports: []
protocols: []
agents:
- ref: RL_Agent
type: ProxyAgent
observation_space: null
action_space:
action_list:
- type: DONOTHING
- type: NODE_SHUTDOWN
- type: NODE_STARTUP
- type: HOST_NIC_ENABLE
- type: HOST_NIC_DISABLE
action_map:
0:
action: DONOTHING
options: {}
1:
action: NODE_SHUTDOWN
options:
node_id: 0
2:
action: NODE_SHUTDOWN
options:
node_id: 1
3:
action: NODE_STARTUP
options:
node_id: 0
4:
action: NODE_STARTUP
options:
node_id: 1
5:
action: HOST_NIC_DISABLE
options:
node_id: 0
nic_id: 0
6:
action: HOST_NIC_DISABLE
options:
node_id: 1
nic_id: 0
7:
action: HOST_NIC_ENABLE
options:
node_id: 0
nic_id: 0
8:
action: HOST_NIC_ENABLE
options:
node_id: 1
nic_id: 0
options:
nodes:
- node_name: client_1
- node_name: server
max_folders_per_node: 0
max_files_per_folder: 0
max_services_per_node: 0
max_nics_per_node: 1
max_acl_rules: 0
ip_list:
- 192.168.1.2
- 192.168.1.3
reward_function:
reward_components: []
simulation:
network:
nodes:
- hostname: server
type: server
ip_address: 192.168.1.2
subnet_mask: 255.255.255.0
default_gateway: 192.168.1.1
services: *server_services
- hostname: client_1
type: computer
ip_address: 192.168.1.3
subnet_mask: 255.255.255.0
default_gateway: 192.168.1.1
applications: *client_applications

Some files were not shown because too many files have changed in this diff Show More