2024-05-08 01:56:48 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"strings"
|
2024-05-09 15:27:45 +02:00
|
|
|
"wazuh-notify/services"
|
2024-05-27 15:13:11 +02:00
|
|
|
"wazuh-notify/services/log"
|
|
|
|
|
"wazuh-notify/targets/discord"
|
|
|
|
|
"wazuh-notify/targets/ntfy"
|
|
|
|
|
"wazuh-notify/targets/slack"
|
2024-05-08 01:56:48 +02:00
|
|
|
)
|
|
|
|
|
|
2024-06-10 15:14:27 +02:00
|
|
|
// test
|
2024-05-08 01:56:48 +02:00
|
|
|
func main() {
|
2024-05-27 15:49:04 +02:00
|
|
|
//Read config file and .env
|
2024-05-27 15:10:26 +02:00
|
|
|
configParams := services.ReadConfig()
|
2024-05-27 15:49:04 +02:00
|
|
|
//Parse command line flags
|
2024-05-27 15:10:26 +02:00
|
|
|
inputParams := services.ParseFlags(configParams)
|
2024-05-27 15:49:04 +02:00
|
|
|
//Parse wazuh input data from stdin
|
2024-05-27 15:10:26 +02:00
|
|
|
Params := services.ParseWazuhInput(inputParams)
|
|
|
|
|
|
|
|
|
|
for _, target := range strings.Split(Params.General.Targets, ", ") {
|
2024-05-08 01:56:48 +02:00
|
|
|
switch target {
|
|
|
|
|
case "discord":
|
2024-05-09 15:27:45 +02:00
|
|
|
log.Log(target)
|
2024-05-27 15:10:26 +02:00
|
|
|
discord.SendDiscord(Params)
|
2024-05-08 01:56:48 +02:00
|
|
|
case "ntfy":
|
2024-05-09 15:27:45 +02:00
|
|
|
log.Log(target)
|
2024-05-27 15:10:26 +02:00
|
|
|
ntfy.SendNtfy(Params)
|
2024-05-27 11:44:24 +02:00
|
|
|
case "slack":
|
|
|
|
|
log.Log(target)
|
2024-05-27 15:10:26 +02:00
|
|
|
slack.SendSlack(Params)
|
2024-05-08 01:56:48 +02:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-27 11:44:24 +02:00
|
|
|
log.CloseLogFile()
|
2024-05-08 01:56:48 +02:00
|
|
|
}
|