pyrit.scenario.airt.Cyber#

class Cyber(*, adversarial_chat: PromptChatTarget | None = None, objectives: List[str] | None = None, objective_scorer: TrueFalseScorer | None = None, include_baseline: bool = True, scenario_result_id: str | None = None)[source]#

Bases: Scenario

Cyber scenario implementation for PyRIT.

This scenario tests how willing models are to exploit cybersecurity harms by generating malware. The Cyber class contains different variations of the malware generation techniques.

__init__(*, adversarial_chat: PromptChatTarget | None = None, objectives: List[str] | None = None, objective_scorer: TrueFalseScorer | None = None, include_baseline: bool = True, scenario_result_id: str | None = None) None[source]#

Initialize the cyber harms scenario.

Parameters:
  • adversarial_chat (Optional[PromptChatTarget]) – Adversarial chat for the red teaming attack, corresponding to CyberStrategy.MultiTurn. If not provided, defaults to an OpenAI chat target.

  • objectives (Optional[List[str]]) – Deprecated. Use dataset_config in initialize_async instead.

  • objective_scorer (Optional[TrueFalseScorer]) – Objective scorer for malware detection. If not provided, defaults to a SelfAskScorer using the malware.yaml file under the scorer config store for malware detection

  • include_baseline (bool) – Whether to include a baseline atomic attack that sends all objectives without modifications. Defaults to True. When True, a “baseline” attack is automatically added as the first atomic attack, allowing comparison between unmodified prompts and attack-modified prompts.

  • scenario_result_id (Optional[str]) – Optional ID of an existing scenario result to resume.

Methods

__init__(*[, adversarial_chat, objectives, ...])

Initialize the cyber harms scenario.

default_dataset_config()

Return the default dataset configuration for this scenario.

get_default_strategy()

Get the default strategy used when no strategies are specified.

get_strategy_class()

Get the strategy enum class for this scenario.

initialize_async(*[, objective_target, ...])

Initialize the scenario by populating self._atomic_attacks and creating the ScenarioResult.

run_async()

Execute all atomic attacks in the scenario sequentially.

Attributes

atomic_attack_count

Get the number of atomic attacks in this scenario.

name

Get the name of the scenario.

version

classmethod default_dataset_config() DatasetConfiguration[source]#

Return the default dataset configuration for this scenario.

Returns:

Configuration with airt_malware dataset.

Return type:

DatasetConfiguration

classmethod get_default_strategy() ScenarioStrategy[source]#

Get the default strategy used when no strategies are specified.

Returns:

CyberStrategy.ALL (all cyber strategies).

Return type:

ScenarioStrategy

classmethod get_strategy_class() type[ScenarioStrategy][source]#

Get the strategy enum class for this scenario.

Returns:

The CyberStrategy enum class.

Return type:

Type[ScenarioStrategy]

version: int = 1#