hackagent.attacks.strategies
AttackStrategy Objects
class AttackStrategy(abc.ABC)
Abstract base class for an attack strategy.
execute
@abc.abstractmethod
def execute(attack_config: Dict[str, Any],
run_config_override: Optional[Dict[str, Any]],
fail_on_run_error: bool,
max_wait_time_seconds: Optional[int] = None,
poll_interval_seconds: Optional[int] = None) -> Any
Executes the attack strategy.
extract_attack_and_run_ids_from_initiate_response
def extract_attack_and_run_ids_from_initiate_response(
response: httpx.Response,
attack_type_for_error_msg: str = "attack"
) -> Tuple[str, Optional[str]]
Orchestrates the extraction of attack_id and optionally associated_run_id from an Attack creation response.
AdvPrefix Objects
class AdvPrefix(AttackStrategy)
Strategy for 'advprefix' attacks.
execute
def execute(attack_config: Dict[str, Any],
run_config_override: Optional[Dict[str, Any]],
fail_on_run_error: bool) -> Any
Executes the AdvPrefix attack. This involves:
- Creating an Attack record on the server.
- Creating a Run record on the server associated with the Attack.
- Executing the local AdvPrefix logic (e.g., notebook steps).
- Potentially updating the server Run/Attack with results or status.