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

## Nessus REST API

### Authentication

```bash
# API key authentication (recommended)
curl -sk "https://NESSUS_HOST:8834/scans" \
  -H "X-ApiKeys: accessKey=ACCESS_KEY; secretKey=SECRET_KEY"

# Session token authentication
curl -sk -X POST "https://NESSUS_HOST:8834/session" \
  -H "Content-Type: application/json" \
  -d '{"username": "admin", "password": "password"}' | jq '.token'
```

### Scan Management

```bash
# List all scans
curl -sk "$NESSUS_URL/scans" -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" | jq '.scans[]'

# Create scan
curl -sk -X POST "$NESSUS_URL/scans" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" \
  -H "Content-Type: application/json" \
  -d '{"uuid": "TEMPLATE_UUID", "settings": {"name": "Scan", "text_targets": "10.0.0.0/24"}}'

# Launch scan
curl -sk -X POST "$NESSUS_URL/scans/SCAN_ID/launch" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"

# Pause scan
curl -sk -X POST "$NESSUS_URL/scans/SCAN_ID/pause" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"

# Stop scan
curl -sk -X POST "$NESSUS_URL/scans/SCAN_ID/stop" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"

# Get scan details and results
curl -sk "$NESSUS_URL/scans/SCAN_ID" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" | jq '.vulnerabilities[]'

# Delete scan
curl -sk -X DELETE "$NESSUS_URL/scans/SCAN_ID" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"
```

### Export and Download

```bash
# Export scan (formats: nessus, csv, html, pdf)
curl -sk -X POST "$NESSUS_URL/scans/SCAN_ID/export" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" \
  -H "Content-Type: application/json" \
  -d '{"format": "nessus"}' | jq '.file'

# Check export status
curl -sk "$NESSUS_URL/scans/SCAN_ID/export/FILE_ID/status" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"

# Download exported file
curl -sk "$NESSUS_URL/scans/SCAN_ID/export/FILE_ID/download" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" -o results.nessus
```

### Plugin Management

```bash
# List plugin families
curl -sk "$NESSUS_URL/plugins/families" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" | jq '.families[]'

# Get plugin details
curl -sk "$NESSUS_URL/plugins/plugin/PLUGIN_ID" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"
```

## Tenable.io API

### Key Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| `GET` | `/scans` | List all scans |
| `POST` | `/scans` | Create new scan |
| `POST` | `/scans/{id}/launch` | Launch scan |
| `GET` | `/scans/{id}` | Get scan details |
| `POST` | `/scans/{id}/export` | Export results |
| `GET` | `/workbenches/vulnerabilities` | Vulnerability workbench |
| `GET` | `/workbenches/assets` | Asset workbench |

### Vulnerability Workbench

```bash
# List vulnerabilities (Tenable.io)
curl -s "https://cloud.tenable.com/workbenches/vulnerabilities" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK" \
  -H "Accept: application/json" | jq '.vulnerabilities[] | select(.severity >= 3)'

# Get vulnerability details
curl -s "https://cloud.tenable.com/workbenches/vulnerabilities/PLUGIN_ID/info" \
  -H "X-ApiKeys: accessKey=$AK; secretKey=$SK"
```

## Severity Reference

| Nessus Severity | CVSS Range | Label |
|----------------|------------|-------|
| 0 | N/A | Informational |
| 1 | 0.1–3.9 | Low |
| 2 | 4.0–6.9 | Medium |
| 3 | 7.0–8.9 | High |
| 4 | 9.0–10.0 | Critical |
