Merge branch '4.0.0a1-dev' into feature/3075_Migrate_notebooks_to_MilPac_(Core_changes)
This commit is contained in:
@@ -23,117 +23,117 @@ The following logic is applied:
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| Action | Action Mask Logic |
|
||||
+==========================================+=====================================================================+
|
||||
| **do_nothing** | Always Possible. |
|
||||
| **do-nothing** | Always Possible. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_scan** | Node is on. Service is running. |
|
||||
| **node-service-scan** | Node is on. Service is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_stop** | Node is on. Service is running. |
|
||||
| **node-service-stop** | Node is on. Service is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_start** | Node is on. Service is stopped. |
|
||||
| **node-service-start** | Node is on. Service is stopped. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_pause** | Node is on. Service is running. |
|
||||
| **node-service-pause** | Node is on. Service is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_resume** | Node is on. Service is paused. |
|
||||
| **node-service-resume** | Node is on. Service is paused. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_restart** | Node is on. Service is running. |
|
||||
| **node-service-restart** | Node is on. Service is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_disable** | Node is on. |
|
||||
| **node-service-disable** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_enable** | Node is on. Service is disabled. |
|
||||
| **node-service-enable** | Node is on. Service is disabled. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_service_fix** | Node is on. Service is running. |
|
||||
| **node-service-fix** | Node is on. Service is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_execute** | Node is on. |
|
||||
| **node-application-execute** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_scan** | Node is on. Application is running. |
|
||||
| **node-application-scan** | Node is on. Application is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_close** | Node is on. Application is running. |
|
||||
| **node-application-close** | Node is on. Application is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_fix** | Node is on. Application is running. |
|
||||
| **node-application-fix** | Node is on. Application is running. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_install** | Node is on. |
|
||||
| **node-application-install** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_application_remove** | Node is on. |
|
||||
| **node-application-remove** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_scan** | Node is on. File exists. File not deleted. |
|
||||
| **node-file-scan** | Node is on. File exists. File not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_create** | Node is on. |
|
||||
| **node-file-create** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_checkhash** | Node is on. File exists. File not deleted. |
|
||||
| **node-file-checkhash** | Node is on. File exists. File not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_delete** | Node is on. File exists. |
|
||||
| **node-file-delete** | Node is on. File exists. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_repair** | Node is on. File exists. File not deleted. |
|
||||
| **node-file-repair** | Node is on. File exists. File not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_restore** | Node is on. File exists. File is deleted. |
|
||||
| **node-file-restore** | Node is on. File exists. File is deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_corrupt** | Node is on. File exists. File not deleted. |
|
||||
| **node-file-corrupt** | Node is on. File exists. File not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_file_access** | Node is on. File exists. File not deleted. |
|
||||
| **node-file-access** | Node is on. File exists. File not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_folder_create** | Node is on. |
|
||||
| **node-folder-create** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_folder_scan** | Node is on. Folder exists. Folder not deleted. |
|
||||
| **node-folder-scan** | Node is on. Folder exists. Folder not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_folder_checkhash** | Node is on. Folder exists. Folder not deleted. |
|
||||
| **node-folder-checkhash** | Node is on. Folder exists. Folder not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_folder_repair** | Node is on. Folder exists. Folder not deleted. |
|
||||
| **node-folder-repair** | Node is on. Folder exists. Folder not deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_folder_restore** | Node is on. Folder exists. Folder is deleted. |
|
||||
| **node-folder-restore** | Node is on. Folder exists. Folder is deleted. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_os_scan** | Node is on. |
|
||||
| **node-os-scan** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **host_nic_enable** | NIC is disabled. Node is on. |
|
||||
| **host-nic-enable** | NIC is disabled. Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **host_nic_disable** | NIC is enabled. Node is on. |
|
||||
| **host-nic-disable** | NIC is enabled. Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_shutdown** | Node is on. |
|
||||
| **node-shutdown** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_startup** | Node is off. |
|
||||
| **node-startup** | Node is off. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_reset** | Node is on. |
|
||||
| **node-reset** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_nmap_ping_scan** | Node is on. |
|
||||
| **node-nmap-ping-scan** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_nmap_port_scan** | Node is on. |
|
||||
| **node-nmap-port-scan** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_network_service_recon** | Node is on. |
|
||||
| **node-network-service-recon** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **network_port_enable** | Node is on. Router is on. |
|
||||
| **network-port-enable** | Node is on. Router is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **network_port_disable** | Router is on. |
|
||||
| **network-port-disable** | Router is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **router_acl_addrule** | Router is on. |
|
||||
| **router-acl-add-rule** | Router is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **router_acl_removerule** | Router is on. |
|
||||
| **router-acl-remove-rule** | Router is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **firewall_acl_addrule** | Firewall is on. |
|
||||
| **firewall-acl-add-rule** | Firewall is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **firewall_acl_removerule** | Firewall is on. |
|
||||
| **firewall-acl-remove-rule** | Firewall is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **configure_database_client** | Node is on. |
|
||||
| **configure-database-client** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **configure_ransomware_script** | Node is on. |
|
||||
| **configure-ransomware-script** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **c2_server_ransomware_configure** | Node is on. |
|
||||
| **c2-server-ransomware-configure** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **configure_dos_bot** | Node is on. |
|
||||
| **configure-dos-bot** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **configure_c2_beacon** | Node is on. |
|
||||
| **configure-c2-beacon** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **c2_server_ransomware_launch** | Node is on. |
|
||||
| **c2-server-ransomware-launch** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **c2_server_terminal_command** | Node is on. |
|
||||
| **c2-server-terminal-command** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **c2_server_data_exfiltrate** | Node is on. |
|
||||
| **c2-server-data-exfiltrate** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_account_change_password** | Node is on. |
|
||||
| **node-account-change-password** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_session_remote_login** | Node is on. |
|
||||
| **node-session-remote-login** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_session_remote_logoff** | Node is on. |
|
||||
| **node-session-remote-logoff** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
| **node_send_remote_command** | Node is on. |
|
||||
| **node-send-remote-command** | Node is on. |
|
||||
+------------------------------------------+---------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ Agents can be scripted (deterministic and stochastic), or controlled by a reinfo
|
||||
...
|
||||
- ref: green_agent_example
|
||||
team: GREEN
|
||||
type: ProbabilisticAgent
|
||||
type: probabilistic-agent
|
||||
observation_space:
|
||||
type: UC2GreenObservation
|
||||
action_space:
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: DUMMY
|
||||
- type: dummy
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
@@ -44,13 +44,13 @@ Specifies if the agent is malicious (``RED``), benign (``GREEN``), or defensive
|
||||
|
||||
``type``
|
||||
--------
|
||||
Specifies which class should be used for the agent. ``ProxyAgent`` is used for agents that receive instructions from an RL algorithm. Scripted agents like ``RedDatabaseCorruptingAgent`` and ``ProbabilisticAgent`` generate their own behaviour.
|
||||
Specifies which class should be used for the agent. ``proxy-agent`` is used for agents that receive instructions from an RL algorithm. Scripted agents like ``red-database-corrupting-agent`` and ``probabilistic-agent`` generate their own behaviour.
|
||||
|
||||
Available agent types:
|
||||
|
||||
- ``ProbabilisticAgent``
|
||||
- ``ProxyAgent``
|
||||
- ``RedDatabaseCorruptingAgent``
|
||||
- ``probabilistic-agent``
|
||||
- ``proxy-agent``
|
||||
- ``red-database-corrupting-agent``
|
||||
|
||||
``observation_space``
|
||||
---------------------
|
||||
@@ -66,10 +66,10 @@ selects which python class from the :py:mod:`primaite.game.agent.observation` mo
|
||||
|
||||
Allows configuration of the chosen observation type. These are optional.
|
||||
|
||||
* ``num_services_per_node``, ``num_folders_per_node``, ``num_files_per_folder``, ``num_nics_per_node`` all define the shape of the observation space. The size and shape of the obs space must remain constant, but the number of files, folders, ACL rules, and other components can change within an episode. Therefore padding is performed and these options set the size of the obs space.
|
||||
* ``num_services_per_node``, ``num_folders_per_node``, ``num_files_per_folder``, ``num_nics_per_node`` all define the shape of the observation space. The size and shape of the obs space must remain constant, but the number of files, folders, acl rules, and other components can change within an episode. Therefore padding is performed and these options set the size of the obs space.
|
||||
* ``nodes``: list of nodes that will be present in this agent's observation space. The ``node_ref`` relates to the human-readable unique reference defined later in the ``simulation`` part of the config. Each node can also be configured with services, and files that should be monitored.
|
||||
* ``links``: list of links that will be present in this agent's observation space. The ``link_ref`` relates to the human-readable unique reference defined later in the ``simulation`` part of the config.
|
||||
* ``acl``: configure how the agent reads the access control list on the router in the simulation. ``router_node_ref`` is for selecting which router's ACL table should be used. ``ip_list`` sets the encoding of ip addresses as integers within the observation space.
|
||||
* ``acl``: configure how the agent reads the access control list on the router in the simulation. ``router_node_ref`` is for selecting which router's acl table should be used. ``ip_list`` sets the encoding of ip addresses as integers within the observation space.
|
||||
|
||||
For more information see :py:mod:`primaite.game.agent.observations`
|
||||
|
||||
@@ -103,7 +103,7 @@ Similar to action space, this is defined as a list of components from the :py:mo
|
||||
|
||||
``reward_components``
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
TODO: update description
|
||||
A list of reward types from :py:mod:`primaite.game.agent.rewards.RewardFunction.rew_class_identifiers`
|
||||
|
||||
e.g.
|
||||
@@ -111,8 +111,8 @@ e.g.
|
||||
.. code-block:: yaml
|
||||
|
||||
reward_components:
|
||||
- type: DUMMY
|
||||
- type: DATABASE_FILE_INTEGRITY
|
||||
- type: dummy
|
||||
- type: database-file-integrity
|
||||
|
||||
|
||||
``agent_settings``
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
``simulation``
|
||||
==============
|
||||
In this section the network layout is defined. This part of the config follows a hierarchical structure. Almost every component defines a ``ref`` field which acts as a human-readable unique identifier, used by other parts of the config, such as agents.
|
||||
|
||||
# TODO: ref field is no longer real
|
||||
At the top level of the network are ``nodes``, ``links`` and ``airspace``.
|
||||
|
||||
e.g.
|
||||
|
||||
@@ -617,10 +617,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 192.168.1.1
|
||||
dns_server: 8.8.8.2
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
- type: WebBrowser
|
||||
- type: web-browser
|
||||
options:
|
||||
target_url: http://sometech.ai
|
||||
|
||||
@@ -631,10 +631,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 192.168.1.1
|
||||
dns_server: 8.8.8.2
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
- type: WebBrowser
|
||||
- type: web-browser
|
||||
options:
|
||||
target_url: http://sometech.ai
|
||||
|
||||
@@ -700,7 +700,7 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 8.8.8.1
|
||||
services:
|
||||
- ref: dns_server
|
||||
type: DNSServer
|
||||
type: dns-server
|
||||
options:
|
||||
domain_mapping:
|
||||
sometech.ai: 94.10.180.6
|
||||
@@ -794,9 +794,9 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
dns_server: 8.8.8.2
|
||||
services:
|
||||
- ref: web_server
|
||||
type: WebServer
|
||||
type: web-server
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
|
||||
@@ -903,10 +903,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 10.10.1.1
|
||||
dns_server: 8.8.8.2
|
||||
services:
|
||||
- type: DatabaseService
|
||||
- type: database-service
|
||||
options:
|
||||
backup_server_ip: 10.10.1.12 # The some_tech_storage_srv server
|
||||
- type: FTPClient
|
||||
- type: ftp-client
|
||||
|
||||
- hostname: some_tech_storage_srv
|
||||
type: server
|
||||
@@ -915,7 +915,7 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 10.10.1.1
|
||||
dns_server: 8.8.8.2
|
||||
services:
|
||||
- type: FTPServer
|
||||
- type: ftp-server
|
||||
|
||||
- hostname: some_tech_hr_1
|
||||
type: computer
|
||||
@@ -924,10 +924,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 10.10.3.1
|
||||
dns_server: 8.8.8.2
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
- type: WebBrowser
|
||||
- type: web-browser
|
||||
options:
|
||||
target_url: http://sometech.ai
|
||||
|
||||
@@ -938,10 +938,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 10.10.2.1
|
||||
dns_server: 8.8.8.2
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
- type: WebBrowser
|
||||
- type: web-browser
|
||||
options:
|
||||
target_url: http://sometech.ai
|
||||
|
||||
@@ -952,10 +952,10 @@ Each node is configured to ensure it meets the specific security and operational
|
||||
default_gateway: 10.10.2.1
|
||||
dns_server: 8.8.8.2
|
||||
applications:
|
||||
- type: DatabaseClient
|
||||
- type: database-client
|
||||
options:
|
||||
db_server_ip: 10.10.1.11
|
||||
- type: WebBrowser
|
||||
- type: web-browser
|
||||
options:
|
||||
target_url: http://sometech.ai
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ An agent's reward can be based on rewards of other agents. This is particularly
|
||||
reward_components:
|
||||
|
||||
# When the webpage loads, the reward goes up by 0.25 when it fails to load, it goes down to -0.25
|
||||
- type: WEBPAGE_UNAVAILABLE_PENALTY
|
||||
- type: webpage-unavailable-penalty
|
||||
weight: 0.25
|
||||
options:
|
||||
node_hostname: client_2
|
||||
|
||||
# When the database is reachable, the reward goes up by 0.05, when it is unreachable it goes down to -0.05
|
||||
- type: GREEN_ADMIN_DATABASE_UNREACHABLE_PENALTY
|
||||
- type: green-admin-database-unreachable-penalty
|
||||
weight: 0.05
|
||||
options:
|
||||
node_hostname: client_2
|
||||
@@ -74,7 +74,7 @@ An agent's reward can be based on rewards of other agents. This is particularly
|
||||
reward_components:
|
||||
|
||||
# When the database file is in a good state, blue's reward is 0.4, when it's in a corrupted state the reward is -0.4
|
||||
- type: DATABASE_FILE_INTEGRITY
|
||||
- type: database-file-integrity
|
||||
weight: 0.40
|
||||
options:
|
||||
node_hostname: database_server
|
||||
@@ -82,7 +82,7 @@ An agent's reward can be based on rewards of other agents. This is particularly
|
||||
file_name: database.db
|
||||
|
||||
# The green's reward is added onto the blue's reward.
|
||||
- type: SHARED_REWARD
|
||||
- type: shared-reward
|
||||
weight: 1.0
|
||||
options:
|
||||
agent_name: client_2_green_user
|
||||
|
||||
@@ -20,7 +20,7 @@ Custom actions within PrimAITE must be a sub-class of `AbstractAction`, and cont
|
||||
|
||||
#. ConfigSchema class
|
||||
|
||||
#. Unique Identifier
|
||||
#. Unique discriminator
|
||||
|
||||
#. `form_request` method.
|
||||
|
||||
@@ -31,14 +31,14 @@ ConfigSchema
|
||||
The ConfigSchema sub-class of the action must contain all `configurable` variables within the action, that would be specified within the environments configuration YAML file.
|
||||
|
||||
|
||||
Unique Identifier
|
||||
Unique discriminator
|
||||
#################
|
||||
|
||||
When declaring a custom class, it must have a unique identifier string, that allows PrimAITE to generate the correct action when needed.
|
||||
When declaring a custom class, it must have a unique discriminator string, that allows PrimAITE to generate the correct action when needed.
|
||||
|
||||
.. code:: Python
|
||||
|
||||
class CreateDirectoryAction(AbstractAction, identifier="node_folder_create")
|
||||
class CreateDirectoryAction(AbstractAction, discriminator="node-folder-create")
|
||||
|
||||
config: CreateDirectoryAction.ConfigSchema
|
||||
|
||||
@@ -58,7 +58,7 @@ When declaring a custom class, it must have a unique identifier string, that all
|
||||
config.directory_name,
|
||||
]
|
||||
|
||||
The above action would fail pydantic validation as the identifier "node_folder_create" is already used by the `NodeFolderCreateAction`, and would create a duplicate listing within `AbstractAction._registry`.
|
||||
The above action would fail pydantic validation as the discriminator "node-folder-create" is already used by the `NodeFolderCreateAction`, and would create a duplicate listing within `AbstractAction._registry`.
|
||||
|
||||
|
||||
form_request method
|
||||
|
||||
@@ -25,7 +25,7 @@ The core features that should be implemented in any new agent are detailed below
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class ExampleAgent(AbstractAgent, identifier = "ExampleAgent"):
|
||||
class ExampleAgent(AbstractAgent, discriminator = "ExampleAgent"):
|
||||
"""An example agent for demonstration purposes."""
|
||||
|
||||
config: "ExampleAgent.ConfigSchema" = Field(default_factory= lambda: ExampleAgent.ConfigSchema())
|
||||
@@ -51,11 +51,11 @@ The core features that should be implemented in any new agent are detailed below
|
||||
action_space:
|
||||
action_map:
|
||||
0:
|
||||
action: do_nothing
|
||||
action: do-nothing
|
||||
options: {}
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: DUMMY
|
||||
- type: dummy
|
||||
|
||||
agent_settings:
|
||||
start_step: 25
|
||||
@@ -64,9 +64,9 @@ The core features that should be implemented in any new agent are detailed below
|
||||
starting_host: "Server_1"
|
||||
|
||||
|
||||
#. **Identifiers**:
|
||||
#. **discriminators**:
|
||||
|
||||
All agent classes should have an ``identifier`` attribute, a unique kebab-case string, for when they are added to the base ``AbstractAgent`` registry. This is then specified in your configuration YAML, and used by PrimAITE to generate the correct Agent.
|
||||
All agent classes should have an ``discriminator`` attribute, a unique kebab-case string, for when they are added to the base ``AbstractAgent`` registry. This is then specified in your configuration YAML, and used by PrimAITE to generate the correct Agent.
|
||||
|
||||
Changes to YAML file
|
||||
====================
|
||||
|
||||
@@ -17,7 +17,7 @@ Reward classes are inherited from AbstractReward (a sub-class of Pydantic's Base
|
||||
Within the reward class there is a ConfigSchema class responsible for ensuring the config file data
|
||||
is in the correct format. This also means there is little (if no) requirement for and `__init__`
|
||||
method. The `.from_config` method is no longer required as it's inherited from `AbstractReward`.
|
||||
Each class requires an identifier string which is used by the ConfigSchema class to verify that it
|
||||
Each class requires an discriminator string which is used by the ConfigSchema class to verify that it
|
||||
hasn't previously been added to the registry.
|
||||
|
||||
Inheriting from `BaseModel` removes the need for an `__init__` method but means that object
|
||||
@@ -28,7 +28,7 @@ To add a new reward class follow the example below. Note that the type attribute
|
||||
|
||||
.. code-block:: Python
|
||||
|
||||
class DatabaseFileIntegrity(AbstractReward, identifier="DATABASE_FILE_INTEGRITY"):
|
||||
class DatabaseFileIntegrity(AbstractReward, discriminator="database-file-integrity"):
|
||||
"""Reward function component which rewards the agent for maintaining the integrity of a database file."""
|
||||
|
||||
config: "DatabaseFileIntegrity.ConfigSchema"
|
||||
@@ -38,7 +38,7 @@ class DatabaseFileIntegrity(AbstractReward, identifier="DATABASE_FILE_INTEGRITY"
|
||||
class ConfigSchema(AbstractReward.ConfigSchema):
|
||||
"""ConfigSchema for DatabaseFileIntegrity."""
|
||||
|
||||
type: str = "DATABASE_FILE_INTEGRITY"
|
||||
type: str = "database-file-integrity"
|
||||
node_hostname: str
|
||||
folder_name: str
|
||||
file_name: str
|
||||
|
||||
@@ -55,7 +55,7 @@ Via YAML Config
|
||||
nodes:
|
||||
# ... nodes go here
|
||||
node_sets:
|
||||
- type: office_lan
|
||||
- type: office-lan
|
||||
lan_name: CORP_LAN
|
||||
subnet_base: 2
|
||||
pcs_ip_block_start: 10
|
||||
@@ -82,9 +82,9 @@ Here is an example of creating a custom node adder, DataCenterAdder:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class DataCenterAdder(NetworkNodeAdder, identifier="data_center"):
|
||||
class DataCenterAdder(NetworkNodeAdder, discriminator="data-center"):
|
||||
class ConfigSchema(NetworkNodeAdder.ConfigSchema):
|
||||
type: Literal["data_center"] = "data_center"
|
||||
type: Literal["data-center"] = "data-center"
|
||||
num_servers: int
|
||||
data_center_name: str
|
||||
|
||||
@@ -106,7 +106,7 @@ Here is an example of creating a custom node adder, DataCenterAdder:
|
||||
.. code-block:: python
|
||||
|
||||
config = {
|
||||
"type": "data_center",
|
||||
"type": "data-center",
|
||||
"num_servers": 5,
|
||||
"data_center_name": "dc1"
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ Request responses
|
||||
When the simulator receives a request, it returns a response with a success status. The possible statuses are:
|
||||
|
||||
* **success**: The request was received and successfully executed.
|
||||
* For example, the agent tries to add an ACL rule and specifies correct parameters, and the ACL rule is added successfully.
|
||||
* For example, the agent tries to add an acl rule and specifies correct parameters, and the acl rule is added successfully.
|
||||
|
||||
* **failure**: The request was received, but it could not be executed, or it failed while executing.
|
||||
* For example, the agent tries to execute the ``WebBrowser`` application, but the webpage wasn't retrieved because the DNS server is not setup on the node.
|
||||
* For example, the agent tries to execute the ``web-browser`` application, but the webpage wasn't retrieved because the DNS server is not setup on the node.
|
||||
|
||||
* **unreachable**: The request was sent to a simulation component that does not exist.
|
||||
* For example, the agent tries to scan a file that has not been created yet.
|
||||
|
||||
@@ -23,7 +23,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: DUMMY
|
||||
- type: dummy
|
||||
weight: 1.0
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: DATABASE_FILE_INTEGRITY
|
||||
- type: database-file-integrity
|
||||
weight: 1.0
|
||||
options:
|
||||
node_hostname: server_1
|
||||
@@ -53,7 +53,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: WEB_SERVER_404_PENALTY
|
||||
- type: web-server-404-penalty
|
||||
node_hostname: web_server
|
||||
weight: 1.0
|
||||
options:
|
||||
@@ -70,7 +70,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: WEBPAGE_UNAVAILABLE_PENALTY
|
||||
- type: webpage-unavailable-penalty
|
||||
node_hostname: computer_1
|
||||
weight: 1.0
|
||||
options:
|
||||
@@ -86,7 +86,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: GREEN_ADMIN_DATABASE_UNREACHABLE_PENALTY
|
||||
- type: green-admin-database-unreachable-penalty
|
||||
weight: 1.0
|
||||
options:
|
||||
node_hostname: admin_pc_1
|
||||
@@ -104,7 +104,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: SHARED_REWARD
|
||||
- type: shared-reward
|
||||
weight: 1.0
|
||||
options:
|
||||
agent_name: scripted_agent
|
||||
@@ -119,7 +119,7 @@ The following API pages describe the use of each reward component and the possib
|
||||
# ...
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: ACTION_PENALTY
|
||||
- type: action-penalty
|
||||
weight: 1.0
|
||||
options:
|
||||
action_penalty: -0.3
|
||||
|
||||
@@ -229,7 +229,7 @@ Via Configuration
|
||||
type: computer
|
||||
...
|
||||
applications:
|
||||
type: C2Server
|
||||
type: c2-server
|
||||
...
|
||||
hostname: computer_b
|
||||
type: computer
|
||||
@@ -238,7 +238,7 @@ Via Configuration
|
||||
# Either an agent must use application_execute.
|
||||
# Or a if using the simulation layer - .establish().
|
||||
applications:
|
||||
type: C2Beacon
|
||||
type: c2-beacon
|
||||
options:
|
||||
c2_server_ip_address: ...
|
||||
keep_alive_frequency: 5
|
||||
|
||||
@@ -95,7 +95,7 @@ If not using the data manipulation bot manually, it needs to be used with a data
|
||||
agents:
|
||||
- ref: data_manipulation_red_bot
|
||||
team: RED
|
||||
type: RedDatabaseCorruptingAgent
|
||||
type: red-database-corrupting-agent
|
||||
|
||||
observation_space:
|
||||
type: UC2RedObservation
|
||||
@@ -115,7 +115,7 @@ If not using the data manipulation bot manually, it needs to be used with a data
|
||||
action_space:
|
||||
reward_function:
|
||||
reward_components:
|
||||
- type: DUMMY
|
||||
- type: dummy
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
@@ -132,14 +132,14 @@ If not using the data manipulation bot manually, it needs to be used with a data
|
||||
# ... additional configuration here
|
||||
applications:
|
||||
- ref: data_manipulation_bot
|
||||
type: DataManipulationBot
|
||||
type: data-manipulation-bot
|
||||
options:
|
||||
port_scan_p_of_success: 0.1
|
||||
data_manipulation_p_of_success: 0.1
|
||||
payload: "DELETE"
|
||||
server_ip: 192.168.1.14
|
||||
- ref: web_server_database_client
|
||||
type: DatabaseClient
|
||||
type: database-client
|
||||
options:
|
||||
db_server_ip: 192.168.1.14
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ Via Configuration
|
||||
...
|
||||
applications:
|
||||
- ref: database_client
|
||||
type: DatabaseClient
|
||||
type: database-client
|
||||
options:
|
||||
db_server_ip: 192.168.0.1
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
.. _DoSBot:
|
||||
|
||||
DoSBot
|
||||
dos-bot
|
||||
######
|
||||
|
||||
The ``DoSBot`` is an implementation of a Denial of Service attack within the PrimAITE simulation.
|
||||
The ``dos-bot`` is an implementation of a Denial of Service attack within the PrimAITE simulation.
|
||||
This specifically simulates a `Slow Loris attack`_.
|
||||
|
||||
.. _Slow Loris Attack: https://en.wikipedia.org/wiki/Slowloris_(computer_security)
|
||||
@@ -15,20 +15,20 @@ This specifically simulates a `Slow Loris attack`_.
|
||||
Key features
|
||||
============
|
||||
|
||||
- Connects to the :ref:`DatabaseService` via the ``SoftwareManager``.
|
||||
- Makes many connections to the :ref:`DatabaseService` which ends up using up the available connections.
|
||||
- Connects to the :ref:`database-service` via the ``SoftwareManager``.
|
||||
- Makes many connections to the :ref:`database-service` which ends up using up the available connections.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
- Configure with target IP address and optional password.
|
||||
- use ``run`` to run the application_loop of DoSBot to begin attacks
|
||||
- DoSBot runs through different actions at each timestep
|
||||
- use ``run`` to run the application_loop of dos-bot to begin attacks
|
||||
- dos-bot runs through different actions at each timestep
|
||||
|
||||
Implementation
|
||||
==============
|
||||
|
||||
- Leverages :ref:`DatabaseClient` to create connections with :ref`DatabaseServer`.
|
||||
- Leverages :ref:`database-client` to create connections with :ref`DatabaseServer`.
|
||||
- Extends base Application class.
|
||||
|
||||
Examples
|
||||
@@ -42,7 +42,7 @@ Python
|
||||
from ipaddress import IPv4Address
|
||||
|
||||
from primaite.simulator.network.hardware.nodes.host.computer import Computer
|
||||
from primaite.simulator.system.applications.red_applications.dos_bot import DoSBot
|
||||
from primaite.simulator.system.applications.red_applications.dos_bot import dos-bot
|
||||
|
||||
# Create Computer
|
||||
computer = Computer(
|
||||
@@ -54,11 +54,11 @@ Python
|
||||
)
|
||||
computer.power_on()
|
||||
|
||||
# Install DoSBot on computer
|
||||
computer.software_manager.install(DoSBot)
|
||||
dos_bot: DoSBot = computer.software_manager.software.get("DoSBot")
|
||||
# Install dos-bot on computer
|
||||
computer.software_manager.install(dos-bot)
|
||||
dos_bot: dos-bot = computer.software_manager.software.get("dos-bot")
|
||||
|
||||
# Configure the DoSBot
|
||||
# Configure the dos-bot
|
||||
dos_bot.configure(
|
||||
target_ip_address=IPv4Address("192.168.0.10"),
|
||||
payload="SPOOF DATA",
|
||||
@@ -68,7 +68,7 @@ Python
|
||||
max_sessions=1000
|
||||
)
|
||||
|
||||
# run DoSBot
|
||||
# run dos-bot
|
||||
dos_bot.run()
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ Via Configuration
|
||||
...
|
||||
applications:
|
||||
- ref: dos_bot
|
||||
type: DoSBot
|
||||
type: dos-bot
|
||||
options:
|
||||
target_ip_address: 192.168.0.10
|
||||
payload: SPOOF DATA
|
||||
@@ -101,7 +101,7 @@ Configuration
|
||||
``target_ip_address``
|
||||
"""""""""""""""""""""
|
||||
|
||||
IP address of the :ref:`DatabaseService` which the ``DataManipulationBot`` will try to attack.
|
||||
IP address of the :ref:`database-service` which the ``data-manipulation-bot`` will try to attack.
|
||||
|
||||
This must be a valid octet i.e. in the range of ``0.0.0.0`` and ``255.255.255.255``.
|
||||
|
||||
@@ -119,7 +119,7 @@ See :ref:`List of IPProtocols <List of IPProtocols>` for a list of protocols.
|
||||
|
||||
Optional. Default value is ``None``.
|
||||
|
||||
The payload that the ``DoSBot`` sends as part of its attack.
|
||||
The payload that the ``dos-bot`` sends as part of its attack.
|
||||
|
||||
.. include:: ../common/db_payload_list.rst
|
||||
|
||||
@@ -128,14 +128,14 @@ The payload that the ``DoSBot`` sends as part of its attack.
|
||||
|
||||
Optional. Default value is ``False``.
|
||||
|
||||
If ``True`` the ``DoSBot`` will maintain its attack.
|
||||
If ``True`` the ``dos-bot`` will maintain its attack.
|
||||
|
||||
``port_scan_p_of_success``
|
||||
""""""""""""""""""""""""""
|
||||
|
||||
Optional. Default value is ``0.1``.
|
||||
|
||||
The chance of the ``DoSBot`` to succeed with a port scan (and therefore continue the attack).
|
||||
The chance of the ``dos-bot`` to succeed with a port scan (and therefore continue the attack).
|
||||
|
||||
This must be a float value between ``0`` and ``1``.
|
||||
|
||||
@@ -153,7 +153,7 @@ This must be a float value between ``0`` and ``1``.
|
||||
|
||||
Optional. Default value is ``1000``.
|
||||
|
||||
The maximum number of sessions the ``DoSBot`` is able to make.
|
||||
The maximum number of sessions the ``dos-bot`` is able to make.
|
||||
|
||||
This must be an integer value equal to or greater than ``0``.
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ Via Configuration
|
||||
...
|
||||
applications:
|
||||
- ref: web_browser
|
||||
type: WebBrowser
|
||||
type: web-browser
|
||||
options:
|
||||
target_url: http://arcd.com/
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: database_service
|
||||
type: DatabaseService
|
||||
type: database-service
|
||||
options:
|
||||
backup_server_ip: 192.168.0.10
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: dns_client
|
||||
type: DNSClient
|
||||
type: dns-client
|
||||
options:
|
||||
dns_server: 192.168.0.10
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: dns_server
|
||||
type: DNSServer
|
||||
type: dns-server
|
||||
options:
|
||||
domain_mapping:
|
||||
arcd.com: 192.168.0.10
|
||||
|
||||
@@ -78,7 +78,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: ftp_client
|
||||
type: FTPClient
|
||||
type: ftp-client
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
@@ -74,7 +74,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: ftp_server
|
||||
type: FTPServer
|
||||
type: ftp-server
|
||||
options:
|
||||
server_password: test
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: ntp_client
|
||||
type: NTPClient
|
||||
type: ntp-client
|
||||
options:
|
||||
ntp_server_ip: 192.168.0.10
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: ntp_server
|
||||
type: NTPServer
|
||||
type: ntp-server
|
||||
|
||||
|
||||
``Common Attributes``
|
||||
|
||||
@@ -73,7 +73,7 @@ Via Configuration
|
||||
...
|
||||
services:
|
||||
- ref: web_server
|
||||
type: WebServer
|
||||
type: web-server
|
||||
|
||||
|
||||
``Common Attributes``
|
||||
|
||||
Reference in New Issue
Block a user