yawning_titan.envs.generic.core.blue_interface.BlueInterface#

class yawning_titan.envs.generic.core.blue_interface.BlueInterface(network_interface)[source]#

Bases: BlueActionSet

The interface used by the Blue Agents to act within the environment.

Initialise the blue interface.

Parameters:

network_interface – Object from the NetworkInterface class

Methods

add_deceptive_node

Add a deceptive node into the environment.

do_nothing

Do Nothing.

get_number_of_actions

Get the number of actions that this blue agent can perform.

isolate_node

Isolate a node by disabling all of its connections to other nodes.

make_safe_node

Make a target node safe.

perform_action

Perform an action within the environment.

reconnect_node

Enable all of the connections to and from a node.

reduce_node_vulnerability

Reduce the vulnerability of the target node.

restore_node

Restore a node to its starting state: safe and with its starting vulnerability.

scan_all_nodes

Scan all of the nodes within the environment and attempt to get their states.

perform_action(action)[source]#

Perform an action within the environment.

Takes in an action number and then maps this to the correct action to perform. There are 3 different item_types of actions:

  • standard actions

  • deceptive actions

  • global actions

–standard actions– Standard actions are actions that can apply to all nodes. For each standard action there are n actions (where n is the number of nodes in the network). An example of this action would be to isolate a node. The agent has to pick the isolate action and then the node it is being applied to.

–deceptive actions– Actions relating to deceptive nodes. Since the number of deceptive actions relate to the edges not the nodes (see deceptive nodes for more info), the deceptive actions cannot come under the standard actions. An example would be to place a deceptive node. The deceptive nodes can only be placed on an edge so the agent has to pick the “place deceptive node” action and then the edge to place it on.

–global actions– Global actions are actions where the agent does not need to pick any sub action other than the action. For example an action that applies to all nodes so the agent does not need to pick a specific node to apply the action to. “Do nothing” is an example of a global action as there is no secondary choice to be made.

The function also maps any actions outside of the action space to the “do nothing” action.

Order of operations: 1- check if the action is inside the action space –> perform “do nothing” 2- check if the action is a deceptive action –> perform action 3- check if the action is a global action –> perform action 4- perform the standard action

Parameters:

action – the action to perform

Returns:

The action that has been taken The node the action was performed on

add_deceptive_node(edge)#

Add a deceptive node into the environment.

Deceptive nodes are the same as standard nodes except they have a 100% chance (by default) to be able to detect attacks from the red agent. A deceptive node is added on an edge between two nodes.

Parameters:

edge – The edge to place the deceptive node on

Returns:

The name of the action performed (“add_deceptive_node” or “do_nothing” depending on if action is valid) A pair of nodes that the deceptive node was placed between (or None if no action performed)

do_nothing()#

Do Nothing.

Returns:

The name of the action (“do_nothing”) The nodes affected (None: as do nothing affects no nodes)

get_number_of_actions()[source]#

Get the number of actions that this blue agent can perform.

There are three item_types of actions:
  • global actions (apply to all nodes) - need 1 action space

  • deceptive actions (Add new nodes to environment)

  • standard actions (apply to a single node) - need 2 action space (action and node to perform on)

Returns:

The number of actions that this agent can perform

isolate_node(node)#

Isolate a node by disabling all of its connections to other nodes.

Parameters:

node – the node to disable

Returns:

The name of the action (“isolate”) The node affected

make_safe_node(node)#

Make a target node safe.

Can also affect the vulnerability of the node. There are settings that can change how this action works in the configuration file:

  • BLUE: making_node_safe_modifies_vulnerability

  • BLUE: vulnerability_change

  • BLUE: making_node_safe_gives_random_vulnerability

Parameters:
  • action (The name of the) –

  • safe (The name of the node to make) –

reconnect_node(node)#

Enable all of the connections to and from a node.

Parameters:

node – the node to enable to connections to

Returns:

The name of the action (“connect”) The node affected

reduce_node_vulnerability(node)#

Reduce the vulnerability of the target node.

Will not reduce the vulnerability past the lower bound setting in the configuration file:

  • BLUE: node_vulnerability_min

Parameters:

node – The node to reduce the vulnerability of as an instance of Node.

Returns:

The name of the action taken (“reduce_vulnerability”) and the Node the action was taken on.

restore_node(node)#

Restore a node to its starting state: safe and with its starting vulnerability.

Parameters:

node – the node to restore

Returns:

The name of the action (“restore_node”) The name of the node the action was taken on

scan_all_nodes()#

Scan all of the nodes within the environment and attempt to get their states.

The blue agents ability to see intrusions is based on the values in the config file:
  • BLUE: chance_to_discover_intrusion_on_scan

  • BLUE: chance_to_discover_intrusion_on_scan_deceptive_node

Returns:

The name of the action (“scan”) The node the action was performed on (None: as scan affects all nodes, not just 1)