log exceptions in exploit_host

This commit is contained in:
ophirharpazg 2020-08-27 19:47:38 +03:00
parent f3f124ce76
commit 2d48001f7b
1 changed files with 7 additions and 0 deletions

View File

@ -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