add crowdsec formatter
This commit is contained in:
parent
3c2b2d346c
commit
7ff165a6f7
1 changed files with 11 additions and 0 deletions
11
matrix_webhook/formatters/crowdsec.py
Normal file
11
matrix_webhook/formatters/crowdsec.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
def formatter(data, headers):
|
||||
""" format a message sent with crowdsec http endpoints"""
|
||||
data_out = ""
|
||||
for row in data["body"]:
|
||||
if "crowdsecurity" in row['scenario']:
|
||||
source, scenario, *_ = row['scenario'].split('/')
|
||||
row['scenario'] = f"[{scenario}](https://hub.crowdsec.net/author/crowdsecurity/configurations/{scenario})"
|
||||
data_out += f"{row['host']} has been banned {row['duration']} due to {row['scenario']}\n\n[AbuseIPDB](https://www.abuseipdb.com/check{row['host'])"
|
||||
data["body"] = data_out
|
||||
return data
|
||||
|
Loading…
Reference in a new issue