webhook templates
This commit is contained in:
9
app/web/templates/webhook_presets/custom_json.j2
Normal file
9
app/web/templates/webhook_presets/custom_json.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"title": "{{ scan.title }} - {{ alert.type|title|replace('_', ' ') }}",
|
||||
"message": "{{ alert.message }}{% if alert.ip_address %} on {{ alert.ip_address }}{% endif %}{% if alert.port %}:{{ alert.port }}{% endif %}",
|
||||
"priority": {% if alert.severity == 'critical' %}5{% elif alert.severity == 'warning' %}3{% else %}1{% endif %},
|
||||
"severity": "{{ alert.severity }}",
|
||||
"scan_id": {{ scan.id }},
|
||||
"alert_id": {{ alert.id }},
|
||||
"timestamp": "{{ timestamp.isoformat() }}"
|
||||
}
|
||||
25
app/web/templates/webhook_presets/default_json.j2
Normal file
25
app/web/templates/webhook_presets/default_json.j2
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"event": "alert.created",
|
||||
"alert": {
|
||||
"id": {{ alert.id }},
|
||||
"type": "{{ alert.type }}",
|
||||
"severity": "{{ alert.severity }}",
|
||||
"message": "{{ alert.message }}",
|
||||
{% if alert.ip_address %}"ip_address": "{{ alert.ip_address }}",{% endif %}
|
||||
{% if alert.port %}"port": {{ alert.port }},{% endif %}
|
||||
"acknowledged": {{ alert.acknowledged|lower }},
|
||||
"created_at": "{{ alert.created_at.isoformat() }}"
|
||||
},
|
||||
"scan": {
|
||||
"id": {{ scan.id }},
|
||||
"title": "{{ scan.title }}",
|
||||
"timestamp": "{{ scan.timestamp.isoformat() }}",
|
||||
"status": "{{ scan.status }}"
|
||||
},
|
||||
"rule": {
|
||||
"id": {{ rule.id }},
|
||||
"name": "{{ rule.name }}",
|
||||
"type": "{{ rule.type }}",
|
||||
"threshold": {{ rule.threshold if rule.threshold else 'null' }}
|
||||
}
|
||||
}
|
||||
41
app/web/templates/webhook_presets/discord.j2
Normal file
41
app/web/templates/webhook_presets/discord.j2
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"username": "SneakyScanner",
|
||||
"embeds": [
|
||||
{
|
||||
"title": "{{ alert.type|title|replace('_', ' ') }} Alert",
|
||||
"description": "{{ alert.message }}",
|
||||
"color": {% if alert.severity == 'critical' %}15158332{% elif alert.severity == 'warning' %}16776960{% else %}3447003{% endif %},
|
||||
"fields": [
|
||||
{
|
||||
"name": "Severity",
|
||||
"value": "{{ alert.severity|upper }}",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Scan",
|
||||
"value": "{{ scan.title }}",
|
||||
"inline": true
|
||||
},
|
||||
{
|
||||
"name": "Rule",
|
||||
"value": "{{ rule.name }}",
|
||||
"inline": false
|
||||
}{% if alert.ip_address %},
|
||||
{
|
||||
"name": "IP Address",
|
||||
"value": "{{ alert.ip_address }}",
|
||||
"inline": true
|
||||
}{% endif %}{% if alert.port %},
|
||||
{
|
||||
"name": "Port",
|
||||
"value": "{{ alert.port }}",
|
||||
"inline": true
|
||||
}{% endif %}
|
||||
],
|
||||
"footer": {
|
||||
"text": "Alert ID: {{ alert.id }} | Scan ID: {{ scan.id }}"
|
||||
},
|
||||
"timestamp": "{{ timestamp.isoformat() }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
13
app/web/templates/webhook_presets/gotify.j2
Normal file
13
app/web/templates/webhook_presets/gotify.j2
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"title": "{{ scan.title }}",
|
||||
"message": "**{{ alert.severity|upper }}**: {{ alert.message }}\n\n**Scan:** {{ scan.title }}\n**Status:** {{ scan.status }}\n**Rule:** {{ rule.name }}{% if alert.ip_address %}\n**IP:** {{ alert.ip_address }}{% endif %}{% if alert.port %}\n**Port:** {{ alert.port }}{% endif %}",
|
||||
"priority": {% if alert.severity == 'critical' %}8{% elif alert.severity == 'warning' %}5{% else %}2{% endif %},
|
||||
"extras": {
|
||||
"client::display": {
|
||||
"contentType": "text/markdown"
|
||||
},
|
||||
"alert_id": {{ alert.id }},
|
||||
"scan_id": {{ scan.id }},
|
||||
"alert_type": "{{ alert.type }}"
|
||||
}
|
||||
}
|
||||
10
app/web/templates/webhook_presets/ntfy.j2
Normal file
10
app/web/templates/webhook_presets/ntfy.j2
Normal file
@@ -0,0 +1,10 @@
|
||||
{{ alert.message }}
|
||||
|
||||
Scan: {{ scan.title }}
|
||||
Rule: {{ rule.name }}
|
||||
Severity: {{ alert.severity|upper }}{% if alert.ip_address %}
|
||||
IP: {{ alert.ip_address }}{% endif %}{% if alert.port %}
|
||||
Port: {{ alert.port }}{% endif %}
|
||||
|
||||
Scan Status: {{ scan.status }}
|
||||
Alert ID: {{ alert.id }}
|
||||
27
app/web/templates/webhook_presets/plain_text.j2
Normal file
27
app/web/templates/webhook_presets/plain_text.j2
Normal file
@@ -0,0 +1,27 @@
|
||||
SNEAKYSCANNER ALERT - {{ alert.severity|upper }}
|
||||
|
||||
Alert: {{ alert.message }}
|
||||
Type: {{ alert.type|title|replace('_', ' ') }}
|
||||
Severity: {{ alert.severity|upper }}
|
||||
|
||||
Scan Information:
|
||||
Title: {{ scan.title }}
|
||||
Status: {{ scan.status }}
|
||||
Duration: {{ scan.duration }}s
|
||||
Triggered By: {{ scan.triggered_by }}
|
||||
|
||||
Rule Information:
|
||||
Name: {{ rule.name }}
|
||||
Type: {{ rule.type }}
|
||||
{% if rule.threshold %} Threshold: {{ rule.threshold }}
|
||||
{% endif %}
|
||||
{% if alert.ip_address %}IP Address: {{ alert.ip_address }}
|
||||
{% endif %}{% if alert.port %}Port: {{ alert.port }}
|
||||
{% endif %}
|
||||
Alert ID: {{ alert.id }}
|
||||
Scan ID: {{ scan.id }}
|
||||
Timestamp: {{ timestamp.strftime('%Y-%m-%d %H:%M:%S UTC') }}
|
||||
|
||||
---
|
||||
Generated by {{ app.name }} v{{ app.version }}
|
||||
{{ app.url }}
|
||||
65
app/web/templates/webhook_presets/presets.json
Normal file
65
app/web/templates/webhook_presets/presets.json
Normal file
@@ -0,0 +1,65 @@
|
||||
[
|
||||
{
|
||||
"id": "default_json",
|
||||
"name": "Default JSON (Current Format)",
|
||||
"description": "Standard webhook payload format matching the current implementation",
|
||||
"format": "json",
|
||||
"content_type": "application/json",
|
||||
"file": "default_json.j2",
|
||||
"category": "general"
|
||||
},
|
||||
{
|
||||
"id": "custom_json",
|
||||
"name": "Custom JSON",
|
||||
"description": "Flexible custom JSON format with configurable title, message, and priority fields",
|
||||
"format": "json",
|
||||
"content_type": "application/json",
|
||||
"file": "custom_json.j2",
|
||||
"category": "general"
|
||||
},
|
||||
{
|
||||
"id": "gotify",
|
||||
"name": "Gotify",
|
||||
"description": "Optimized for Gotify push notification server with markdown support",
|
||||
"format": "json",
|
||||
"content_type": "application/json",
|
||||
"file": "gotify.j2",
|
||||
"category": "service"
|
||||
},
|
||||
{
|
||||
"id": "ntfy",
|
||||
"name": "Ntfy",
|
||||
"description": "Simple text format for Ntfy pub-sub notification service",
|
||||
"format": "text",
|
||||
"content_type": "text/plain",
|
||||
"file": "ntfy.j2",
|
||||
"category": "service"
|
||||
},
|
||||
{
|
||||
"id": "slack",
|
||||
"name": "Slack",
|
||||
"description": "Rich Block Kit format for Slack webhooks with visual formatting",
|
||||
"format": "json",
|
||||
"content_type": "application/json",
|
||||
"file": "slack.j2",
|
||||
"category": "service"
|
||||
},
|
||||
{
|
||||
"id": "discord",
|
||||
"name": "Discord",
|
||||
"description": "Embedded message format for Discord webhooks with color-coded severity",
|
||||
"format": "json",
|
||||
"content_type": "application/json",
|
||||
"file": "discord.j2",
|
||||
"category": "service"
|
||||
},
|
||||
{
|
||||
"id": "plain_text",
|
||||
"name": "Plain Text",
|
||||
"description": "Simple plain text format for logging or basic notification services",
|
||||
"format": "text",
|
||||
"content_type": "text/plain",
|
||||
"file": "plain_text.j2",
|
||||
"category": "general"
|
||||
}
|
||||
]
|
||||
60
app/web/templates/webhook_presets/slack.j2
Normal file
60
app/web/templates/webhook_presets/slack.j2
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"text": "{{ alert.severity|upper }}: {{ alert.message }}",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "header",
|
||||
"text": {
|
||||
"type": "plain_text",
|
||||
"text": "🚨 {{ alert.severity|upper }} Alert: {{ alert.type|title|replace('_', ' ') }}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"fields": [
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*Alert:*\n{{ alert.message }}"
|
||||
},
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*Severity:*\n{{ alert.severity|upper }}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"fields": [
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*Scan:*\n{{ scan.title }}"
|
||||
},
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*Rule:*\n{{ rule.name }}"
|
||||
}
|
||||
]
|
||||
}{% if alert.ip_address or alert.port %},
|
||||
{
|
||||
"type": "section",
|
||||
"fields": [{% if alert.ip_address %}
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*IP Address:*\n{{ alert.ip_address }}"
|
||||
}{% if alert.port %},{% endif %}{% endif %}{% if alert.port %}
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "*Port:*\n{{ alert.port }}"
|
||||
}{% endif %}
|
||||
]
|
||||
}{% endif %},
|
||||
{
|
||||
"type": "context",
|
||||
"elements": [
|
||||
{
|
||||
"type": "mrkdwn",
|
||||
"text": "Scan ID: {{ scan.id }} | Alert ID: {{ alert.id }} | {{ timestamp.strftime('%Y-%m-%d %H:%M:%S UTC') }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user