color added to prio map

This commit is contained in:
darius 2024-05-13 14:52:42 +02:00
parent e15c1c9c37
commit 933a125737
3 changed files with 11 additions and 5 deletions

View File

@ -50,27 +50,27 @@ func SendDiscord(params types.Params) {
switch params.Priority { switch params.Priority {
case 1: case 1:
color = 0x339900 color = params.PriorityMaps[4].Color
if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[4].MentionThreshold { if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[4].MentionThreshold {
mention = "@here" mention = "@here"
} }
case 2: case 2:
color = 0x99cc33 color = params.PriorityMaps[3].Color
if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[3].MentionThreshold { if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[3].MentionThreshold {
mention = "@here" mention = "@here"
} }
case 3: case 3:
color = 0xffcc00 color = params.PriorityMaps[2].Color
if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[2].MentionThreshold { if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[2].MentionThreshold {
mention = "@here" mention = "@here"
} }
case 4: case 4:
color = 0xff9966 color = params.PriorityMaps[1].Color
if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[1].MentionThreshold { if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[1].MentionThreshold {
mention = "@here" mention = "@here"
} }
case 5: case 5:
color = 0xcc3300 color = params.PriorityMaps[0].Color
if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[0].MentionThreshold { if params.WazuhMessage.Parameters.Alert.Rule.Firedtimes >= params.PriorityMaps[0].MentionThreshold {
mention = "@here" mention = "@here"
} }

View File

@ -17,6 +17,7 @@ type Params struct {
type PriorityMap struct { type PriorityMap struct {
ThreatMap []int `yaml:"threat_map"` ThreatMap []int `yaml:"threat_map"`
MentionThreshold int `yaml:"mention_threshold"` MentionThreshold int `yaml:"mention_threshold"`
Color int `yaml:"color"`
} }
type Message struct { type Message struct {

View File

@ -19,18 +19,23 @@ priority_map:
- -
threat_map: [15,14,13,12] threat_map: [15,14,13,12]
mention_threshold: 1 mention_threshold: 1
color: 0xcc3300
- -
threat_map: [11,10,9] threat_map: [11,10,9]
mention_threshold: 1 mention_threshold: 1
color: 0xff9966
- -
threat_map: [8,7,6] threat_map: [8,7,6]
mention_threshold: 5 mention_threshold: 5
color: 0xffcc00
- -
threat_map: [5,4] threat_map: [5,4]
mention_threshold: 5 mention_threshold: 5
color: 0x99cc33
- -
threat_map: [3,2,1,0] threat_map: [3,2,1,0]
mention_threshold: 5 mention_threshold: 5
color: 0x339900
sender: "Wazuh (IDS)" sender: "Wazuh (IDS)"