added filter based on description

This commit is contained in:
dklein 2024-11-29 11:48:51 +01:00
parent bb4d4cf76f
commit ac5d2babbd
5 changed files with 22 additions and 7 deletions

View File

@ -32,3 +32,4 @@ jobs:
tag_name: Golang-vx.x.x
files: |
wazuh-notify-go/wazuh-notify
wazuh-notify-go/wazuh-notify-config.toml

View File

@ -1,6 +1,6 @@
module wazuh-notify
go 1.22
go 1.23
require (
github.com/BurntSushi/toml v1.4.0

View File

@ -22,4 +22,11 @@ func Filter(params types.Params) {
os.Exit(0)
}
}
for _, description := range params.General.ExcludedDescription {
if strings.Contains(params.WazuhMessage.Parameters.Alert.FullLog, description) {
log.Log("excluded based on description")
log.CloseLogFile()
os.Exit(0)
}
}
}

View File

@ -13,12 +13,13 @@ type Params struct {
}
type General struct {
Targets string `toml:"targets"`
FullAlert string `toml:"full_alert"`
ExcludedRules string `toml:"excluded_rules"`
ExcludedAgents string `toml:"excluded_agents"`
Sender string `toml:"sender"`
Click string `toml:"click"`
Targets string `toml:"targets"`
FullAlert string `toml:"full_alert"`
ExcludedRules string `toml:"excluded_rules"`
ExcludedAgents string `toml:"excluded_agents"`
Sender string `toml:"sender"`
Click string `toml:"click"`
ExcludedDescription []string `toml:"exclude_descriptions"`
}
type PriorityMap struct {
ThreatMap []int `toml:"threat_map"`

View File

@ -14,6 +14,12 @@ full_alert = ""
excluded_rules = "99999, 00000"
excluded_agents = "99999"
# Exclude specific rules by string contained in description
# These settings provide an easier way to disable events from firing the notifiers.
exclude_descriptions = [
""
]
# The next 2 settings are used to add information to the messages.
sender = "Wazuh (IDS)"
click = "https://documentation.wazuh.com/"