Commit Graph

2204 Commits

Author SHA1 Message Date
Charlie Crane
5006e41546 #2871 - Updated the show_history() function to receive a list of actions to ignore when printing the history. Defaults to ignoring DONOTHING actions 2024-09-13 15:47:59 +01:00
Charlie Crane
f2a0eeaca2 #2871 - Updated show_history() method to use boolean 'include_nothing' for whether to include DONOTHING actions 2024-09-13 14:11:13 +01:00
Charlie Crane
c924b9ea46 #2871 - Initial commit of a show_history() function in AbstractAgent 2024-09-13 11:54:17 +01:00
Czar Echavez
eb24d1270b Merged PR 529: #2842 and #2843: implement add user and disable user actions + tests
## Summary
Added actions which allow a user to be added and disabled

## Test process
https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/529?_a=files&path=/tests/integration_tests/game_layer/actions/test_user_account_actions.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

#2842 and #2843: implement add user and disable user actions + tests

Related work items: #2842, #2843
2024-09-12 09:45:05 +00:00
Czar Echavez
8bd20275d0 #2842: fix test 2024-09-12 10:01:12 +01:00
Charlie Crane
31a820f021 Merged PR 539: ACL rules don't apply to ARP
## Summary
Updates to `router.py` to allow ARP layer-2 traffic to not be held up by ACL rules, as they now only handle layer-3 traffic.
An explicit ACL rule to permit ARP traffic is no longer needed.
Documentation updates to reflect change.

## Test process
All tests still pass.

## 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
- [X] attended to any **TO-DOs** left in the code

Related work items: #2775
2024-09-12 08:17:45 +00:00
Charlie Crane
f908f9b23e #2775 - Actioning review comments 2024-09-11 15:50:14 +01:00
Charlie Crane
85863b1972 #2775 - Removed a print statement committed in error and updated the checks done in subject_to_acl following review 2024-09-11 15:36:51 +01:00
Charlie Crane
f95501f2a8 #2775 - Purging of more instances where the ARP acl rule is set and no longer necessary. Added a new test to show ARP is unaffected by ACL rules and actioned review comments 2024-09-11 15:12:36 +01:00
Charlie Crane
d5f1d0fda1 #2775 - Updated Changelog and bring up to date with dev 2024-09-11 11:28:27 +01:00
Charlie Crane
e9531bc392 Merge branch 'dev' into feature/2775-Refactor_Networking_Nodes 2024-09-11 11:27:26 +01:00
Charlie Crane
a2005df9f0 #2775 - Documentation updates 2024-09-11 10:56:44 +01:00
Charlie Crane
19d6fa2174 #2775 - Updated to look neater 2024-09-11 10:12:07 +01:00
Czar Echavez
1cdf9edffb Merged PR 536: #2345: remove try catch + todo - figure out why db connection cannot be made
## Summary
Remove try catch in webserver to prevent difficult to debug problems

## Test process
Used existing tests - this is because webserver should still act as before - only the try catch block is removed

## 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

#2345: remove try catch + todo - figure out why db connection cannot be made

Related work items: #2345
2024-09-10 12:39:18 +00:00
Charlie Crane
1c6e8b2a95 #2775 - Removed default ARP rule for routers and added logic when handling ARP traffic 2024-09-10 11:39:04 +01:00
Czar Echavez
82887bdb17 #2842: apply PR suggestions 2024-09-10 10:52:00 +01:00
Czar Echavez
4a48a8d054 #2345: return error if db connection cannot be made 2024-09-09 10:54:42 +01:00
Archer.Bowen
974aee90b3 #2842 Added additional tests to confirm terminal functionality 2024-09-06 14:09:30 +01:00
Czar Echavez
a998b8e22b #2345: remove try catch + todo - figure out why db connection cannot be made 2024-09-05 16:47:17 +01:00
Czar Echavez
1234b2dc4a Merged PR 523: #2782: initial impl of files in nodes
## Summary
Added ability to add folders and files to nodes via configuration

