#915 - Synced with dev to bring in changes from #898

This commit is contained in:
Chris McCarthy
2023-06-09 13:11:14 +01:00
parent 9b4ed1199b
commit af4e71db9b
14 changed files with 510 additions and 504 deletions

View File

@@ -296,15 +296,15 @@ The Lay Down Config
The lay down config file consists of the following attributes: The lay down config file consists of the following attributes:
* **itemType: PORTS** [int] * **item_type: PORTS** [int]
Provides a list of ports modelled in this session Provides a list of ports modelled in this session
* **itemType: SERVICES** [freetext] * **item_type: SERVICES** [freetext]
Provides a list of services modelled in this session Provides a list of services modelled in this session
* **itemType: NODE** * **item_type: NODE**
Defines a node included in the system laydown being simulated. It should consist of the following attributes: Defines a node included in the system laydown being simulated. It should consist of the following attributes:
@@ -323,7 +323,7 @@ The lay down config file consists of the following attributes:
* **port** [int]: Integer value of the port related to this service, but must match one of the ports defined for the system in the ports list * **port** [int]: Integer value of the port related to this service, but must match one of the ports defined for the system in the ports list
* **state** [enum]: The initial state of the service. Can be one of GOOD, PATCHING, COMPROMISED or OVERWHELMED * **state** [enum]: The initial state of the service. Can be one of GOOD, PATCHING, COMPROMISED or OVERWHELMED
* **itemType: LINK** * **item_type: LINK**
Defines a link included in the system laydown being simulated. It should consist of the following attributes: Defines a link included in the system laydown being simulated. It should consist of the following attributes:
@@ -333,53 +333,53 @@ The lay down config file consists of the following attributes:
* **source** [int]: The ID of the source node * **source** [int]: The ID of the source node
* **destination** [int]: The ID of the destination node * **destination** [int]: The ID of the destination node
* **itemType: GREEN_IER** * **item_type: GREEN_IER**
Defines a green agent Information Exchange Requirement (IER). It should consist of: Defines a green agent Information Exchange Requirement (IER). It should consist of:
* **id** [int]: Unique ID for this YAML item * **id** [int]: Unique ID for this YAML item
* **startStep** [int]: The start step (in the episode) for this IER to begin * **start_step** [int]: The start step (in the episode) for this IER to begin
* **endStep** [int]: The end step (in the episode) for this IER to finish * **end_step** [int]: The end step (in the episode) for this IER to finish
* **load** [int]: The load (in bits/s) for this IER to apply to links * **load** [int]: The load (in bits/s) for this IER to apply to links
* **protocol** [freetext]: The protocol to apply to the links. This must match a value in the services list * **protocol** [freetext]: The protocol to apply to the links. This must match a value in the services list
* **port** [int]: The port that the protocol is running on. This must match a value in the ports list * **port** [int]: The port that the protocol is running on. This must match a value in the ports list
* **source** [int]: The ID of the source node * **source** [int]: The ID of the source node
* **destination** [int]: The ID of the destination node * **destination** [int]: The ID of the destination node
* **missionCriticality** [enum]: The mission criticality of this IER (with 5 being highest, 1 lowest) * **mission_criticality** [enum]: The mission criticality of this IER (with 5 being highest, 1 lowest)
* **itemType: RED_IER** * **item_type: RED_IER**
Defines a red agent Information Exchange Requirement (IER). It should consist of: Defines a red agent Information Exchange Requirement (IER). It should consist of:
* **id** [int]: Unique ID for this YAML item * **id** [int]: Unique ID for this YAML item
* **startStep** [int]: The start step (in the episode) for this IER to begin * **start_step** [int]: The start step (in the episode) for this IER to begin
* **endStep** [int]: The end step (in the episode) for this IER to finish * **end_step** [int]: The end step (in the episode) for this IER to finish
* **load** [int]: The load (in bits/s) for this IER to apply to links * **load** [int]: The load (in bits/s) for this IER to apply to links
* **protocol** [freetext]: The protocol to apply to the links. This must match a value in the services list * **protocol** [freetext]: The protocol to apply to the links. This must match a value in the services list
* **port** [int]: The port that the protocol is running on. This must match a value in the ports list * **port** [int]: The port that the protocol is running on. This must match a value in the ports list
* **source** [int]: The ID of the source node * **source** [int]: The ID of the source node
* **destination** [int]: The ID of the destination node * **destination** [int]: The ID of the destination node
* **missionCriticality** [enum]: Not currently used. Default to 0 * **mission_criticality** [enum]: Not currently used. Default to 0
* **itemType: GREEN_POL** * **item_type: GREEN_POL**
Defines a green agent pattern-of-life instruction. It should consist of: Defines a green agent pattern-of-life instruction. It should consist of:
* **id** [int]: Unique ID for this YAML item * **id** [int]: Unique ID for this YAML item
* **startStep** [int]: The start step (in the episode) for this PoL to begin * **start_step** [int]: The start step (in the episode) for this PoL to begin
* **endStep** [int]: Not currently used. Default to same as start step * **end_step** [int]: Not currently used. Default to same as start step
* **nodeId** [int]: The ID of the node to apply the PoL to * **nodeId** [int]: The ID of the node to apply the PoL to
* **type** [enum]: The type of PoL to apply. Can be one of OPERATING, OS or SERVICE * **type** [enum]: The type of PoL to apply. Can be one of OPERATING, OS or SERVICE
* **protocol** [freetext]: The protocol to be affected if SERVICE type is chosen. Must match a value in the services list * **protocol** [freetext]: The protocol to be affected if SERVICE type is chosen. Must match a value in the services list
* **state** [enuum]: The state to apply to the node (which represents the PoL change). Can be one of ON, OFF or RESETTING (for node state) or GOOD, PATCHING or COMPROMISED (for Software State) or GOOD, PATCHING, COMPROMISED or OVERWHELMED (for service state) * **state** [enuum]: The state to apply to the node (which represents the PoL change). Can be one of ON, OFF or RESETTING (for node state) or GOOD, PATCHING or COMPROMISED (for Software State) or GOOD, PATCHING, COMPROMISED or OVERWHELMED (for service state)
* **itemType: RED_POL** * **item_type: RED_POL**
Defines a red agent pattern-of-life instruction. It should consist of: Defines a red agent pattern-of-life instruction. It should consist of:
* **id** [int]: Unique ID for this YAML item * **id** [int]: Unique ID for this YAML item
* **startStep** [int]: The start step (in the episode) for this PoL to begin * **start_step** [int]: The start step (in the episode) for this PoL to begin
* **endStep** [int]: Not currently used. Default to same as start step * **end_step** [int]: Not currently used. Default to same as start step
* **targetNodeId** [int]: The ID of the node to apply the PoL to * **targetNodeId** [int]: The ID of the node to apply the PoL to
* **initiator** [enum]: What initiates the PoL. Can be DIRECT, IER or SERVICE * **initiator** [enum]: What initiates the PoL. Can be DIRECT, IER or SERVICE
* **type** [enum]: The type of PoL to apply. Can be one of OPERATING, OS or SERVICE * **type** [enum]: The type of PoL to apply. Can be one of OPERATING, OS or SERVICE
@@ -389,7 +389,7 @@ The lay down config file consists of the following attributes:
* **sourceNodeService** [freetext]: The service on the source node to check (used for SERVICE initiator). Must match a value in the services list for this node * **sourceNodeService** [freetext]: The service on the source node to check (used for SERVICE initiator). Must match a value in the services list for this node
* **sourceNodeServiceState** [enum]: The state of the source node service to check (used for SERVICE initiator). Can be one of GOOD, PATCHING, COMPROMISED or OVERWHELMED * **sourceNodeServiceState** [enum]: The state of the source node service to check (used for SERVICE initiator). Can be one of GOOD, PATCHING, COMPROMISED or OVERWHELMED
* **itemType: ACL_RULE** * **item_type: ACL_RULE**
Defines an initial Access Control List (ACL) rule. It should consist of: Defines an initial Access Control List (ACL) rule. It should consist of:

View File

