yawning_titan.agents.nsa_red#

Classes

NSARed

Provides the red agent behaviour within the 18-node-def environment.

class yawning_titan.agents.nsa_red.NSARed(skill, action_set, action_probabilities, node_set, zd_start_amount=0, zd_gain=0, zd_required=10)[source]#

Provides the red agent behaviour within the 18-node-def environment.

The agent is a loose replication of:

https://www.nsa.gov/portals/70/documents/resources/everyone/digital-media-center/publications/the-next-wave/TNW-22-1.pdf#page=9

__init__(skill, action_set, action_probabilities, node_set, zd_start_amount=0, zd_gain=0, zd_required=10)[source]#
update_node_set(nodes)[source]#

Update the set of nodes the agent can act upon.

Parameters:

nodes – A list containing the nodes

update_actions(actions, probabilities)[source]#

Update the set of actions and the corresponding probabilities.

Parameters:
  • actions – the new set of actions the agent can take

  • probabilities – the weights associated with the actions

choose_node()[source]#

Choose a node to act on.

Returns:

The node to act on

choose_action()[source]#

Choose an action to perform.

Returns:

The action to perform on

update_location(target, red_current_node)[source]#

Update the current location of the red agent.

Parameters:
  • target – the location to move to

  • red_current_node – red agents current node

Returns:

Reds previous node The node red is currently in

increment_day()[source]#

Increment the day related to zero day development.

If the day has reached a threshold for a zero day then add 1 to the number of available zero days.

check_zd_available()[source]#

Check if a zero day is available .

Returns:

True if a zero day is available to use False if no zero day is available to use

zd_attack(target, args)[source]#

Perform a zd attack on a targetted node.

Parameters:
  • target – the target node

  • args – A tuple containing: * “machine_states”: the current state of the machines * “red_current_node”: the red agents current node * “able_to_move”: if the red agent is able to move

basic_attack(target, args)[source]#

Perform a basic attack on a targetted node.

Parameters:
  • target – The target node

  • args – A tuple containing: * “machine_states”: the current state of the machines * “skill_level”: The skill level of the attack * “attack_success_threshold”: A threshold to determine if the attack succeeds * “red_current_node”: The current position of the red agent * “able_to_move”: if the red agent is able to move

move(target, args)[source]#

Move the red agent from one node to another.

Parameters:
  • target – the node the agent is moving to

  • args – A tuple containing the following: * “red_current_node”: the current node of the agent * “able_to_move”: if the agent is able to move

spread(state, args)[source]#

Attempt to spread to all nodes connected to a compromised node.

Parameters:
  • state – the current state of the environment

  • args – A tuple containing: * “chance_to_spread”: the chance to spread from one node to another * “chance_to_randomly_compromise”: chance to randomly infect a node

intrude(state, args)[source]#

Attempt to randomly intrude every uncompromised node.

Parameters:
  • state – the current state of the environment

  • args – A tuple containing: * “chance_to_spread”: the chance to spread from one node to another * “chance_to_randomly_compromise”: chance to randomly infect a node

do_action(nodes, action, args)[source]#

Perform the selected action on the given target nodes.

Parameters:
  • nodes – the nodes to perform the action on

  • action – the action to perform 0* - actions for the 5 node env 1* - actions for the new node env

  • args – any parameters needed to perform the action