2024-05-08 01:56:48 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2024-05-09 12:24:44 +02:00
|
|
|
"bufio"
|
|
|
|
|
"encoding/json"
|
|
|
|
|
"os"
|
2024-05-08 01:56:48 +02:00
|
|
|
"strings"
|
|
|
|
|
"wazuh-notify/notification"
|
|
|
|
|
"wazuh-notify/types"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var inputParams types.Params
|
2024-05-09 12:24:44 +02:00
|
|
|
var wazuhData types.WazuhMessage
|
2024-05-08 01:56:48 +02:00
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
initNotify()
|
2024-05-09 12:24:44 +02:00
|
|
|
|
|
|
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
|
|
|
|
|
|
json.NewDecoder(reader).Decode(&wazuhData) //todo for later
|
|
|
|
|
|
|
|
|
|
text, _ := reader.ReadString('\n') //todo for testing
|
|
|
|
|
inputParams.Message = text
|
|
|
|
|
|
2024-05-08 01:56:48 +02:00
|
|
|
for _, target := range strings.Split(inputParams.Targets, ",") {
|
|
|
|
|
switch target {
|
|
|
|
|
case "discord":
|
|
|
|
|
notification.SendDiscord(inputParams)
|
|
|
|
|
case "ntfy":
|
|
|
|
|
notification.SendNtfy(inputParams)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|