crowdsec-notifications : fix formatting

This commit is contained in:
minoplhy 2024-03-23 15:26:18 +07:00
parent bc200b5f3b
commit 248b4dab9e
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF
7 changed files with 10 additions and 19 deletions

View File

@ -3,5 +3,5 @@ Crowdsec Notification for Discord and Line
**Remember to replace placeholder line with your authentication keys!**
![Discord Example](img/Discord_94N3DVisn8.png)
![Line Example](img/LINE_Q5uZ32zoph.png)
![Discord Example](img/Discord.png)
![Line Example](img/Line.png)

View File

@ -11,20 +11,11 @@ format: |
{{range . -}}
{{$alert := . -}}
{{range .Decisions -}}
{{if $alert.Source.Cn -}}
{
"title": "{{.Scenario}}",
"description": ":flag_{{ $alert.Source.Cn | lower }}: {{$alert.Source.IP}}\n Hostname: {{Hostname}}\nAS{{ $alert.Source.AsNumber }}: {{ $alert.Source.AsName }}\nAction: {{.Type}} {{.Duration}}\nLinks: [CTI](https://app.crowdsec.net/cti/{{$alert.Source.IP}}) | [Shodan](https://www.shodan.io/host/{{$alert.Source.IP}})",
"description": "{{if $alert.Source.Cn -}}:flag_{{ $alert.Source.Cn | lower }}:{{end}}{{if not $alert.Source.Cn -}}:pirate_flag:{{end}} {{$alert.Source.IP}}\nCount : {{ $alert.EventsCount }}\n{{if $alert.Source.AsNumber -}}AS{{ $alert.Source.AsNumber }}: {{ $alert.Source.AsName }}{{else}}AS: N/A{{end}}\nAction: {{.Type}} {{.Duration}} on {{ Hostname }}\nStart: {{ $alert.StartAt }}\nStop: {{ $alert.StopAt }}",
"color": "16711680"
}
{{end}}
{{if not $alert.Source.Cn -}}
{
"title": "{{.Scenario}}",
"description": ":pirate_flag: {{$alert.Source.IP}}\nHostname: {{Hostname}}\nAS{{ $alert.Source.AsNumber }}: {{ $alert.Source.AsName }}\nAction: {{.Type}} {{.Duration}}\nLinks: [CTI](https://app.crowdsec.net/cti/{{$alert.Source.IP}}) | [Shodan](https://www.shodan.io/host/{{$alert.Source.IP}})",
"color": "16711680"
}
{{end}}
{{end -}}
{{end -}}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -9,13 +9,13 @@ format: |
{{range . -}}{{$alert := . -}}{{range .Decisions -}}
[ *{{.Scenario}}* ]
{{if $alert.Source.Cn -}}{{ $alert.Source.Cn }}{{end}}{{if not $alert.Source.Cn -}}N/A{{end}} {{$alert.Source.IP}}
Hostname: {{Hostname}}
AS{{ $alert.Source.AsNumber }}: {{ $alert.Source.AsName }}
Action: {{.Type}} {{.Duration}}
Links: https://app.crowdsec.net/cti/{{$alert.Source.IP}}
Links: https://www.shodan.io/host/{{$alert.Source.IP}}
{{end -}}
{{end -}}
{{if $alert.Source.AsNumber -}}AS{{ $alert.Source.AsNumber }}: {{ $alert.Source.AsName }}{{else}}AS: N/A{{end}}
Action: {{.Type}} {{.Duration}} on {{ Hostname }}
Count : {{ $alert.EventsCount }}
Start:
{{ $alert.StartAt }}
Stop:
{{ $alert.StopAt }}{{end -}}{{end -}}
url: https://notify-api.line.me/api/notify