diff --git a/CHANGELOG.md b/CHANGELOG.md index 12cd86301..a50e65b37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Changelog](https://keepachangelog.com/en/1.0.0/). - Encryptor breaking with UTF-8 characters. (Passwords in different languages can be submitted in the config successfully now.) #1490 - Mimikatz collector no longer fails if Azure credential collector is disabled. #1512 #1493 +- Unhandled error when "modify shell startup files PBA" is unable to find regular users. #1507 ### Security diff --git a/monkey/infection_monkey/post_breach/actions/modify_shell_startup_files.py b/monkey/infection_monkey/post_breach/actions/modify_shell_startup_files.py index 18990ab11..3283bcc94 100644 --- a/monkey/infection_monkey/post_breach/actions/modify_shell_startup_files.py +++ b/monkey/infection_monkey/post_breach/actions/modify_shell_startup_files.py @@ -20,6 +20,13 @@ class ModifyShellStartupFiles(PBA): def run(self): results = [pba.run() for pba in self.modify_shell_startup_PBA_list()] + if not results: + results = [ + ( + "Modify shell startup files PBA failed: Unable to find any regular users", + False, + ) + ] PostBreachTelem(self, results).send() def modify_shell_startup_PBA_list(self): @@ -61,6 +68,7 @@ class ModifyShellStartupFiles(PBA): output = subprocess.check_output( # noqa: DUO116 self.command, stderr=subprocess.STDOUT, shell=True ).decode() + return output, True except subprocess.CalledProcessError as e: # Return error output of the command