Skip to content

Commit

Permalink
Add alert set_as_attacker / set_as_victim for lua alerts on hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Mar 3, 2025
1 parent d9266c0 commit d884c9b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/lua/modules/alert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ function Alert:_build_type_info()
granularity = self.granularity,
score = self.score,
require_attention = self.require_attention,
is_attacker = self.is_attacker,
is_victim = self.is_victim,
device_type = self.device_type,
device_name = self.device_name,
-- Stuff added in subclasses :init
Expand Down Expand Up @@ -200,15 +202,28 @@ end

-- ##############################################

function Alert:set_as_attacker()
self.is_attacker = true
end

function Alert:set_as_victim()
self.is_victim = true
end

-- ##############################################

function Alert:set_attacker(attacker)
self.attacker = attacker
end

function Alert:set_victim(victim)
self.victim = victim
end

function Alert:set_origin(origin)
self.origin = origin
end

function Alert:set_target(target)
self.target = target
end
Expand Down
2 changes: 2 additions & 0 deletions scripts/lua/modules/alerts_api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ function alerts_api.store(entity_info, type_info, when)
entity_val = entity_info.entity_val,
score = type_info.score,
require_attention = type_info.require_attention or false,
is_attacker = type_info.is_attacker or false,
is_victim = type_info.is_victim or false,
device_type = type_info.device_type,
device_name = type_info.device_name,
tstamp = when,
Expand Down

0 comments on commit d884c9b

Please sign in to comment.