Skip to main content

hackagent.client

Facade (depth 2).

HackAgent is constructed from :class:~hackagent.core.settings.Settings and reads what past runs recorded: campaigns, runs, results, agents and the catalogs. Running an attack is a campaign — :func:~hackagent.orchestrator.campaign.run_campaign — and there is no second way to do it. Interfaces talk only to this module and the public types re-exported from :mod:hackagent.

primary_dataset​

def primary_dataset() -> Optional[str]

Preset used by the default jailbreak campaign when none is chosen.

primary_attacks​

def primary_attacks() -> List[str]

Jailbreak campaign technique ids hack can execute, in order.

Both halves count: a migrated technique runs on the campaign runner and the rest on the legacy pipeline. A technique neither can run is dropped, so a chain built from this never fails on its first step.

presets​

def presets() -> Dict[str, Dict[str, Any]]

Built-in dataset presets, keyed by name.

preset​

def preset(name: str) -> Dict[str, Any]

Return one preset configuration.

Raises:

  • ValueError - The name is not a known preset.

load_goals​

def load_goals(**kwargs: Any) -> List[Any]

Load goals through the datasets package.

form_fields​

@lru_cache(maxsize=None)
def form_fields(attack_id: str) -> List[Dict[str, Any]]

Flatten a technique's pydantic JSON schema into form fields.

catalog_entries​

@lru_cache(maxsize=1)
def catalog_entries() -> List[Dict[str, Any]]

Registered techniques, in registry order, with form fields.

Command lists and TUI forms are generated from this. It covers both halves of the migration — what the legacy pipeline still runs and what the campaign runner has taken over — because hack runs either.

grouped_catalog​

def grouped_catalog() -> List[tuple[str, str, List[Dict[str, Any]]]]

(category, category_label, entries) in taxonomy order.

plan_attack​

def plan_attack(target: Dict[str, Any], **kwargs: Any) -> Any

Choose a technique, goals and parameters for target.

web_target​

def web_target(url: str, **kwargs: Any) -> tuple[str, Dict[str, Any]]

Build the ("web", operational_config) pair for a live-browser chatbot.

result_bucket​

def result_bucket(status: Optional[str], notes: Optional[str] = None) -> str

Classify a result the same way the store does.

Interfaces use this instead of importing storage bucket constants.

ensure_graphviz​

def ensure_graphviz(*, allow_download: bool = False) -> Optional[str]

Locate or install the Graphviz dot binary used by FC-Attack.

DoctorReport Objects​

@dataclass(frozen=True)
class DoctorReport()

Structured diagnostics for hackagent doctor.

HackAgent Objects​

class HackAgent()

Session over settings and a store. Bind a victim with :meth:target.

campaign_runs​

def campaign_runs(*, page: int = 1, page_size: int = 100) -> Any

List campaign-level runs, including their audit reports.

campaign_run​

def campaign_run(campaign_run_id: Any) -> Any

Retrieve one campaign run and its immutable specification/audit.

delete_run​

def delete_run(run_id: Any) -> None

Delete one run. This is a write; reads never call it.

check_connection​

def check_connection() -> int

Probe the remote API. Local sessions return 0.

doctor​

def doctor() -> DoctorReport

Collect configuration diagnostics, including Graphviz.