diff --git a/monkey/monkey_island/cc/services/infection_lifecycle.py b/monkey/monkey_island/cc/services/infection_lifecycle.py index ca6e36924..23207e982 100644 --- a/monkey/monkey_island/cc/services/infection_lifecycle.py +++ b/monkey/monkey_island/cc/services/infection_lifecycle.py @@ -23,8 +23,16 @@ def set_stop_all(time: float): agent_controls.save() -def was_monkey_killed(guid: int) -> bool: +def should_agent_die(guid: int) -> bool: monkey = Monkey.objects(guid=guid).first() + return _is_monkey_marked_dead(monkey) or _is_monkey_killed_manually() + + +def _is_monkey_marked_dead(monkey: Monkey) -> bool: + return monkey.config.alive + + +def _is_monkey_killed_manually(monkey: Monkey) -> bool: if monkey.has_parent(): launch_timestamp = monkey.get_parent().launch_time else: