From 2d48001f7b5986322f5d629ee86fd436e53a5bd5 Mon Sep 17 00:00:00 2001 From: ophirharpazg Date: Thu, 27 Aug 2020 19:47:38 +0300 Subject: [PATCH] log exceptions in exploit_host --- monkey/infection_monkey/exploit/HostExploiter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/infection_monkey/exploit/HostExploiter.py b/monkey/infection_monkey/exploit/HostExploiter.py index 50f4167d8..69f0b2fcf 100644 --- a/monkey/infection_monkey/exploit/HostExploiter.py +++ b/monkey/infection_monkey/exploit/HostExploiter.py @@ -1,3 +1,4 @@ +import logging from abc import abstractmethod from infection_monkey.config import WormConfiguration @@ -10,6 +11,9 @@ import infection_monkey.exploit __author__ = 'itamar' +logger = logging.getLogger(__name__) + + class HostExploiter(Plugin): @staticmethod def should_run(class_name): @@ -67,8 +71,11 @@ class HostExploiter(Plugin): def exploit_host(self): self.pre_exploit() + result = None try: result = self._exploit_host() + except Exception as e: + logger.warning(f'Exception in exploit_host: {e}') finally: self.post_exploit() return result