refactor to remove config_files in favor of db
This commit is contained in:
@@ -720,7 +720,7 @@ Retrieve a paginated list of scans with optional status filtering.
|
||||
"duration": 125.5,
|
||||
"status": "completed",
|
||||
"title": "Production Network Scan",
|
||||
"config_file": "/app/configs/production.yaml",
|
||||
"config_id": "/app/configs/production.yaml",
|
||||
"triggered_by": "manual",
|
||||
"started_at": "2025-11-14T10:30:00Z",
|
||||
"completed_at": "2025-11-14T10:32:05Z"
|
||||
@@ -731,7 +731,7 @@ Retrieve a paginated list of scans with optional status filtering.
|
||||
"duration": 98.2,
|
||||
"status": "completed",
|
||||
"title": "Development Network Scan",
|
||||
"config_file": "/app/configs/dev.yaml",
|
||||
"config_id": "/app/configs/dev.yaml",
|
||||
"triggered_by": "scheduled",
|
||||
"started_at": "2025-11-13T15:00:00Z",
|
||||
"completed_at": "2025-11-13T15:01:38Z"
|
||||
@@ -793,7 +793,7 @@ Retrieve complete details for a specific scan, including all sites, IPs, ports,
|
||||
"duration": 125.5,
|
||||
"status": "completed",
|
||||
"title": "Production Network Scan",
|
||||
"config_file": "/app/configs/production.yaml",
|
||||
"config_id": "/app/configs/production.yaml",
|
||||
"json_path": "/app/output/scan_report_20251114_103000.json",
|
||||
"html_path": "/app/output/scan_report_20251114_103000.html",
|
||||
"zip_path": "/app/output/scan_report_20251114_103000.zip",
|
||||
@@ -1111,7 +1111,7 @@ Retrieve a list of all schedules with pagination and filtering.
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-scan.yaml",
|
||||
"config_id": "/app/configs/prod-scan.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2025-11-01T10:00:00Z",
|
||||
@@ -1157,7 +1157,7 @@ Retrieve details for a specific schedule including execution history.
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-scan.yaml",
|
||||
"config_id": "/app/configs/prod-scan.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2025-11-01T10:00:00Z",
|
||||
@@ -1201,7 +1201,7 @@ Create a new scheduled scan.
|
||||
```json
|
||||
{
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-scan.yaml",
|
||||
"config_id": "/app/configs/prod-scan.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true
|
||||
}
|
||||
@@ -1215,7 +1215,7 @@ Create a new scheduled scan.
|
||||
"schedule": {
|
||||
"id": 1,
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-scan.yaml",
|
||||
"config_id": "/app/configs/prod-scan.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2025-11-01T10:00:00Z"
|
||||
@@ -1228,7 +1228,7 @@ Create a new scheduled scan.
|
||||
*400 Bad Request* - Missing required fields or invalid cron expression:
|
||||
```json
|
||||
{
|
||||
"error": "Missing required fields: name, config_file"
|
||||
"error": "Missing required fields: name, config_id"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1236,7 +1236,7 @@ Create a new scheduled scan.
|
||||
```bash
|
||||
curl -X POST http://localhost:5000/api/schedules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"Daily Scan","config_file":"/app/configs/prod.yaml","cron_expression":"0 2 * * *"}' \
|
||||
-d '{"name":"Daily Scan","config_id":"/app/configs/prod.yaml","cron_expression":"0 2 * * *"}' \
|
||||
-b cookies.txt
|
||||
```
|
||||
|
||||
@@ -1270,7 +1270,7 @@ Update an existing schedule.
|
||||
"schedule": {
|
||||
"id": 1,
|
||||
"name": "Updated Schedule Name",
|
||||
"config_file": "/app/configs/prod-scan.yaml",
|
||||
"config_id": "/app/configs/prod-scan.yaml",
|
||||
"cron_expression": "0 3 * * *",
|
||||
"enabled": false,
|
||||
"updated_at": "2025-11-15T10:00:00Z"
|
||||
@@ -1512,7 +1512,7 @@ Get historical trend data for scans with the same configuration.
|
||||
],
|
||||
"labels": ["2025-11-10 12:00", "2025-11-15 12:00"],
|
||||
"port_counts": [25, 26],
|
||||
"config_file": "/app/configs/prod-scan.yaml"
|
||||
"config_id": "/app/configs/prod-scan.yaml"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ Machine-readable scan data with all discovered services, ports, and SSL/TLS info
|
||||
"title": "Scan Title",
|
||||
"scan_time": "2025-01-15T10:30:00Z",
|
||||
"scan_duration": 95.3,
|
||||
"config_file": "/app/configs/example-site.yaml",
|
||||
"config_id": "/app/configs/example-site.yaml",
|
||||
"sites": [
|
||||
{
|
||||
"name": "Site Name",
|
||||
|
||||
@@ -607,7 +607,7 @@ curl -X DELETE http://localhost:5000/api/configs/test-network.yaml \
|
||||
# Trigger a scan
|
||||
curl -X POST http://localhost:5000/api/scans \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"config_file": "/app/configs/prod-network.yaml"}' \
|
||||
-d '{"config_id": "/app/configs/prod-network.yaml"}' \
|
||||
-b cookies.txt
|
||||
|
||||
# List all scans
|
||||
@@ -639,7 +639,7 @@ curl -X POST http://localhost:5000/api/schedules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"name": "Daily Production Scan",
|
||||
"config_file": "/app/configs/prod-network.yaml",
|
||||
"config_id": "/app/configs/prod-network.yaml",
|
||||
"cron_expression": "0 2 * * *",
|
||||
"enabled": true
|
||||
}' \
|
||||
|
||||
@@ -46,7 +46,7 @@ Stores metadata about each scan execution.
|
||||
| `timestamp` | DATETIME | Scan start time (UTC) |
|
||||
| `duration` | FLOAT | Total scan duration (seconds) |
|
||||
| `status` | VARCHAR(20) | `running`, `completed`, `failed` |
|
||||
| `config_file` | TEXT | Path to YAML config used |
|
||||
| `config_id` | INTEGER | FK to scan_configs table |
|
||||
| `title` | TEXT | Scan title from config |
|
||||
| `json_path` | TEXT | Path to JSON report |
|
||||
| `html_path` | TEXT | Path to HTML report |
|
||||
@@ -144,7 +144,7 @@ Scheduled scan configurations.
|
||||
|--------|------|-------------|
|
||||
| `id` | INTEGER PRIMARY KEY | Unique schedule ID |
|
||||
| `name` | VARCHAR(255) | Schedule name (e.g., "Daily prod scan") |
|
||||
| `config_file` | TEXT | Path to YAML config |
|
||||
| `config_id` | INTEGER | FK to scan_configs table |
|
||||
| `cron_expression` | VARCHAR(100) | Cron-like schedule (e.g., `0 2 * * *`) |
|
||||
| `enabled` | BOOLEAN | Is schedule active? |
|
||||
| `last_run` | DATETIME | Last execution time |
|
||||
@@ -214,7 +214,7 @@ All API endpoints return JSON and follow RESTful conventions.
|
||||
|--------|----------|-------------|--------------|----------|
|
||||
| `GET` | `/api/scans` | List all scans (paginated) | - | `{ "scans": [...], "total": N, "page": 1 }` |
|
||||
| `GET` | `/api/scans/{id}` | Get scan details | - | `{ "scan": {...} }` |
|
||||
| `POST` | `/api/scans` | Trigger new scan | `{ "config_file": "path" }` | `{ "scan_id": N, "status": "running" }` |
|
||||
| `POST` | `/api/scans` | Trigger new scan | `{ "config_id": "path" }` | `{ "scan_id": N, "status": "running" }` |
|
||||
| `DELETE` | `/api/scans/{id}` | Delete scan and files | - | `{ "status": "deleted" }` |
|
||||
| `GET` | `/api/scans/{id}/status` | Get scan status | - | `{ "status": "running", "progress": "45%" }` |
|
||||
| `GET` | `/api/scans/{id1}/compare/{id2}` | Compare two scans | - | `{ "diff": {...} }` |
|
||||
@@ -225,7 +225,7 @@ All API endpoints return JSON and follow RESTful conventions.
|
||||
|--------|----------|-------------|--------------|----------|
|
||||
| `GET` | `/api/schedules` | List all schedules | - | `{ "schedules": [...] }` |
|
||||
| `GET` | `/api/schedules/{id}` | Get schedule details | - | `{ "schedule": {...} }` |
|
||||
| `POST` | `/api/schedules` | Create new schedule | `{ "name": "...", "config_file": "...", "cron_expression": "..." }` | `{ "schedule_id": N }` |
|
||||
| `POST` | `/api/schedules` | Create new schedule | `{ "name": "...", "config_id": "...", "cron_expression": "..." }` | `{ "schedule_id": N }` |
|
||||
| `PUT` | `/api/schedules/{id}` | Update schedule | `{ "enabled": true, "cron_expression": "..." }` | `{ "status": "updated" }` |
|
||||
| `DELETE` | `/api/schedules/{id}` | Delete schedule | - | `{ "status": "deleted" }` |
|
||||
| `POST` | `/api/schedules/{id}/trigger` | Manually trigger scheduled scan | - | `{ "scan_id": N }` |
|
||||
@@ -438,7 +438,7 @@ alert_rules:
|
||||
"scan_id": 123,
|
||||
"title": "Production Network Scan",
|
||||
"timestamp": "2025-11-17T14:15:00Z",
|
||||
"config_file": "prod_config.yaml",
|
||||
"config_id": "prod_config.yaml",
|
||||
"triggered_by": "scheduled"
|
||||
},
|
||||
"alert_details": {
|
||||
|
||||
Reference in New Issue
Block a user