|
| 1 | +# Attack Templates |
| 2 | + |
| 3 | +Attack templates are reusable, project-scoped attack configurations that let operators define common hashcat setups once and reuse them across campaigns. Templates capture the attack mode, resource selections (wordlists, rulelists, masklists), and tags for categorization. |
| 4 | + |
| 5 | +## Video Walkthrough |
| 6 | + |
| 7 | +<video src="demo.mp4" controls width="100%"></video> |
| 8 | + |
| 9 | +*If the video doesn't render, open [demo.mp4](demo.mp4) directly.* |
| 10 | + |
| 11 | +## User Flow |
| 12 | + |
| 13 | +### 1. Sign In |
| 14 | + |
| 15 | +The dashboard requires authentication. Sign in with your credentials to access attack templates. |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | +### 2. Dashboard |
| 20 | + |
| 21 | +After signing in, the dashboard shows an overview of agents, campaigns, tasks, and cracked hashes. The sidebar navigation includes a **Templates** link. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +### 3. Templates -- Empty State |
| 26 | + |
| 27 | +The Templates page shows an empty state when no templates exist, with a **New Template** button available to users with the `admin` or `contributor` role. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +### 4. Create a Template |
| 32 | + |
| 33 | +Clicking **New Template** opens the create form with the following fields: |
| 34 | + |
| 35 | +- **Name** -- unique within the project (enforced by a database constraint) |
| 36 | +- **Description** -- optional free-text description |
| 37 | +- **Hashcat Mode** -- the numeric hashcat attack mode (e.g., 1000 for NTLM) |
| 38 | +- **Wordlist / Rulelist / Masklist** -- dropdowns populated from the project's uploaded resources |
| 39 | +- **Tags** -- comma-separated labels for categorization and filtering |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | +### 5. Fill In Template Details |
| 44 | + |
| 45 | +Here we configure an NTLM dictionary attack with the "Top Passwords" wordlist and "Dive Rules" rulelist, tagged for quick identification. |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +### 6. Template Appears in List |
| 50 | + |
| 51 | +After creation, the template appears in the list table with columns for name, mode, resolved resource names, tags, creation date, and action buttons (Edit / Delete). |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +### 7. Edit a Template |
| 56 | + |
| 57 | +Clicking **Edit** re-opens the form pre-populated with the template's current values. All fields are editable. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +### 8. Updated Template |
| 62 | + |
| 63 | +After saving, the list reflects the updated name. The template can be further edited or deleted. |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +## API Endpoints |
| 68 | + |
| 69 | +| Method | Path | Description | |
| 70 | +|--------|------|-------------| |
| 71 | +| `GET` | `/api/v1/dashboard/attack-templates` | List templates (supports `limit` and `offset` query params) | |
| 72 | +| `POST` | `/api/v1/dashboard/attack-templates` | Create a template | |
| 73 | +| `GET` | `/api/v1/dashboard/attack-templates/:id` | Get a single template | |
| 74 | +| `PATCH` | `/api/v1/dashboard/attack-templates/:id` | Update a template | |
| 75 | +| `DELETE` | `/api/v1/dashboard/attack-templates/:id` | Delete a template | |
| 76 | +| `POST` | `/api/v1/dashboard/attack-templates/import` | Import a template definition | |
| 77 | +| `POST` | `/api/v1/dashboard/attack-templates/:id/instantiate` | Extract an attack payload from a template | |
| 78 | + |
| 79 | +All endpoints require authentication and project scope (`X-Project-Id` header). Create, update, delete, and import require the `admin` or `contributor` role. |
| 80 | + |
| 81 | +## Data Model |
| 82 | + |
| 83 | +Templates are stored in the `attack_templates` table with the following key constraints: |
| 84 | + |
| 85 | +- **Unique name per project** -- `(project_id, name)` unique index prevents duplicate names within a project. Attempts to create or rename to a duplicate return `409 Conflict`. |
| 86 | +- **Foreign keys** -- `project_id`, `hash_type_id`, `wordlist_id`, `rulelist_id`, `masklist_id`, and `created_by` reference their respective tables. |
| 87 | +- **Tags** -- stored as a PostgreSQL `text[]` array. |
0 commit comments