## Test process
https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/523?_a=files&path=/tests/integration_tests/configuration_file_parsing/test_node_file_system_config.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
- [X] 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

#2782: initial impl of files in nodes

Related work items: #2782
2024-09-05 13:57:42 +00:00
Czar Echavez
e809d89c30 #2842 and #2843: implement add user and disable user actions + tests 2024-09-05 13:47:59 +01:00
Czar Echavez
2391c48569 #2782: apply suggestions 2024-09-05 10:18:35 +01:00
Nick Todd
78c36f20a0 Merged PR 525: Log observation space data for each episode and step.
## Summary
Updated `AgentHistoryItem` class so that it stores observation space data for every step of each episode. This means that `write_agent_log()` will log the additional data to file provided that `save_agent_actions` is set to `true` in the config file.

## Test process
Tested on following notebooks on Linux and Windows:

- Data-Manipulation-E2E-Demonstration
- Training-an-SB3-Agent
- Training-an-RLLib-Agent
- Training-an-RLLIB-MARL-System.

Wrote and passed new test: `test_obs_data_capture`.
Passes all existing tests.

## 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
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2845
2024-09-04 14:26:53 +00:00
Nick Todd
5608ad5ed5 #2845: Change 'obs_space_data' to 'observation'. 2024-09-04 14:25:08 +01:00
Czar Echavez
1374a23e14 #2782: fix spacing in data_manipulation yaml + documentation 2024-09-04 10:17:33 +01:00
Nick Todd
f4b1d9a91c #2845: Update CHANGELOG. 2024-09-03 17:26:01 +01:00
Nick Todd
1822e85eec #2845: Pre-commit fixes 2024-09-03 17:24:21 +01:00
Nick Todd
61add769c4 #2845: Add test for obs_data_space capture. 2024-09-03 17:16:48 +01:00
Nick Todd
8e57e707b3 #2845: Changed to store obs data within AgentHistoryItem 2024-09-03 14:38:19 +01:00
Czar Echavez
26a56bf360 #2782: documentation + adding example to data_manipulation.yaml 2024-09-03 12:37:39 +01:00
Czar Echavez
8e6b9f3970 #2782: added ability to create empty folders + create files with size and types + tests 2024-09-03 11:53:23 +01:00
Nick Todd
5cacbf0337 #2845: Changes to write observation space data to log file. 2024-09-02 16:54:13 +01:00
Czar Echavez
a7f00c668d #2782: initial impl of files in nodes 2024-09-02 15:15:45 +01:00
Nick Todd
08f742b3ec Merged PR 522: #2844: Added evaluation stage to Ray notebooks.
## Summary
Added evaluation stage to Training-an-RLLib-Agent and Training-an-RLLIB-MARL-System notebooks.

## Test process
Tested individual notebooks.
Ran all PrimAITE tests.

## 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

#2844: Added evaluation stage to Ray notebooks.

Related work items: #2844
2024-08-30 10:18:31 +00:00
Nick Todd
d3200f70e1 #2844: Added evaluation stage to Ray notebooks. 2024-08-30 10:23:34 +01:00
Marek Wolan
3de12573d3 Merged PR 520: Backport core changes from internal 2024-08-28 09:56:56 +00:00
Marek Wolan
a1553fb1b4 Backport core changes from internal 2024-08-28 10:20:32 +01:00
Marek Wolan
90cfe2f22b Merged PR 518: Fixed incorrect formatting on .rst and new priv esc notebook 2024-08-23 11:26:10 +00:00
Archer Bowen
9a6b1d374a Fixed incorrect formatting on .rst and new priv esc notebook 2024-08-23 12:22:56 +01:00
Marek Wolan
0e0fc96cd3 Merged PR 517: create doc page on rewards 2024-08-23 08:54:47 +00:00
Marek Wolan
fbbaf65aab create doc page on rewards 2024-08-22 18:12:37 +01:00
Christopher McCarthy
ff5a2e1bbe Merged PR 510: Privilege Escalation & Data Loss Example Notebook
## Summary
- Added a new Privilege-Escalation-and Data-Loss-Example.ipynb notebook with a more realistic scenario.
- Made some minor changes to multi_lan_internet_network_example.yaml to enable the new scenario.

