From 8fed52a5d9e04af27e97b939307145975758cd0c Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Mon, 11 Feb 2019 14:33:03 +0200 Subject: [PATCH] Hotfix re add user post breach --- .../infection_monkey/post_breach/add_user.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/monkey/infection_monkey/post_breach/add_user.py b/monkey/infection_monkey/post_breach/add_user.py index b8cb9a027..94aa210e4 100644 --- a/monkey/infection_monkey/post_breach/add_user.py +++ b/monkey/infection_monkey/post_breach/add_user.py @@ -23,14 +23,17 @@ class BackdoorUser(object): def act(self): LOG.info("Adding a user") - if sys.platform.startswith("win"): - retval = self.add_user_windows() - else: - retval = self.add_user_linux() - if retval != 0: - LOG.warn("Failed to add a user") - else: - LOG.info("Done adding user") + try: + if sys.platform.startswith("win"): + retval = self.add_user_windows() + else: + retval = self.add_user_linux() + if retval != 0: + LOG.warn("Failed to add a user") + else: + LOG.info("Done adding user") + except OSError: + LOG.exception("Exception while adding a user") @staticmethod def add_user_linux():