Commit Graph

575 Commits

Author SHA1 Message Date
SunilSamra
1a13af2f5e #1752 - Changed DNSReply and DNSResponse to have 1 parameter only 2023-08-21 14:11:53 +01:00
SunilSamra
a0b258a597 #1752 - Added a dns_lookup function to dns_server.py 2023-08-21 09:02:04 +01:00
SunilSamra
2919be3796 #1752 - Added web_browser.py application for DNS modelling 2023-08-17 14:20:09 +01:00
SunilSamra
72cd9fd8e2 #1752 - Created dns.py protocol file with DNSPacket and DNSRequest and DNSReply packets
- Added reset_component logic for dns_server.py and dns_client.py
2023-08-16 13:00:16 +01:00
SunilSamra
76d404dc2f #1752 - Added dns_client.py and dns_server.py service files
- Added new get_install method to software.py
2023-08-15 13:56:38 +01:00
Czar Echavez
d972fcc07e Merged PR 164: File System Class setup fixing tests
## Summary
Attempting to fix a test which seems to be broken when integrated with https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/160

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

## Checklist
- [x] This PR is linked to a **work item**
- [x] I have performed **self-review** of the code
- [x] I have written **tests** for any new functionality added with this PR
- [ ] I have updated the **documentation** if this PR changes or adds functionality
- [ ] I have written/updated **design docs** if this PR implements new functionality.
- [x] I have run **pre-commit** checks for code style

#1714: fixing minor error in test + adding a check for existing uuid when adding file

Related work items: #1714
2023-08-14 08:27:09 +00:00
Czar Echavez
c4aacb8c69 #1714: Change file and folder uuid checking to check for file or folder names already existing 2023-08-11 15:33:07 +01:00
Christopher McCarthy
1b84d28c48 Merged PR 161: Working base Node class
## Summary
- Network Hardware - Added base hardware module with NIC, SwitchPort, Node, Switch, and Link. Nodes and Switches have
fundamental services like ARP, ICMP, and PCAP running them by default.
- Network Transmission - Modelled OSI Model layers 1 through to 5 with various classes for creating network frames and
transmitting them from a Service/Application, down through the layers, over the wire, and back up through the layers to
a Service/Application another machine.
- system - Added the core structure of Application, Services, and Components. Also added a SoftwareManager and
SessionManager.

- #1706 - Got the core Node class build and working with ARP and the ability to ping another node. Added some basic tests in. Next job is to create the Node subclasses. Then move ARP and ICMP into a ser
- #1706 - Added some extra logging
- #1706 - Started adding the core node software required by all nodes. Made some tweaks to the Frame to have send and receive timestamp.
- #1706 - Got the code services, application, and process base classes stubbed out. Need them now so that I can leverage them for core node services required.
- #1706 - Tidied up the SysLog ARPCache, and ICMP classes and integrated them into the Node. Tidied up the base implementation of SoftwareManager and SessionManager. Tidies up the public API for Service

## Test process
Tests really asses how components fit together and that it all does work. They tests don't yet check that things like ICMP work, as in the ping is received and responded to.

## Checklist
- [X] This PR is linked to a **work item**
- [X] I have performed **self-review** of the code
- [X] I have written **tests** for any new functionality added with this PR
- [X] I have updated the **documentation** if this PR changes or adds functionality
- [X] I have written/updated **design docs** if this PR implements new functionality.
- [X] I have run **pre-commit** checks for code style

Related work items: #1706
2023-08-10 14:30:04 +00:00
Chris McCarthy
49f855c320 #1706 - Synced with Dev 2023-08-10 13:33:32 +01:00
Chris McCarthy
b902d945ee Merge remote-tracking branch 'devops/dev' into feature/1706_node_class_and_node_type_subclasses
# Conflicts:
#	CHANGELOG.md
#	src/primaite/simulator/core.py
2023-08-10 13:29:14 +01:00
Chris McCarthy
9ee0ef2fd6 #1706 - Applied some final changes from PR. Fixed the PCAP log name on SwitchPort so that a pcap file is generated for each port. 2023-08-10 13:26:51 +01:00
Marek Wolan
586f210402 Merged PR 160: Permission system, account skeleton, and group skeleton
## Summary
This PR implements an outline of accounts and domain controller. However, the main contribution is the permissions system and the changes to `SimComponent`. The domain skeleton will probably change after the node/folder/file/app/service classes exist.