@@ -64,8 +64,8 @@ _FILE_HANDLER: Final[RotatingFileHandler] = RotatingFileHandler(
backupCount=9, # Max 100MB of logs backupCount=9, # Max 100MB of logs
encoding="utf8", encoding="utf8",
) )
_STREAM_HANDLER.setLevel(logging.INFO) _STREAM_HANDLER.setLevel(logging.DEBUG)
_FILE_HANDLER.setLevel(logging.INFO) _FILE_HANDLER.setLevel(logging.DEBUG)
_LOG_FORMAT_STR: Final[ _LOG_FORMAT_STR: Final[
str str
@@ -88,7 +88,7 @@ def getLogger(name: str) -> Logger:
logging config. logging config.
""" """
logger = logging.getLogger(name) logger = logging.getLogger(name)
logger.setLevel(logging.INFO) logger.setLevel(logging.DEBUG)
return logger return logger

View File

@@ -1,14 +1,14 @@
- itemType: ACTIONS - item_type: ACTIONS
type: NODE type: NODE
- itemType: STEPS - item_type: STEPS
steps: 128 steps: 128
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '80' - port: '80'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: PC1 name: PC1
node_class: SERVICE node_class: SERVICE
@@ -22,7 +22,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: SERVER name: SERVER
node_class: SERVICE node_class: SERVICE
@@ -36,7 +36,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: PC2 name: PC2
node_class: SERVICE node_class: SERVICE
@@ -50,7 +50,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '4' node_id: '4'
name: SWITCH1 name: SWITCH1
node_class: ACTIVE node_class: ACTIVE
@@ -60,7 +60,7 @@
ip_address: 192.168.1.5 ip_address: 192.168.1.5
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '5' node_id: '5'
name: SWITCH2 name: SWITCH2
node_class: ACTIVE node_class: ACTIVE
@@ -70,7 +70,7 @@
ip_address: 192.168.1.6 ip_address: 192.168.1.6
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '6' node_id: '6'
name: SWITCH3 name: SWITCH3
node_class: ACTIVE node_class: ACTIVE
@@ -80,56 +80,56 @@
ip_address: 192.168.1.7 ip_address: 192.168.1.7
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: LINK - item_type: LINK
id: '7' id: '7'
name: link1 name: link1
bandwidth: 1000000000 bandwidth: 1000000000
source: '1' source: '1'
destination: '4' destination: '4'
- itemType: LINK - item_type: LINK
id: '8' id: '8'
name: link2 name: link2
bandwidth: 1000000000 bandwidth: 1000000000
source: '4' source: '4'
destination: '2' destination: '2'
- itemType: LINK - item_type: LINK
id: '9' id: '9'
name: link3 name: link3
bandwidth: 1000000000 bandwidth: 1000000000
source: '2' source: '2'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '10' id: '10'
name: link4 name: link4
bandwidth: 1000000000 bandwidth: 1000000000
source: '2' source: '2'
destination: '6' destination: '6'
- itemType: LINK - item_type: LINK
id: '11' id: '11'
name: link5 name: link5
bandwidth: 1000000000 bandwidth: 1000000000
source: '5' source: '5'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '12' id: '12'
name: link6 name: link6
bandwidth: 1000000000 bandwidth: 1000000000
source: '6' source: '6'
destination: '3' destination: '3'
- itemType: GREEN_IER - item_type: GREEN_IER
id: '13' id: '13'
startStep: 1 start_step: 1
endStep: 128 end_step: 128
load: 100000 load: 100000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '3' source: '3'
destination: '2' destination: '2'
missionCriticality: 5 mission_criticality: 5
- itemType: RED_POL - item_type: RED_POL
id: '14' id: '14'
startStep: 50 start_step: 50
endStep: 50 end_step: 50
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -138,20 +138,20 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_IER - item_type: RED_IER
id: '15' id: '15'
startStep: 60 start_step: 60
endStep: 100 end_step: 100
load: 1000000 load: 1000000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '2' destination: '2'
missionCriticality: 0 mission_criticality: 0
- itemType: RED_POL - item_type: RED_POL
id: '16' id: '16'
startStep: 80 start_step: 80
endStep: 80 end_step: 80
targetNodeId: '2' targetNodeId: '2'
initiator: IER initiator: IER
type: SERVICE type: SERVICE
@@ -160,7 +160,7 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: ACL_RULE - item_type: ACL_RULE
id: '17' id: '17'
permission: ALLOW permission: ALLOW
source: ANY source: ANY

View File

@@ -1,14 +1,14 @@
- itemType: ACTIONS - item_type: ACTIONS
type: NODE type: NODE
- itemType: STEPS - item_type: STEPS
steps: 128 steps: 128
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '80' - port: '80'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: PC1 name: PC1
node_class: SERVICE node_class: SERVICE
@@ -22,7 +22,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: PC2 name: PC2
node_class: SERVICE node_class: SERVICE
@@ -36,7 +36,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: PC3 name: PC3
node_class: SERVICE node_class: SERVICE
@@ -50,7 +50,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '4' node_id: '4'
name: PC4 name: PC4
node_class: SERVICE node_class: SERVICE
@@ -64,7 +64,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '5' node_id: '5'
name: SWITCH1 name: SWITCH1
node_class: ACTIVE node_class: ACTIVE
@@ -74,7 +74,7 @@
ip_address: 192.168.1.2 ip_address: 192.168.1.2
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '6' node_id: '6'
name: IDS name: IDS
node_class: SERVICE node_class: SERVICE
@@ -88,7 +88,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '7' node_id: '7'
name: SWITCH2 name: SWITCH2
node_class: ACTIVE node_class: ACTIVE
@@ -98,7 +98,7 @@
ip_address: 192.168.1.3 ip_address: 192.168.1.3
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '8' node_id: '8'
name: LOP1 name: LOP1
node_class: SERVICE node_class: SERVICE
@@ -112,7 +112,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '9' node_id: '9'
name: SERVER1 name: SERVER1
node_class: SERVICE node_class: SERVICE
@@ -126,7 +126,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '10' node_id: '10'
name: SERVER2 name: SERVER2
node_class: SERVICE node_class: SERVICE
@@ -140,173 +140,173 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: LINK - item_type: LINK
id: '11' id: '11'
name: link1 name: link1
bandwidth: 1000000000 bandwidth: 1000000000
source: '1' source: '1'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '12' id: '12'
name: link2 name: link2
bandwidth: 1000000000 bandwidth: 1000000000
source: '2' source: '2'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '13' id: '13'
name: link3 name: link3
bandwidth: 1000000000 bandwidth: 1000000000
source: '3' source: '3'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '14' id: '14'
name: link4 name: link4
bandwidth: 1000000000 bandwidth: 1000000000
source: '4' source: '4'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '15' id: '15'
name: link5 name: link5
bandwidth: 1000000000 bandwidth: 1000000000
source: '5' source: '5'
destination: '6' destination: '6'
- itemType: LINK - item_type: LINK
id: '16' id: '16'
name: link6 name: link6
bandwidth: 1000000000 bandwidth: 1000000000
source: '5' source: '5'
destination: '8' destination: '8'
- itemType: LINK - item_type: LINK
id: '17' id: '17'
name: link7 name: link7
bandwidth: 1000000000 bandwidth: 1000000000
source: '6' source: '6'
destination: '7' destination: '7'
- itemType: LINK - item_type: LINK
id: '18' id: '18'
name: link8 name: link8
bandwidth: 1000000000 bandwidth: 1000000000
source: '8' source: '8'
destination: '7' destination: '7'
- itemType: LINK - item_type: LINK
id: '19' id: '19'
name: link9 name: link9
bandwidth: 1000000000 bandwidth: 1000000000
source: '7' source: '7'
destination: '9' destination: '9'
- itemType: LINK - item_type: LINK
id: '20' id: '20'
name: link10 name: link10
bandwidth: 1000000000 bandwidth: 1000000000
source: '7' source: '7'
destination: '10' destination: '10'
- itemType: GREEN_IER - item_type: GREEN_IER
id: '21' id: '21'
startStep: 1 start_step: 1
endStep: 128 end_step: 128
load: 100000 load: 100000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '9' destination: '9'
missionCriticality: 2 mission_criticality: 2
- itemType: GREEN_IER - item_type: GREEN_IER
id: '22' id: '22'
startStep: 1 start_step: 1
endStep: 128 end_step: 128
load: 100000 load: 100000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '2' source: '2'
destination: '9' destination: '9'
missionCriticality: 2 mission_criticality: 2
- itemType: GREEN_IER - item_type: GREEN_IER
id: '23' id: '23'
startStep: 1 start_step: 1
endStep: 128 end_step: 128
load: 100000 load: 100000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '9' source: '9'
destination: '3' destination: '3'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '24' id: '24'
startStep: 1 start_step: 1
endStep: 128 end_step: 128
load: 100000 load: 100000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '4' source: '4'
destination: '10' destination: '10'
missionCriticality: 2 mission_criticality: 2
- itemType: ACL_RULE - item_type: ACL_RULE
id: '25' id: '25'
permission: ALLOW permission: ALLOW
source: 192.168.10.11 source: 192.168.10.11
destination: 192.168.10.14 destination: 192.168.10.14
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '26' id: '26'
permission: ALLOW permission: ALLOW
source: 192.168.10.12 source: 192.168.10.12
destination: 192.168.10.14 destination: 192.168.10.14
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '27' id: '27'
permission: ALLOW permission: ALLOW
source: 192.168.10.13 source: 192.168.10.13
destination: 192.168.10.14 destination: 192.168.10.14
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '28' id: '28'
permission: ALLOW permission: ALLOW
source: 192.168.20.14 source: 192.168.20.14
destination: 192.168.20.15 destination: 192.168.20.15
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '29' id: '29'
permission: ALLOW permission: ALLOW
source: 192.168.10.14 source: 192.168.10.14
destination: 192.168.10.13 destination: 192.168.10.13
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '30' id: '30'
permission: DENY permission: DENY
source: 192.168.10.11 source: 192.168.10.11
destination: 192.168.20.15 destination: 192.168.20.15
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '31' id: '31'
permission: DENY permission: DENY
source: 192.168.10.12 source: 192.168.10.12
destination: 192.168.20.15 destination: 192.168.20.15
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '32' id: '32'
permission: DENY permission: DENY
source: 192.168.10.13 source: 192.168.10.13
destination: 192.168.20.15 destination: 192.168.20.15
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '33' id: '33'
permission: DENY permission: DENY
source: 192.168.20.14 source: 192.168.20.14
destination: 192.168.10.14 destination: 192.168.10.14
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: RED_POL - item_type: RED_POL
id: '34' id: '34'
startStep: 20 start_step: 20
endStep: 20 end_step: 20
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -315,10 +315,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '35' id: '35'
startStep: 20 start_step: 20
endStep: 20 end_step: 20
targetNodeId: '2' targetNodeId: '2'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -327,30 +327,30 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_IER - item_type: RED_IER
id: '36' id: '36'
startStep: 30 start_step: 30
endStep: 128 end_step: 128
load: 440000000 load: 440000000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '9' destination: '9'
missionCriticality: 0 mission_criticality: 0
- itemType: RED_IER - item_type: RED_IER
id: '37' id: '37'
startStep: 30 start_step: 30
endStep: 128 end_step: 128
load: 440000000 load: 440000000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '2' source: '2'
destination: '9' destination: '9'
missionCriticality: 0 mission_criticality: 0
- itemType: RED_POL - item_type: RED_POL
id: '38' id: '38'
startStep: 30 start_step: 30
endStep: 30 end_step: 30
targetNodeId: '9' targetNodeId: '9'
initiator: IER initiator: IER
type: SERVICE type: SERVICE

View File

@@ -1,14 +1,14 @@
- itemType: ACTIONS - item_type: ACTIONS
type: NODE type: NODE
- itemType: STEPS - item_type: STEPS
steps: 256 steps: 256
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '80' - port: '80'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: PC1 name: PC1
node_class: SERVICE node_class: SERVICE
@@ -22,7 +22,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: PC2 name: PC2
node_class: SERVICE node_class: SERVICE
@@ -36,7 +36,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: SWITCH1 name: SWITCH1
node_class: ACTIVE node_class: ACTIVE
@@ -46,7 +46,7 @@
ip_address: 192.168.1.1 ip_address: 192.168.1.1
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '4' node_id: '4'
name: SERVER1 name: SERVER1
node_class: SERVICE node_class: SERVICE
@@ -60,79 +60,79 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: LINK - item_type: LINK
id: '5' id: '5'
name: link1 name: link1
bandwidth: 1000000000 bandwidth: 1000000000
source: '1' source: '1'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '6' id: '6'
name: link2 name: link2
bandwidth: 1000000000 bandwidth: 1000000000
source: '2' source: '2'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '7' id: '7'
name: link3 name: link3
bandwidth: 1000000000 bandwidth: 1000000000
source: '3' source: '3'
destination: '4' destination: '4'
- itemType: GREEN_IER - item_type: GREEN_IER
id: '8' id: '8'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '4' destination: '4'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '9' id: '9'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '2' source: '2'
destination: '4' destination: '4'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '10' id: '10'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '4' source: '4'
destination: '2' destination: '2'
missionCriticality: 5 mission_criticality: 5
- itemType: ACL_RULE - item_type: ACL_RULE
id: '11' id: '11'
permission: ALLOW permission: ALLOW
source: 192.168.1.2 source: 192.168.1.2
destination: 192.168.1.4 destination: 192.168.1.4
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '12' id: '12'
permission: ALLOW permission: ALLOW
source: 192.168.1.3 source: 192.168.1.3
destination: 192.168.1.4 destination: 192.168.1.4
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: ACL_RULE - item_type: ACL_RULE
id: '13' id: '13'
permission: ALLOW permission: ALLOW
source: 192.168.1.4 source: 192.168.1.4
destination: 192.168.1.3 destination: 192.168.1.3
protocol: TCP protocol: TCP
port: 80 port: 80
- itemType: RED_POL - item_type: RED_POL
id: '14' id: '14'
startStep: 20 start_step: 20
endStep: 20 end_step: 20
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -141,20 +141,20 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_IER - item_type: RED_IER
id: '15' id: '15'
startStep: 30 start_step: 30
endStep: 256 end_step: 256
load: 10000000 load: 10000000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '4' destination: '4'
missionCriticality: 0 mission_criticality: 0
- itemType: RED_POL - item_type: RED_POL
id: '16' id: '16'
startStep: 40 start_step: 40
endStep: 40 end_step: 40
targetNodeId: '4' targetNodeId: '4'
initiator: IER initiator: IER
type: SERVICE type: SERVICE

View File

@@ -1,15 +1,14 @@
- item_type: PORTS
- itemType: PORTS ports_list:
portsList:
- port: '80' - port: '80'
- port: '1433' - port: '1433'
- port: '53' - port: '53'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
- name: TCP_SQL - name: TCP_SQL
- name: UDP - name: UDP
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: CLIENT_1 name: CLIENT_1
node_class: SERVICE node_class: SERVICE
@@ -26,7 +25,7 @@
- name: UDP - name: UDP
port: '53' port: '53'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: CLIENT_2 name: CLIENT_2
node_class: SERVICE node_class: SERVICE
@@ -40,7 +39,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: SWITCH_1 name: SWITCH_1
node_class: ACTIVE node_class: ACTIVE
@@ -50,7 +49,7 @@
ip_address: 192.168.10.1 ip_address: 192.168.10.1
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '4' node_id: '4'
name: SECURITY_SUITE name: SECURITY_SUITE
node_class: SERVICE node_class: SERVICE
@@ -67,7 +66,7 @@
- name: UDP - name: UDP
port: '53' port: '53'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '5' node_id: '5'
name: MANAGEMENT_CONSOLE name: MANAGEMENT_CONSOLE
node_class: SERVICE node_class: SERVICE
@@ -84,7 +83,7 @@
- name: UDP - name: UDP
port: '53' port: '53'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '6' node_id: '6'
name: SWITCH_2 name: SWITCH_2
node_class: ACTIVE node_class: ACTIVE
@@ -94,7 +93,7 @@
ip_address: 192.168.2.1 ip_address: 192.168.2.1
software_state: GOOD software_state: GOOD
file_system_state: GOOD file_system_state: GOOD
- itemType: NODE - item_type: NODE
node_id: '7' node_id: '7'
name: WEB_SERVER name: WEB_SERVER
node_class: SERVICE node_class: SERVICE
@@ -111,7 +110,7 @@
- name: TCP_SQL - name: TCP_SQL
port: '1433' port: '1433'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '8' node_id: '8'
name: DATABASE_SERVER name: DATABASE_SERVER
node_class: SERVICE node_class: SERVICE
@@ -131,7 +130,7 @@
- name: UDP - name: UDP
port: '53' port: '53'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '9' node_id: '9'
name: BACKUP_SERVER name: BACKUP_SERVER
node_class: SERVICE node_class: SERVICE
@@ -145,323 +144,323 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: LINK - item_type: LINK
id: '10' id: '10'
name: LINK_1 name: LINK_1
bandwidth: 1000000000 bandwidth: 1000000000
source: '1' source: '1'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '11' id: '11'
name: LINK_2 name: LINK_2
bandwidth: 1000000000 bandwidth: 1000000000
source: '2' source: '2'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '12' id: '12'
name: LINK_3 name: LINK_3
bandwidth: 1000000000 bandwidth: 1000000000
source: '3' source: '3'
destination: '4' destination: '4'
- itemType: LINK - item_type: LINK
id: '13' id: '13'
name: LINK_4 name: LINK_4
bandwidth: 1000000000 bandwidth: 1000000000
source: '3' source: '3'
destination: '5' destination: '5'
- itemType: LINK - item_type: LINK
id: '14' id: '14'
name: LINK_5 name: LINK_5
bandwidth: 1000000000 bandwidth: 1000000000
source: '4' source: '4'
destination: '6' destination: '6'
- itemType: LINK - item_type: LINK
id: '15' id: '15'
name: LINK_6 name: LINK_6
bandwidth: 1000000000 bandwidth: 1000000000
source: '5' source: '5'
destination: '6' destination: '6'
- itemType: LINK - item_type: LINK
id: '16' id: '16'
name: LINK_7 name: LINK_7
bandwidth: 1000000000 bandwidth: 1000000000
source: '6' source: '6'
destination: '7' destination: '7'
- itemType: LINK - item_type: LINK
id: '17' id: '17'
name: LINK_8 name: LINK_8
bandwidth: 1000000000 bandwidth: 1000000000
source: '6' source: '6'
destination: '8' destination: '8'
- itemType: LINK - item_type: LINK
id: '18' id: '18'
name: LINK_9 name: LINK_9
bandwidth: 1000000000 bandwidth: 1000000000
source: '6' source: '6'
destination: '9' destination: '9'
- itemType: GREEN_IER - item_type: GREEN_IER
id: '19' id: '19'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '7' destination: '7'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '20' id: '20'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '7' source: '7'
destination: '1' destination: '1'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '21' id: '21'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '2' source: '2'
destination: '7' destination: '7'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '22' id: '22'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 10000 load: 10000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '7' source: '7'
destination: '2' destination: '2'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '23' id: '23'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP_SQL protocol: TCP_SQL
port: '1433' port: '1433'
source: '7' source: '7'
destination: '8' destination: '8'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '24' id: '24'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 100000 load: 100000
protocol: TCP_SQL protocol: TCP_SQL
port: '1433' port: '1433'
source: '8' source: '8'
destination: '7' destination: '7'
missionCriticality: 5 mission_criticality: 5
- itemType: GREEN_IER - item_type: GREEN_IER
id: '25' id: '25'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 50000 load: 50000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '1' source: '1'
destination: '9' destination: '9'
missionCriticality: 2 mission_criticality: 2
- itemType: GREEN_IER - item_type: GREEN_IER
id: '26' id: '26'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 50000 load: 50000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '2' source: '2'
destination: '9' destination: '9'
missionCriticality: 2 mission_criticality: 2
- itemType: GREEN_IER - item_type: GREEN_IER
id: '27' id: '27'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '5' source: '5'
destination: '7' destination: '7'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '28' id: '28'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '7' source: '7'
destination: '5' destination: '5'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '29' id: '29'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '5' source: '5'
destination: '8' destination: '8'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '30' id: '30'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '8' source: '8'
destination: '5' destination: '5'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '31' id: '31'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '5' source: '5'
destination: '9' destination: '9'
missionCriticality: 1 mission_criticality: 1
- itemType: GREEN_IER - item_type: GREEN_IER
id: '32' id: '32'
startStep: 1 start_step: 1
endStep: 256 end_step: 256
load: 5000 load: 5000
protocol: TCP protocol: TCP
port: '80' port: '80'
source: '9' source: '9'
destination: '5' destination: '5'
missionCriticality: 1 mission_criticality: 1
- itemType: ACL_RULE - item_type: ACL_RULE
id: '33' id: '33'
permission: ALLOW permission: ALLOW
source: 192.168.10.11 source: 192.168.10.11
destination: 192.168.2.10 destination: 192.168.2.10
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '34' id: '34'
permission: ALLOW permission: ALLOW
source: 192.168.10.11 source: 192.168.10.11
destination: 192.168.2.14 destination: 192.168.2.14
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '35' id: '35'
permission: ALLOW permission: ALLOW
source: 192.168.10.12 source: 192.168.10.12
destination: 192.168.2.14 destination: 192.168.2.14
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '36' id: '36'
permission: ALLOW permission: ALLOW
source: 192.168.10.12 source: 192.168.10.12
destination: 192.168.2.10 destination: 192.168.2.10
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '37' id: '37'
permission: ALLOW permission: ALLOW
source: 192.168.2.10 source: 192.168.2.10
destination: 192.168.10.11 destination: 192.168.10.11
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '38' id: '38'
permission: ALLOW permission: ALLOW
source: 192.168.2.10 source: 192.168.2.10
destination: 192.168.10.12 destination: 192.168.10.12
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '39' id: '39'
permission: ALLOW permission: ALLOW
source: 192.168.2.10 source: 192.168.2.10
destination: 192.168.2.14 destination: 192.168.2.14
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '40' id: '40'
permission: ALLOW permission: ALLOW
source: 192.168.2.14 source: 192.168.2.14
destination: 192.168.2.10 destination: 192.168.2.10
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '41' id: '41'
permission: ALLOW permission: ALLOW
source: 192.168.10.11 source: 192.168.10.11
destination: 192.168.2.16 destination: 192.168.2.16
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '42' id: '42'
permission: ALLOW permission: ALLOW
source: 192.168.10.12 source: 192.168.10.12
destination: 192.168.2.16 destination: 192.168.2.16
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '43' id: '43'
permission: ALLOW permission: ALLOW
source: 192.168.1.12 source: 192.168.1.12
destination: 192.168.2.10 destination: 192.168.2.10
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '44' id: '44'
permission: ALLOW permission: ALLOW
source: 192.168.1.12 source: 192.168.1.12
destination: 192.168.2.14 destination: 192.168.2.14
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '45' id: '45'
permission: ALLOW permission: ALLOW
source: 192.168.1.12 source: 192.168.1.12
destination: 192.168.2.16 destination: 192.168.2.16
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '46' id: '46'
permission: ALLOW permission: ALLOW
source: 192.168.2.10 source: 192.168.2.10
destination: 192.168.1.12 destination: 192.168.1.12
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '47' id: '47'
permission: ALLOW permission: ALLOW
source: 192.168.2.14 source: 192.168.2.14
destination: 192.168.1.12 destination: 192.168.1.12
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '48' id: '48'
permission: ALLOW permission: ALLOW
source: 192.168.2.16 source: 192.168.2.16
destination: 192.168.1.12 destination: 192.168.1.12
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: ACL_RULE - item_type: ACL_RULE
id: '49' id: '49'
permission: DENY permission: DENY
source: ANY source: ANY
destination: ANY destination: ANY
protocol: ANY protocol: ANY
port: ANY port: ANY
- itemType: RED_POL - item_type: RED_POL
id: '50' id: '50'
startStep: 50 start_step: 50
endStep: 50 end_step: 50
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -470,20 +469,20 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_IER - item_type: RED_IER
id: '51' id: '51'
startStep: 75 start_step: 75
endStep: 105 end_step: 105
load: 10000 load: 10000
protocol: UDP protocol: UDP
port: '53' port: '53'
source: '1' source: '1'
destination: '8' destination: '8'
missionCriticality: 0 mission_criticality: 0
- itemType: RED_POL - item_type: RED_POL
id: '52' id: '52'
startStep: 100 start_step: 100
endStep: 100 end_step: 100
targetNodeId: '8' targetNodeId: '8'
initiator: IER initiator: IER
type: SERVICE type: SERVICE
@@ -492,10 +491,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '53' id: '53'
startStep: 105 start_step: 105
endStep: 105 end_step: 105
targetNodeId: '8' targetNodeId: '8'
initiator: SERVICE initiator: SERVICE
type: FILE type: FILE
@@ -504,10 +503,10 @@
sourceNodeId: '8' sourceNodeId: '8'
sourceNodeService: UDP sourceNodeService: UDP
sourceNodeServiceState: COMPROMISED sourceNodeServiceState: COMPROMISED
- itemType: RED_POL - item_type: RED_POL
id: '54' id: '54'
startStep: 105 start_step: 105
endStep: 105 end_step: 105
targetNodeId: '8' targetNodeId: '8'
initiator: SERVICE initiator: SERVICE
type: SERVICE type: SERVICE
@@ -516,10 +515,10 @@
sourceNodeId: '8' sourceNodeId: '8'
sourceNodeService: UDP sourceNodeService: UDP
sourceNodeServiceState: COMPROMISED sourceNodeServiceState: COMPROMISED
- itemType: RED_POL - item_type: RED_POL
id: '55' id: '55'
startStep: 125 start_step: 125
endStep: 125 end_step: 125
targetNodeId: '7' targetNodeId: '7'
initiator: SERVICE initiator: SERVICE
type: SERVICE type: SERVICE

View File

@@ -165,12 +165,10 @@ class Primaite(Env):
# Number of ports - gets a value when config is loaded # Number of ports - gets a value when config is loaded
self.num_ports = 0 self.num_ports = 0
# The action type
self.action_type = 0
# Observation type, by default box. # Observation type, by default box.
self.observation_type = ObservationType.BOX self.observation_type = ObservationType.BOX
# Open the config file and build the environment laydown # Open the config file and build the environment laydown
with open(self._lay_down_config_path, "r") as file: with open(self._lay_down_config_path, "r") as file:
# Open the config file and build the environment laydown # Open the config file and build the environment laydown
@@ -206,7 +204,7 @@ class Primaite(Env):
self.observation_space, self.env_obs = self.init_observations() self.observation_space, self.env_obs = self.init_observations()
# Define Action Space - depends on action space type (Node or ACL) # Define Action Space - depends on action space type (Node or ACL)
if self.action_type == ActionType.NODE: if self.training_config.action_type == ActionType.NODE:
_LOGGER.info("Action space type NODE selected") _LOGGER.info("Action space type NODE selected")
# Terms (for node action space): # Terms (for node action space):
# [0, num nodes] - node ID (0 = nothing, node ID) # [0, num nodes] - node ID (0 = nothing, node ID)
@@ -215,7 +213,7 @@ class Primaite(Env):
# [0, num services] - resolves to service ID (0 = nothing, resolves to service) # noqa # [0, num services] - resolves to service ID (0 = nothing, resolves to service) # noqa
self.action_dict = self.create_node_action_dict() self.action_dict = self.create_node_action_dict()
self.action_space = spaces.Discrete(len(self.action_dict)) self.action_space = spaces.Discrete(len(self.action_dict))
elif self.action_type == ActionType.ACL: elif self.training_config.action_type == ActionType.ACL:
_LOGGER.info("Action space type ACL selected") _LOGGER.info("Action space type ACL selected")
# Terms (for ACL action space): # Terms (for ACL action space):
# [0, 2] - Action (0 = do nothing, 1 = create rule, 2 = delete rule) # [0, 2] - Action (0 = do nothing, 1 = create rule, 2 = delete rule)
@@ -226,12 +224,12 @@ class Primaite(Env):
# [0, num ports] - Port (0 = any, then 1 -> x resolving to port) # [0, num ports] - Port (0 = any, then 1 -> x resolving to port)
self.action_dict = self.create_acl_action_dict() self.action_dict = self.create_acl_action_dict()
self.action_space = spaces.Discrete(len(self.action_dict)) self.action_space = spaces.Discrete(len(self.action_dict))
elif self.action_type == ActionType.ANY: elif self.training_config.action_type == ActionType.ANY:
_LOGGER.info("Action space type ANY selected - Node + ACL") _LOGGER.info("Action space type ANY selected - Node + ACL")
self.action_dict = self.create_node_and_acl_action_dict() self.action_dict = self.create_node_and_acl_action_dict()
self.action_space = spaces.Discrete(len(self.action_dict)) self.action_space = spaces.Discrete(len(self.action_dict))
else: else:
_LOGGER.info("Invalid action type selected") _LOGGER.info(f"Invalid action type selected")
# Set up a csv to store the results of the training # Set up a csv to store the results of the training
try: try:
header = ["Episode", "Average Reward"] header = ["Episode", "Average Reward"]
@@ -426,9 +424,12 @@ class Primaite(Env):
_action: The action space from the agent _action: The action space from the agent
""" """
# At the moment, actions are only affecting nodes # At the moment, actions are only affecting nodes
if self.action_type == ActionType.NODE: print("")
print(_action)
print(self.action_dict)
if self.training_config.action_type == ActionType.NODE:
self.apply_actions_to_nodes(_action) self.apply_actions_to_nodes(_action)
elif self.action_type == ActionType.ACL: elif self.training_config.action_type == ActionType.ACL:
self.apply_actions_to_acl(_action) self.apply_actions_to_acl(_action)
elif ( elif (
len(self.action_dict[_action]) == 6 len(self.action_dict[_action]) == 6
@@ -901,34 +902,34 @@ class Primaite(Env):
def load_lay_down_config(self): def load_lay_down_config(self):
"""Loads config data in order to build the environment configuration.""" """Loads config data in order to build the environment configuration."""
for item in self.lay_down_config: for item in self.lay_down_config:
if item["itemType"] == "NODE": if item["item_type"] == "NODE":
# Create a node # Create a node
self.create_node(item) self.create_node(item)
elif item["itemType"] == "LINK": elif item["item_type"] == "LINK":
# Create a link # Create a link
self.create_link(item) self.create_link(item)
elif item["itemType"] == "GREEN_IER": elif item["item_type"] == "GREEN_IER":
# Create a Green IER # Create a Green IER
self.create_green_ier(item) self.create_green_ier(item)
elif item["itemType"] == "GREEN_POL": elif item["item_type"] == "GREEN_POL":
# Create a Green PoL # Create a Green PoL
self.create_green_pol(item) self.create_green_pol(item)
elif item["itemType"] == "RED_IER": elif item["item_type"] == "RED_IER":
# Create a Red IER # Create a Red IER
self.create_red_ier(item) self.create_red_ier(item)
elif item["itemType"] == "RED_POL": elif item["item_type"] == "RED_POL":
# Create a Red PoL # Create a Red PoL
self.create_red_pol(item) self.create_red_pol(item)
elif item["itemType"] == "ACL_RULE": elif item["item_type"] == "ACL_RULE":
# Create an ACL rule # Create an ACL rule
self.create_acl_rule(item) self.create_acl_rule(item)
elif item["itemType"] == "SERVICES": elif item["item_type"] == "SERVICES":
# Create the list of services # Create the list of services
self.create_services_list(item) self.create_services_list(item)
elif item["itemType"] == "PORTS": elif item["item_type"] == "PORTS":
# Create the list of ports # Create the list of ports
self.create_ports_list(item) self.create_ports_list(item)
elif item["itemType"] == "OBSERVATIONS": elif item["item_type"] == "OBSERVATIONS":
# Get the observation information # Get the observation information
self.get_observation_info(item) self.get_observation_info(item)
else: else:
@@ -1071,14 +1072,14 @@ class Primaite(Env):
item: A config data item item: A config data item
""" """
ier_id = item["id"] ier_id = item["id"]
ier_start_step = item["startStep"] ier_start_step = item["start_step"]
ier_end_step = item["endStep"] ier_end_step = item["end_step"]
ier_load = item["load"] ier_load = item["load"]
ier_protocol = item["protocol"] ier_protocol = item["protocol"]
ier_port = item["port"] ier_port = item["port"]
ier_source = item["source"] ier_source = item["source"]
ier_destination = item["destination"] ier_destination = item["destination"]
ier_mission_criticality = item["missionCriticality"] ier_mission_criticality = item["mission_criticality"]
# Create IER and add to green IER dictionary # Create IER and add to green IER dictionary
self.green_iers[ier_id] = IER( self.green_iers[ier_id] = IER(
@@ -1101,14 +1102,14 @@ class Primaite(Env):
item: A config data item item: A config data item
""" """
ier_id = item["id"] ier_id = item["id"]
ier_start_step = item["startStep"] ier_start_step = item["start_step"]
ier_end_step = item["endStep"] ier_end_step = item["end_step"]
ier_load = item["load"] ier_load = item["load"]
ier_protocol = item["protocol"] ier_protocol = item["protocol"]
ier_port = item["port"] ier_port = item["port"]
ier_source = item["source"] ier_source = item["source"]
ier_destination = item["destination"] ier_destination = item["destination"]
ier_mission_criticality = item["missionCriticality"] ier_mission_criticality = item["mission_criticality"]
# Create IER and add to red IER dictionary # Create IER and add to red IER dictionary
self.red_iers[ier_id] = IER( self.red_iers[ier_id] = IER(
@@ -1131,8 +1132,8 @@ class Primaite(Env):
item: A config data item item: A config data item
""" """
pol_id = item["id"] pol_id = item["id"]
pol_start_step = item["startStep"] pol_start_step = item["start_step"]
pol_end_step = item["endStep"] pol_end_step = item["end_step"]
pol_node = item["nodeId"] pol_node = item["nodeId"]
pol_type = NodePOLType[item["type"]] pol_type = NodePOLType[item["type"]]
@@ -1165,8 +1166,8 @@ class Primaite(Env):
item: A config data item item: A config data item
""" """
pol_id = item["id"] pol_id = item["id"]
pol_start_step = item["startStep"] pol_start_step = item["start_step"]
pol_end_step = item["endStep"] pol_end_step = item["end_step"]
pol_target_node_id = item["targetNodeId"] pol_target_node_id = item["targetNodeId"]
pol_initiator = NodePOLInitiator[item["initiator"]] pol_initiator = NodePOLInitiator[item["initiator"]]
pol_type = NodePOLType[item["type"]] pol_type = NodePOLType[item["type"]]
@@ -1226,7 +1227,7 @@ class Primaite(Env):
Args: Args:
item: A config data item representing the services item: A config data item representing the services
""" """
service_list = services["serviceList"] service_list = services["service_list"]
for service in service_list: for service in service_list:
service_name = service["name"] service_name = service["name"]
@@ -1242,7 +1243,7 @@ class Primaite(Env):
Args: Args:
item: A config data item representing the ports item: A config data item representing the ports
""" """
ports_list = ports["portsList"] ports_list = ports["ports_list"]
for port in ports_list: for port in ports_list:
port_value = port["port"] port_value = port["port"]
@@ -1267,10 +1268,10 @@ class Primaite(Env):
configuration. configuration.
""" """
for item in self.lay_down_config: for item in self.lay_down_config:
if item["itemType"] == "NODE": if item["item_type"] == "NODE":
# Reset a node's state (normal and reference) # Reset a node's state (normal and reference)
self.reset_node(item) self.reset_node(item)
elif item["itemType"] == "ACL_RULE": elif item["item_type"] == "ACL_RULE":
# Create an ACL rule (these are cleared on reset, so just need to recreate them) # Create an ACL rule (these are cleared on reset, so just need to recreate them)
self.create_acl_rule(item) self.create_acl_rule(item)
else: else:

View File

@@ -1,19 +1,19 @@
- itemType: ACTIONS - item_type: ACTIONS
type: NODE type: NODE
- itemType: OBSERVATIONS - item_type: OBSERVATIONS
type: BOX type: BOX
- itemType: STEPS - item_type: STEPS
steps: 5 steps: 5
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '80' - port: '80'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
######################################## ########################################
# Nodes # Nodes
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: PC1 name: PC1
node_class: SERVICE node_class: SERVICE
@@ -27,7 +27,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: SERVER name: SERVER
node_class: SERVICE node_class: SERVICE
@@ -41,7 +41,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: SWITCH1 name: SWITCH1
node_class: ACTIVE node_class: ACTIVE
@@ -54,13 +54,13 @@
######################################## ########################################
# Links # Links
- itemType: LINK - item_type: LINK
id: '4' id: '4'
name: link1 name: link1
bandwidth: 1000 bandwidth: 1000
source: '1' source: '1'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '5' id: '5'
name: link2 name: link2
bandwidth: 1000 bandwidth: 1000

View File

@@ -1,19 +1,19 @@
- itemType: ACTIONS - item_type: ACTIONS
type: NODE type: NODE
- itemType: OBSERVATIONS - item_type: OBSERVATIONS
type: MULTIDISCRETE type: MULTIDISCRETE
- itemType: STEPS - item_type: STEPS
steps: 5 steps: 5
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '80' - port: '80'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: TCP - name: TCP
######################################## ########################################
# Nodes # Nodes
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: PC1 name: PC1
node_class: SERVICE node_class: SERVICE
@@ -27,7 +27,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: SERVER name: SERVER
node_class: SERVICE node_class: SERVICE
@@ -41,7 +41,7 @@
- name: TCP - name: TCP
port: '80' port: '80'
state: GOOD state: GOOD
- itemType: NODE - item_type: NODE
node_id: '3' node_id: '3'
name: SWITCH1 name: SWITCH1
node_class: ACTIVE node_class: ACTIVE
@@ -54,13 +54,13 @@
######################################## ########################################
# Links # Links
- itemType: LINK - item_type: LINK
id: '4' id: '4'
name: link1 name: link1
bandwidth: 1000 bandwidth: 1000
source: '1' source: '1'
destination: '3' destination: '3'
- itemType: LINK - item_type: LINK
id: '5' id: '5'
name: link2 name: link2
bandwidth: 1000 bandwidth: 1000

View File

@@ -1,10 +1,10 @@
- itemType: PORTS - item_type: PORTS
portsList: ports_list:
- port: '21' - port: '21'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: ftp - name: ftp
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: node name: node
node_class: SERVICE node_class: SERVICE
@@ -18,15 +18,15 @@
- name: ftp - name: ftp
port: '21' port: '21'
state: GOOD state: GOOD
- itemType: POSITION - item_type: POSITION
positions: positions:
- node: '1' - node: '1'
x_pos: 309 x_pos: 309
y_pos: 78 y_pos: 78
- itemType: RED_POL - item_type: RED_POL
id: '1' id: '1'
startStep: 1 start_step: 1
endStep: 3 end_step: 3
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: FILE type: FILE
@@ -35,10 +35,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '2' id: '2'
startStep: 3 start_step: 3
endStep: 15 end_step: 15
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: FILE type: FILE
@@ -47,10 +47,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '3' id: '3'
startStep: 4 start_step: 4
endStep: 6 end_step: 6
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: OPERATING type: OPERATING
@@ -59,10 +59,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '4' id: '4'
startStep: 6 start_step: 6
endStep: 15 end_step: 15
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: OPERATING type: OPERATING
@@ -71,10 +71,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '5' id: '5'
startStep: 7 start_step: 7
endStep: 9 end_step: 9
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -83,10 +83,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '6' id: '6'
startStep: 9 start_step: 9
endStep: 15 end_step: 15
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: SERVICE type: SERVICE
@@ -95,10 +95,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '7' id: '7'
startStep: 10 start_step: 10
endStep: 12 end_step: 12
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: OS type: OS
@@ -107,10 +107,10 @@
sourceNodeId: NA sourceNodeId: NA
sourceNodeService: NA sourceNodeService: NA
sourceNodeServiceState: NA sourceNodeServiceState: NA
- itemType: RED_POL - item_type: RED_POL
id: '8' id: '8'
startStep: 12 start_step: 12
endStep: 15 end_step: 15
targetNodeId: '1' targetNodeId: '1'
initiator: DIRECT initiator: DIRECT
type: OS type: OS

View File

@@ -5,85 +5,90 @@
# "STABLE_BASELINES3_PPO" # "STABLE_BASELINES3_PPO"
# "STABLE_BASELINES3_A2C" # "STABLE_BASELINES3_A2C"
# "GENERIC" # "GENERIC"
agentIdentifier: GENERIC agent_identifier: GENERIC
# Sets How the Action Space is defined:
# "NODE"
# "ACL"
# "ANY" node and acl actions
action_type: ANY
# Number of episodes to run per session # Number of episodes to run per session
numEpisodes: 1 num_episodes: 1
# Number of time_steps per episode
num_steps: 15
# Time delay between steps (for generic agents) # Time delay between steps (for generic agents)
timeDelay: 1 time_delay: 1
# Filename of the scenario / laydown
configFilename: single_action_space_lay_down_config.yaml
# Type of session to be run (TRAINING or EVALUATION) # Type of session to be run (TRAINING or EVALUATION)
sessionType: TRAINING session_type: TRAINING
# Determine whether to load an agent from file # Determine whether to load an agent from file
loadAgent: False load_agent: False
# File path and file name of agent if you're loading one in # File path and file name of agent if you're loading one in
agentLoadFile: C:\[Path]\[agent_saved_filename.zip] agent_load_file: C:\[Path]\[agent_saved_filename.zip]
# Environment config values # Environment config values
# The high value for the observation space # The high value for the observation space
observationSpaceHighValue: 1000000000 observation_space_high_value: 1000000000
# Reward values # Reward values
# Generic # Generic
allOk: 0 all_ok: 0
# Node Operating State # Node Operating State
offShouldBeOn: -10 off_should_be_on: -10
offShouldBeResetting: -5 off_should_be_resetting: -5
onShouldBeOff: -2 on_should_be_off: -2
onShouldBeResetting: -5 on_should_be_resetting: -5
resettingShouldBeOn: -5 resetting_should_be_on: -5
resettingShouldBeOff: -2 resetting_should_be_off: -2
resetting: -3 resetting: -3
# Node O/S or Service State # Node O/S or Service State
goodShouldBePatching: 2 good_should_be_patching: 2
goodShouldBeCompromised: 5 good_should_be_compromised: 5
goodShouldBeOverwhelmed: 5 good_should_be_overwhelmed: 5
patchingShouldBeGood: -5 patching_should_be_good: -5
patchingShouldBeCompromised: 2 patching_should_be_compromised: 2
patchingShouldBeOverwhelmed: 2 patching_should_be_overwhelmed: 2
patching: -3 patching: -3
compromisedShouldBeGood: -20 compromised_should_be_good: -20
compromisedShouldBePatching: -20 compromised_should_be_patching: -20
compromisedShouldBeOverwhelmed: -20 compromised_should_be_overwhelmed: -20
compromised: -20 compromised: -20
overwhelmedShouldBeGood: -20 overwhelmed_should_be_good: -20
overwhelmedShouldBePatching: -20 overwhelmed_should_be_patching: -20
overwhelmedShouldBeCompromised: -20 overwhelmed_should_be_compromised: -20
overwhelmed: -20 overwhelmed: -20
# Node File System State # Node File System State
goodShouldBeRepairing: 2 good_should_be_repairing: 2
goodShouldBeRestoring: 2 good_should_be_restoring: 2
goodShouldBeCorrupt: 5 good_should_be_corrupt: 5
goodShouldBeDestroyed: 10 good_should_be_destroyed: 10
repairingShouldBeGood: -5 repairing_should_be_good: -5
repairingShouldBeRestoring: 2 repairing_should_be_restoring: 2
repairingShouldBeCorrupt: 2 repairing_should_be_corrupt: 2
repairingShouldBeDestroyed: 0 repairing_should_be_destroyed: 0
repairing: -3 repairing: -3
restoringShouldBeGood: -10 restoring_should_be_good: -10
restoringShouldBeRepairing: -2 restoring_should_be_repairing: -2
restoringShouldBeCorrupt: 1 restoring_should_be_corrupt: 1
restoringShouldBeDestroyed: 2 restoring_should_be_destroyed: 2
restoring: -6 restoring: -6
corruptShouldBeGood: -10 corrupt_should_be_good: -10
corruptShouldBeRepairing: -10 corrupt_should_be_repairing: -10
corruptShouldBeRestoring: -10 corrupt_should_be_restoring: -10
corruptShouldBeDestroyed: 2 corrupt_should_be_destroyed: 2
corrupt: -10 corrupt: -10
destroyedShouldBeGood: -20 destroyed_should_be_good: -20
destroyedShouldBeRepairing: -20 destroyed_should_be_repairing: -20
destroyedShouldBeRestoring: -20 destroyed_should_be_restoring: -20
destroyedShouldBeCorrupt: -20 destroyed_should_be_corrupt: -20
destroyed: -20 destroyed: -20
scanning: -2 scanning: -2
# IER status # IER status
redIerRunning: -5 red_ier_running: -5
greenIerBlocked: -10 green_ier_blocked: -10
# Patching / Reset durations # Patching / Reset durations
osPatchingDuration: 5 # The time taken to patch the OS os_patching_duration: 5 # The time taken to patch the OS
nodeResetDuration: 5 # The time taken to reset a node (hardware) node_reset_duration: 5 # The time taken to reset a node (hardware)
servicePatchingDuration: 5 # The time taken to patch a service service_patching_duration: 5 # The time taken to patch a service
fileSystemRepairingLimit: 5 # The time take to repair the file system file_system_repairing_limit: 5 # The time take to repair the file system
fileSystemRestoringLimit: 5 # The time take to restore the file system file_system_restoring_limit: 5 # The time take to restore the file system
fileSystemScanningLimit: 5 # The time taken to scan the file system file_system_scanning_limit: 5 # The time taken to scan the file system

View File

@@ -1,14 +1,10 @@
- itemType: ACTIONS - item_type: PORTS
type: ANY ports_list:
- itemType: STEPS
steps: 15
- itemType: PORTS
portsList:
- port: '21' - port: '21'
- itemType: SERVICES - item_type: SERVICES
serviceList: service_list:
- name: ftp - name: ftp
- itemType: NODE - item_type: NODE
node_id: '1' node_id: '1'
name: node name: node
node_class: SERVICE node_class: SERVICE
@@ -22,7 +18,7 @@
- name: ftp - name: ftp
port: '21' port: '21'
state: COMPROMISED state: COMPROMISED
- itemType: NODE - item_type: NODE
node_id: '2' node_id: '2'
name: server_1 name: server_1
node_class: SERVICE node_class: SERVICE
@@ -36,7 +32,7 @@
- name: ftp - name: ftp
port: '21' port: '21'
state: COMPROMISED state: COMPROMISED
- itemType: POSITION - item_type: POSITION
positions: positions:
- node: '1' - node: '1'
x_pos: 309 x_pos: 309
@@ -44,12 +40,13 @@
- node: '2' - node: '2'
x_pos: 200 x_pos: 200
y_pos: 78 y_pos: 78
- itemType: RED_IER - item_type: RED_IER
id: '3' id: '3'
startStep: 2 start_step: 2
endStep: 15 end_step: 15
load: 1000 load: 1000
protocol: ftp protocol: ftp
port: CORRUPT port: CORRUPT
source: '1' source: '1'
destination: '2' destination: '2'
mission_criticality: 0

View File

@@ -5,85 +5,90 @@
# "STABLE_BASELINES3_PPO" # "STABLE_BASELINES3_PPO"
# "STABLE_BASELINES3_A2C" # "STABLE_BASELINES3_A2C"
# "GENERIC" # "GENERIC"
agentIdentifier: GENERIC agent_identifier: GENERIC
# Sets How the Action Space is defined:
# "NODE"
# "ACL"
# "ANY" node and acl actions
action_type: ANY
# Number of episodes to run per session # Number of episodes to run per session
numEpisodes: 1 num_episodes: 1
# Number of time_steps per episode
num_steps: 15
# Time delay between steps (for generic agents) # Time delay between steps (for generic agents)
timeDelay: 1 time_delay: 1
# Filename of the scenario / laydown
configFilename: single_action_space_lay_down_config.yaml
# Type of session to be run (TRAINING or EVALUATION) # Type of session to be run (TRAINING or EVALUATION)
sessionType: TRAINING session_type: TRAINING
# Determine whether to load an agent from file # Determine whether to load an agent from file
loadAgent: False load_agent: False
# File path and file name of agent if you're loading one in # File path and file name of agent if you're loading one in
agentLoadFile: C:\[Path]\[agent_saved_filename.zip] agent_load_file: C:\[Path]\[agent_saved_filename.zip]
# Environment config values # Environment config values
# The high value for the observation space # The high value for the observation space
observationSpaceHighValue: 1000000000 observation_space_high_value: 1000000000
# Reward values # Reward values
# Generic # Generic
allOk: 0 all_ok: 0
# Node Operating State # Node Operating State
offShouldBeOn: -10 off_should_be_on: -10
offShouldBeResetting: -5 off_should_be_resetting: -5
onShouldBeOff: -2 on_should_be_off: -2
onShouldBeResetting: -5 on_should_be_resetting: -5
resettingShouldBeOn: -5 resetting_should_be_on: -5
resettingShouldBeOff: -2 resetting_should_be_off: -2
resetting: -3 resetting: -3
# Node O/S or Service State # Node O/S or Service State
goodShouldBePatching: 2 good_should_be_patching: 2
goodShouldBeCompromised: 5 good_should_be_compromised: 5
goodShouldBeOverwhelmed: 5 good_should_be_overwhelmed: 5
patchingShouldBeGood: -5 patching_should_be_good: -5
patchingShouldBeCompromised: 2 patching_should_be_compromised: 2
patchingShouldBeOverwhelmed: 2 patching_should_be_overwhelmed: 2
patching: -3 patching: -3
compromisedShouldBeGood: -20 compromised_should_be_good: -20
compromisedShouldBePatching: -20 compromised_should_be_patching: -20
compromisedShouldBeOverwhelmed: -20 compromised_should_be_overwhelmed: -20
compromised: -20 compromised: -20
overwhelmedShouldBeGood: -20 overwhelmed_should_be_good: -20
overwhelmedShouldBePatching: -20 overwhelmed_should_be_patching: -20
overwhelmedShouldBeCompromised: -20 overwhelmed_should_be_compromised: -20
overwhelmed: -20 overwhelmed: -20
# Node File System State # Node File System State
goodShouldBeRepairing: 2 good_should_be_repairing: 2
goodShouldBeRestoring: 2 good_should_be_restoring: 2
goodShouldBeCorrupt: 5 good_should_be_corrupt: 5
goodShouldBeDestroyed: 10 good_should_be_destroyed: 10
repairingShouldBeGood: -5 repairing_should_be_good: -5
repairingShouldBeRestoring: 2 repairing_should_be_restoring: 2
repairingShouldBeCorrupt: 2 repairing_should_be_corrupt: 2
repairingShouldBeDestroyed: 0 repairing_should_be_destroyed: 0
repairing: -3 repairing: -3
restoringShouldBeGood: -10 restoring_should_be_good: -10
restoringShouldBeRepairing: -2 restoring_should_be_repairing: -2
restoringShouldBeCorrupt: 1 restoring_should_be_corrupt: 1
restoringShouldBeDestroyed: 2 restoring_should_be_destroyed: 2
restoring: -6 restoring: -6
corruptShouldBeGood: -10 corrupt_should_be_good: -10
corruptShouldBeRepairing: -10 corrupt_should_be_repairing: -10
corruptShouldBeRestoring: -10 corrupt_should_be_restoring: -10
corruptShouldBeDestroyed: 2 corrupt_should_be_destroyed: 2
corrupt: -10 corrupt: -10
destroyedShouldBeGood: -20 destroyed_should_be_good: -20
destroyedShouldBeRepairing: -20 destroyed_should_be_repairing: -20
destroyedShouldBeRestoring: -20 destroyed_should_be_restoring: -20
destroyedShouldBeCorrupt: -20 destroyed_should_be_corrupt: -20
destroyed: -20 destroyed: -20
scanning: -2 scanning: -2
# IER status # IER status
redIerRunning: -5 red_ier_running: -5
greenIerBlocked: -10 green_ier_blocked: -10
# Patching / Reset durations # Patching / Reset durations
osPatchingDuration: 5 # The time taken to patch the OS os_patching_duration: 5 # The time taken to patch the OS
nodeResetDuration: 5 # The time taken to reset a node (hardware) node_reset_duration: 5 # The time taken to reset a node (hardware)
servicePatchingDuration: 5 # The time taken to patch a service service_patching_duration: 5 # The time taken to patch a service
fileSystemRepairingLimit: 5 # The time take to repair the file system file_system_repairing_limit: 5 # The time take to repair the file system
fileSystemRestoringLimit: 5 # The time take to restore the file system file_system_restoring_limit: 5 # The time take to restore the file system
fileSystemScanningLimit: 5 # The time taken to scan the file system file_system_scanning_limit: 5 # The time taken to scan the file system

View File

@@ -1,16 +1,18 @@
import time import time
from primaite.common.enums import HardwareState from primaite.common.enums import HardwareState
from primaite.environment.primaite_env import Primaite
from tests import TEST_CONFIG_ROOT from tests import TEST_CONFIG_ROOT
from tests.conftest import _get_primaite_env_from_config from tests.conftest import _get_primaite_env_from_config
def run_generic_set_actions(env, config_values): def run_generic_set_actions(env: Primaite):
"""Run against a generic agent with specified blue agent actions.""" """Run against a generic agent with specified blue agent actions."""
# Reset the environment at the start of the episode # Reset the environment at the start of the episode
# env.reset() # env.reset()
for episode in range(0, config_values.num_episodes): training_config = env.training_config
for step in range(0, config_values.num_steps): for episode in range(0, training_config.num_episodes):
for step in range(0, training_config.num_steps):
# Send the observation space to the agent to get an action # Send the observation space to the agent to get an action
# TEMP - random action for now # TEMP - random action for now
# action = env.blue_agent_action(obs) # action = env.blue_agent_action(obs)
@@ -34,7 +36,7 @@ def run_generic_set_actions(env, config_values):
break break
# Introduce a delay between steps # Introduce a delay between steps
time.sleep(config_values.time_delay / 1000) time.sleep(training_config.time_delay / 1000)
# Reset the environment at the end of the episode # Reset the environment at the end of the episode
# env.reset() # env.reset()
@@ -44,13 +46,12 @@ def run_generic_set_actions(env, config_values):
def test_single_action_space_is_valid(): def test_single_action_space_is_valid():
"""Test to ensure the blue agent is using the ACL action space and is carrying out both kinds of operations.""" """Test to ensure the blue agent is using the ACL action space and is carrying out both kinds of operations."""
env, config_values = _get_primaite_env_from_config( env = _get_primaite_env_from_config(
main_config_path=TEST_CONFIG_ROOT / "single_action_space_main_config.yaml", training_config_path=TEST_CONFIG_ROOT / "single_action_space_main_config.yaml",
lay_down_config_path=TEST_CONFIG_ROOT lay_down_config_path=TEST_CONFIG_ROOT / "single_action_space_lay_down_config.yaml",
/ "single_action_space_lay_down_config.yaml",
) )
run_generic_set_actions(env, config_values) run_generic_set_actions(env)
# Retrieve the action space dictionary values from environment # Retrieve the action space dictionary values from environment
env_action_space_dict = env.action_dict.values() env_action_space_dict = env.action_dict.values()
@@ -75,14 +76,12 @@ def test_single_action_space_is_valid():
def test_agent_is_executing_actions_from_both_spaces(): def test_agent_is_executing_actions_from_both_spaces():
"""Test to ensure the blue agent is carrying out both kinds of operations (NODE & ACL).""" """Test to ensure the blue agent is carrying out both kinds of operations (NODE & ACL)."""
env, config_values = _get_primaite_env_from_config( env = _get_primaite_env_from_config(
main_config_path=TEST_CONFIG_ROOT training_config_path=TEST_CONFIG_ROOT / "single_action_space_fixed_blue_actions_main_config.yaml",
/ "single_action_space_fixed_blue_actions_main_config.yaml", lay_down_config_path=TEST_CONFIG_ROOT / "single_action_space_lay_down_config.yaml",
lay_down_config_path=TEST_CONFIG_ROOT
/ "single_action_space_lay_down_config.yaml",
) )
# Run environment with specified fixed blue agent actions only # Run environment with specified fixed blue agent actions only
run_generic_set_actions(env, config_values) run_generic_set_actions(env)
# Retrieve hardware state of computer_1 node in laydown config # Retrieve hardware state of computer_1 node in laydown config
# Agent turned this off in Step 5 # Agent turned this off in Step 5
computer_node_hardware_state = env.nodes["1"].hardware_state computer_node_hardware_state = env.nodes["1"].hardware_state