-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
notifications.go
35 lines (27 loc) · 756 Bytes
/
notifications.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"strings"
"github.com/containrrr/shoutrrr"
"github.com/containrrr/shoutrrr/pkg/types"
)
func send_notification(message string, screenshot_url string, correlated_request string) {
notify_urls := get_env("NOTIFY")
if notify_urls == "" {
return
}
if !get_send_alerts() {
return
}
message_with_screenshot := message + " " + screenshot_url
if correlated_request != "No correlated request found for this injection." {
message_with_screenshot += " At " + correlated_request
}
urls := strings.Split(notify_urls, ",")
sender, err := shoutrrr.CreateSender(urls...)
params := &types.Params{}
sender.Send(message_with_screenshot, params)
if err != nil {
fmt.Println("Error sending notification:", err)
}
}