The big idea of the permissions is that the simulator itself is built in a way that permits everything, i.e. the methods of each component that make something happen don't have any permissions checking. Therefore, if you can use primaite without any agents and you will essentially have superadmin, any action you perform will go through. The permissions come into play when you try to interact with the components via the actions. Every action has a configurable permission validator attached to it that will either allow or block the action.

For this reason, I've had to modify the way actions work. To keep everything neatly contained, there is a new Action class that holds a reference to both the action function itself but also to a permission validation function.

## Test process
Unit tests and integration tests.
I will write the design documentation for permissions and update the design for SimComponent once others are happy that the design makes sense.

## Checklist
- [x] This PR is linked to a **work item**
- [x] I have performed **self-review** of the code
- [x] I have written **tests** for any new functionality added with this PR
- [x] I have updated the **documentation** if this PR changes or adds functionality
- [x] I have updated the **changelog**
- [ ] I have written/updated **design docs** if this PR implements new functionality
- [x] I have run **pre-commit** checks for code style

Related work items: #1716
2023-08-10 12:07:38 +00:00
Marek Wolan
e24d4b8890 Fix typo in test 2023-08-10 09:14:45 +01:00
Chris McCarthy
ad81a81949 #1706 - Applied some code suggestions from the PR 2023-08-09 20:38:45 +01:00
Chris McCarthy
b46057841d #1706 - Refactored a bunch of if statements in base.py to improve readability 2023-08-09 20:31:42 +01:00
Marek Wolan
34ff9abd7a Apply changes from code review. 2023-08-09 15:55:28 +01:00
Czar Echavez
cf241366dc #1714: apply suggestions for preventing addition of objects with similar uuid 2023-08-09 15:15:45 +01:00
Marek Wolan
f198a8b94d Fix bad merge 2023-08-09 12:36:09 +01:00
Marek Wolan
51baabb35b Update enums to uppercase in docs 2023-08-09 12:34:56 +01:00
Marek Wolan
596bbaacde Change enum strings to uppercase 2023-08-09 12:06:06 +01:00
Czar Echavez
572f457231 #1714: fixing minor error in test + adding a check for existing uuid when adding file 2023-08-09 11:19:58 +01:00
Marek Wolan
be8c2955ce Change Accountstatus to a bool 2023-08-09 10:26:52 +01:00
Marek Wolan
1de8e0a058 Update tests 2023-08-09 09:19:11 +01:00
Marek Wolan
a3c2ae6c7d Merge dev into feature/1716-accounts-and-groups 2023-08-09 09:18:06 +01:00
Chris McCarthy
a840159460 #1706 - Fixed the "smart" merging of SimComponent that PyCharm performed. Integrated the Filesystem class into the Node. Added prettytable to deps in pyproject.toml 2023-08-08 20:30:37 +01:00
Chris McCarthy
9fbc3c91f7 #1706 - Finished up the Node and Switch MVP. Added full extensive documentation on what's happening at each step. 2023-08-08 20:22:18 +01:00
Chris McCarthy
4e4c2b501a Merge remote-tracking branch 'devops/dev' into feature/1706_node_class_and_node_type_subclasses
# Conflicts:
#	tests/unit_tests/_primaite/_simulator/test_core.py
2023-08-08 20:05:11 +01:00
Czar Echavez
5f097b7c1b Merged PR 157: File System Class setup
## Summary
Skeleton of the FileSystem for the simulation. Does not have all the requirements for the FileSystem yet, since we need to start somewhere

