Metadata-Version: 2.4
Name: bjhunt
Version: 1.0.0
Summary: Official Python client for the BJHUNT Enterprise API
License: UNLICENSED
Keywords: api,bjhunt,offensive-security,pentest,sdk,security
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# bjhunt (Python)

Official Python client for the **BJHUNT Enterprise API**. Standard library only —
no third-party dependencies.

> The API is available on the **Enterprise** plan only. Create an API key from the
> dashboard → **Settings → API Keys** (shown once, starts with `bjh_`).

## Install

```bash
pip install bjhunt
```

## Quickstart

```python
import os, time
from bjhunt import BjhuntClient

bj = BjhuntClient(api_key=os.environ["BJHUNT_API_KEY"])

# Launch an autonomous audit.
scan = bj.scans.create(
    target="https://acme.example.com",
    compliances_required=["owasp-asvs-5", "pci-dss-v4"],
)
scan_id = scan["scanId"]

# Poll for completion (or subscribe to the scan.completed webhook).
while bj.scans.get(scan_id)["scan"]["status"] in ("pending", "running"):
    time.sleep(10)

findings = bj.scans.findings(scan_id, severity="critical")["findings"]
report = bj.scans.report(scan_id, fmt="md")
```

## API

- `scans.create(target, scope=None, compliances_required=None, model=None, report_languages=None, asvs_target_level=None, kind=None, prompt=None)`
- `scans.list(status=None, limit=50, offset=0)`
- `scans.get(scan_id)`
- `scans.findings(scan_id, severity=None, limit=100, offset=0)`
- `scans.report(scan_id, compliance=None, fmt="md")` → report text
- `scans.delete(scan_id)`

Errors raise `BjhuntApiError` with `.status`, `.message`, `.code`.

## Webhooks

Verify the `X-BJHUNT-Signature` header against the **raw** request body:

```python
from bjhunt import parse_webhook

event = parse_webhook(raw_body_bytes, request.headers.get("X-BJHUNT-Signature"), WEBHOOK_SECRET)
if event["event"] == "scan.completed":
    ...
```
