pyrit.executor.attack.MultiPromptSendingAttack#

class MultiPromptSendingAttack(*, objective_target: PromptTarget, attack_converter_config: AttackConverterConfig | None = None, attack_scoring_config: AttackScoringConfig | None = None, prompt_normalizer: PromptNormalizer | None = None)[source]#

Bases: MultiTurnAttackStrategy[MultiPromptSendingAttackContext, AttackResult]

Implementation of multi-prompt sending attack strategy.

This class orchestrates a multi-turn attack where a series of predefined malicious prompts are sent sequentially to try to achieve a specific objective against a target system. The strategy evaluates the final target response using optional scorers to determine if the objective has been met.

The attack flow consists of: 1. Sending each predefined prompt to the target system in sequence. 2. Continuing until all predefined prompts are sent. 3. Evaluating the final response with scorers if configured. 4. Returning the attack result with achievement status.

Note: This attack always runs all predefined prompts regardless of whether the objective is achieved early in the sequence.

The strategy supports customization through prepended conversations, converters, and multiple scorer types for comprehensive evaluation.

__init__(*, objective_target: PromptTarget, attack_converter_config: AttackConverterConfig | None = None, attack_scoring_config: AttackScoringConfig | None = None, prompt_normalizer: PromptNormalizer | None = None) None[source]#

Initialize the multi-prompt sending attack strategy.

Parameters:
  • objective_target (PromptTarget) – The target system to attack.

  • attack_converter_config (Optional[AttackConverterConfig]) – Configuration for prompt converters.

  • attack_scoring_config (Optional[AttackScoringConfig]) – Configuration for scoring components.

  • prompt_normalizer (Optional[PromptNormalizer]) – Normalizer for handling prompts.

Raises:

ValueError – If the objective scorer is not a true/false scorer.

Methods

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

Initialize the multi-prompt sending attack strategy.

execute_async(**kwargs)

Execute the attack strategy asynchronously with the provided parameters.

execute_with_context_async(*, context)

Execute strategy with complete lifecycle management.

get_identifier()

async execute_async(**kwargs) AttackResult[source]#

Execute the attack strategy asynchronously with the provided parameters.