<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# Vulnerability Remediation Workflows — API Reference

## Tenable.io API

```python
import requests

TIO_URL = "https://cloud.tenable.com"
TIO_KEYS = {"X-ApiKeys": "accessKey=XXXX;secretKey=YYYY"}

# List scans
resp = requests.get(f"{TIO_URL}/scans", headers=TIO_KEYS)

# Get scan results
resp = requests.get(f"{TIO_URL}/scans/{scan_id}", headers=TIO_KEYS)

# Export vulnerabilities
resp = requests.post(f"{TIO_URL}/vulns/export", headers=TIO_KEYS, json={
    "filters": {"severity": ["critical", "high"]},
    "num_assets": 500,
})
```

## Qualys VMDR API

```python
# Launch scan
requests.post("https://qualysapi.qualys.com/api/2.0/fo/scan/", auth=("user", "pass"),
    data={"action": "launch", "scan_title": "Weekly vuln scan", "ip": "10.0.0.0/24"})

# Download scan results
requests.post("https://qualysapi.qualys.com/api/2.0/fo/scan/", auth=("user", "pass"),
    data={"action": "fetch", "scan_ref": "scan/12345", "output_format": "json"})
```

## Jira Ticket Creation

```python
from jira import JIRA

jira = JIRA(server="https://jira.corp.local", basic_auth=("svc-vuln", "token"))
issue = jira.create_issue(
    project="VULN",
    summary="CVE-2024-3094: XZ Utils backdoor — web-01, web-02",
    description="CVSS 10.0 | Exploit available | Remediation: upgrade xz-utils >= 5.6.1-2",
    issuetype={"name": "Vulnerability"},
    priority={"name": "Critical"},
)
```

## Risk Score Formula

```
risk_score = min(CVSS × criticality_weight × exploit_multiplier × exposure_multiplier, 10.0)

criticality_weight: mission-critical=1.0, high=0.8, standard=0.5, low=0.2
exploit_multiplier: exploit_available ? 1.3 : 1.0
exposure_multiplier: internet_facing ? 1.2 : 1.0
```

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | Workflow completed successfully |
| 1 | SLA violations detected |
| 2 | Ingestion or ticket creation failed |