## Test process
Created unit tests for:
- [FileSystem](https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/157?_a=files&path=/tests/unit_tests/_primaite/_simulator/_file_system/test_file_system.py)
- [FileSystemFolder](https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/157?_a=files&path=/tests/unit_tests/_primaite/_simulator/_file_system/test_file_system_folder.py)
- [FileSystemFile](https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/157?_a=files&path=/tests/unit_tests/_primaite/_simulator/_file_system/test_file_system_file.py)

## Design document
https://dev.azure.com/ma-dev-uk/PrimAITE/_wiki/wikis/PrimAITE.wiki/151/FileSystem

## Checklist
- [x] This PR is linked to a **work item**
- [x] I have performed **self-review** of the code
- [x] I have written **tests** for any new functionality added with this PR
- [ ] I have updated the **documentation** if this PR changes or adds functionality
- [x] I have written/updated **design docs** if this PR implements new functionality.
- [x] I have run **pre-commit** checks for code style

Related work items: #1714
2023-08-08 09:29:46 +00:00
Czar Echavez
2f27e02877 #1714: fix precommit 2023-08-08 09:53:32 +01:00
Czar Echavez
c2b783c858 Apply suggestions from code review 2023-08-08 08:17:40 +00:00
Czar Echavez
f854404ba0 #1714: added file system to changelog 2023-08-08 08:41:50 +01:00
Czar Echavez
c8ee409b3b #1714: run precommit 2023-08-08 08:29:51 +01:00
Chris McCarthy
139d739732 #1706 - Tidies up the sysLog ARPCache, and ICMP classes and integrated them into the Node. Tidied up the base implementation of SoftwareManager and SessionManager. Tidies up the public API for Services and Applications. Added the SwitchPort and Switch classes. Added a basic test in test_frame_transmission.py that tests sending a frame from one node to another across a multi-switch network. 2023-08-07 19:33:52 +01:00
Marek Wolan
7eb0bb428f Update code based on PR comments. 2023-08-07 17:24:14 +01:00
Czar Echavez
700950b856 Apply suggestions from code review 2023-08-07 15:38:15 +00:00
Czar Echavez
a4c193cd34 #1714: apply recommended changes with removing get methods and using the properties directly 2023-08-07 16:20:55 +01:00
Czar Echavez
554619e4b4 #1714: conver file and folder lists to dicts + fixing and adding a few more tests 2023-08-07 14:49:59 +01:00
Czar Echavez
b58a3a3e24 #1714: FileSystemItem is no longer an abstract base class + Added enums and enum sizes + stream lined FileSystemFile init 2023-08-07 11:52:54 +01:00
Marek Wolan
22afdc9134 Updated pull_request_template.md 2023-08-07 10:19:06 +00:00
Marek Wolan
84b6e2206e Updated CHANGELOG.md 2023-08-07 10:18:27 +00:00
Marek Wolan
f0d7e03fd7 Add docs and tests 2023-08-07 10:55:29 +01:00
Czar Echavez
d57c2a936e #1714: remove duplicate method 2023-08-07 10:10:05 +01:00
Czar Echavez
028211d288 #1714: update to use objects instead of uuids + tests 2023-08-07 09:34:59 +01:00
Marek Wolan
ac9b83cc42 Merge remote-tracking branch 'origin/dev' into feature/1716-accounts-and-groups 2023-08-07 09:15:35 +01:00
Czar Echavez
46c70ac084 #1714: refactor private attributes and made them public + serialisation tests 2023-08-03 22:20:14 +01:00
Chris McCarthy
04f1cb0dc6 #1706 - Got the code services, application, and process base classes stubbed out. Need them now so that I can leverage them for core node services required. 2023-08-03 21:30:13 +01:00
Marek Wolan
2a680c1e48 Test my validators 2023-08-03 16:26:33 +01:00
Chris McCarthy
cac4779244 #1706 - Started adding the core node software required by all nodes. Made some tweaks to the Frame to have send and receive timestamp. 2023-08-03 14:37:55 +01:00
Marek Wolan
94617c57a4 Make register and deregister acct private 2023-08-03 13:24:27 +01:00
Marek Wolan
3a2840bed8 Overhaul sim component for permission management. 2023-08-03 13:09:04 +01:00