From 129fd7d2de5be365717c3e9aa74753d30e18bac1 Mon Sep 17 00:00:00 2001 From: Shay Nehmad Date: Thu, 3 Oct 2019 15:08:55 +0300 Subject: [PATCH] Not using new_user.username as it causes exception NoneType --- .../post_breach/actions/communicate_as_new_user.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/post_breach/actions/communicate_as_new_user.py b/monkey/infection_monkey/post_breach/actions/communicate_as_new_user.py index 034383140..213682fc7 100644 --- a/monkey/infection_monkey/post_breach/actions/communicate_as_new_user.py +++ b/monkey/infection_monkey/post_breach/actions/communicate_as_new_user.py @@ -47,12 +47,12 @@ class CommunicateAsNewUser(PBA): def communicate_as_new_user_linux(self, username): try: - with create_auto_new_user(username, PASSWORD, False) as new_user: + with create_auto_new_user(username, PASSWORD, False) as _: commandline = "sudo -u {username} ping -c 1 {domain}".format( - username=new_user.username, + username=username, domain=PING_TEST_DOMAIN) exit_status = os.system(commandline) - self.send_ping_result_telemetry(exit_status, commandline, new_user.username) + self.send_ping_result_telemetry(exit_status, commandline, username) except subprocess.CalledProcessError as e: PostBreachTelem(self, (e.output, False)).send()