chore: fix bug

This commit is contained in:
Nuxgrid
2026-07-19 17:56:59 +02:00
parent f1c4f18931
commit 224fa9c3cb
7 changed files with 11 additions and 360 deletions
+11 -11
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Crée le dashboard "Securite - Alertes Web et CrowdSec" dans OpenSearch Dashboards (Wazuh).
Crée le dashboard "Securite - Alertes Web et Firewall" dans OpenSearch Dashboards (Wazuh).
Usage:
python3 create-dashboard.py
@@ -28,8 +28,8 @@ INDEX_PATTERN = "wazuh-alerts-*"
# ── Queries de filtre ─────────────────────────────────────────────────────────
Q_WEB = "rule.groups: web OR rule.groups: attack OR rule.groups: modsecurity OR rule.groups: api_brute_force"
Q_CS = "rule.groups: crowdsec OR rule.groups: crowdsec_ban"
Q_ALL = Q_WEB + " OR " + Q_CS
Q_FW = "rule.id: 651"
Q_ALL = Q_WEB + " OR " + Q_FW
# ── Client HTTP ───────────────────────────────────────────────────────────────
ctx = ssl.create_default_context()
@@ -85,9 +85,9 @@ VISUALIZATIONS = [
},
{
"id": "sec-cs-count",
"title": "[Securite] CrowdSec - Total Bans",
"title": "[Securite] Firewall - Total Bans",
"type": "metric",
"query": Q_CS,
"query": Q_FW,
"visState": {
"type": "metric",
"params": {
@@ -99,7 +99,7 @@ VISUALIZATIONS = [
"colorsRange": [{"from": 0, "to": 5}, {"from": 5, "to": 50}, {"from": 50, "to": 9999}],
"labels": {"show": True},
"invertColors": False,
"style": {"bgFill": "#000", "bgColor": False, "labelColor": False, "subText": "bans crowdsec", "fontSize": 60},
"style": {"bgFill": "#000", "bgColor": False, "labelColor": False, "subText": "bans firewall", "fontSize": 60},
}
},
"aggs": [{"id": "1", "enabled": True, "type": "count", "schema": "metric", "params": {}}],
@@ -163,9 +163,9 @@ VISUALIZATIONS = [
},
{
"id": "sec-cs-bans-table",
"title": "[Securite] CrowdSec - IPs Bannies",
"title": "[Securite] Firewall - IPs Bannies",
"type": "table",
"query": Q_CS,
"query": Q_FW,
"visState": {
"type": "table",
"params": {"perPage": 20, "showPartialRows": False, "showMetricsAtAllLevels": False, "sort": {"columnIndex": None, "direction": None}, "showTotal": False, "totalFunc": "sum"},
@@ -206,7 +206,7 @@ PANELS = [
# ── Main ──────────────────────────────────────────────────────────────────────
def main():
print("=== Création du dashboard Securite - Alertes Web et CrowdSec ===\n")
print("=== Création du dashboard Securite - Alertes Web et Firewall ===\n")
# Visualisations
for viz in VISUALIZATIONS:
@@ -231,8 +231,8 @@ def main():
# Dashboard
dashboard_body = {
"attributes": {
"title": "Securite - Alertes Web et CrowdSec",
"description": "Alertes OWASP ModSecurity brute-force API et bans CrowdSec",
"title": "Securite - Alertes Web et Firewall",
"description": "Alertes OWASP ModSecurity brute-force API et bans Firewall",
"panelsJSON": json.dumps(PANELS),
"optionsJSON": json.dumps({"useMargins": True, "hidePanelTitles": False}),
"timeRestore": False,