hackagent.attacks.registry
Attack technique registry.
This module registers all available attack techniques as concrete orchestrators using a factory function to eliminate boilerplate code.
The factory dynamically creates orchestrator classes that configure:
- attack_type: String identifier for the attack
- attack_impl_class: BaseAttack subclass implementing the algorithm
To add a new attack:
- Implement BaseAttack subclass in techniques/your_attack/
- Register here using create_orchestrator()
- Add to ATTACK_REGISTRY dict
create_orchestrator
def create_orchestrator(
attack_name: str,
attack_impl_class: Type[BaseAttack],
custom_setup: Optional[Callable] = None) -> Type[AttackOrchestrator]
Factory function to create orchestrator classes dynamically.
This eliminates repetitive class definitions while maintaining clean architecture separation between orchestration and attack algorithms.
Arguments:
attack_name- Attack identifier (e.g., "AdvPrefix")attack_impl_class- BaseAttack subclass implementing the techniquecustom_setup- Optional method for specialized kwargs preparationSignature- (self, attack_config, run_config_override) -> Dict[str, Any]
Returns:
Orchestrator class configured for this attack technique
Example:
>>> MyOrchestrator = create_orchestrator("MyAttack", MyAttackClass) >>> orchestrator = MyOrchestrator(hackagent_agent) >>> results = orchestrator.execute(attack_config)