## Test process
Manual end-to-end run of the notebook.

## 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
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2686
2024-08-22 10:12:38 +00:00
Chris McCarthy
4a7a4fd571 #2686 - typo changes in jupyter notebook 2024-08-22 09:53:27 +01:00
Marek Wolan
c4eb60deda Merged PR 511: Fix incorrect removal of last_query_response from database client
oopsie

Related work items: #2736
2024-08-20 19:49:14 +00:00
Marek Wolan
71ec71e400 Fix incorrect removal of last_query_response from database client 2024-08-20 15:46:54 +00:00
Chris McCarthy
5d209e4ff9 #2686 - Added a new Privilege-Escalation-and Data-Loss-Example.ipynb notebook with a more realistic scenario. Made some minor changes to multi_lan_internet_network_example.yaml to enable the new scenario. 2024-08-20 15:33:39 +01:00
Archer Bowen
bceedbf72d Merged PR 504: Command and Control Full PR
## Summary
Implements the Command and Control applications to the quality and capability needed for the TAP001 expansion and lays the foundations for all the features required for TAP002 (Next Release).

The C2C suite contains three new applications:

**1. Abstract C2**

Base class for the C2 Server and the C2 Beacon. Controls the main internal logic of both applications but with a couple of abstract methods which each class defines differently.

**2. C2 Server**

The C2 Server takes red agent actions and converts the action options into C2 Commands which are then passed to the C2 Beacon.
The output of these commands is sent back to the C2 Server and then returned back to the red agent.

**3. C2 Beacon**

The C2 beacon uses the Terminal and the Ransomware Applications to perform different commands which it receives these commands and executes them and returns the output.

The C2 beacon can also be configured by the Red Agent to configure the current networking behaviour.

For a much more detailed description please refer to the .rst documentation and the notebook which demonstrate and describe the functionality very explicitly.

Lastly the wiki page also provides more information around the design work for this feature.

[Command and Control](/Welcome-to-PrimAITE!/Design/[~In-Progress~]/Command-and-Control)

Worth noting that some changes were needed that were unseen during the design page but the overall goals of the feature have been accomplished.

## Test process
Tested via notebooks and a series of e2e tests.

## 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
- [x] attended to any **TO-DOs** left in the code (One remaining but unsure if it should be handled in this PR)

Related work items: #2689, #2720, #2721, #2779
2024-08-20 13:16:22 +00:00
Marek Wolan
23194e1ba8 Merged PR 508: Add option for rewards to be instantaneous
## Summary
* Changed how `GreenAdminDatabaseUnreachablePenalty`, `WebpageUnavailablePenalty`, and `WebServer404Penalty` work.
* They can now be configured with `sticky: false` in the yaml
* which means they no longer retain a positive/negative value after a successful/failed request, if the agent goes on to do nothing the next step
* refactored the calculate methods to better align with those rewards depending the previous action
* changed what is returned by some of the `describe_state` methods of sim components. They had legacy methods of returning the most recent success code which is no longer needed since the introduction of agent history

## Test process
Existing tests pass, new tests added

## 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
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [X] attended to any **TO-DOs** left in the code

Related work items: #2736
2024-08-20 10:40:43 +00:00
Archer Bowen
c9d62d512c #2689 fixed mismerge 2024-08-20 11:15:04 +01:00
Archer Bowen
b8767da61e #2689 Fixed merging errors with actions.py 2024-08-20 10:51:29 +01:00