diff --git a/monkey/infection_monkey/exploit/__init__.py b/monkey/infection_monkey/exploit/__init__.py index e039bbb7a..1b59d112f 100644 --- a/monkey/infection_monkey/exploit/__init__.py +++ b/monkey/infection_monkey/exploit/__init__.py @@ -1,4 +1,5 @@ from abc import ABCMeta, abstractmethod +import infection_monkey.config __author__ = 'itamar' @@ -9,7 +10,7 @@ class HostExploiter(object): _TARGET_OS_TYPE = [] def __init__(self, host): - + self._config = infection_monkey.config.WormConfiguration self._exploit_info = {} self._exploit_attempts = [] self.host = host @@ -18,7 +19,7 @@ class HostExploiter(object): return self.host.os.get('type') in self._TARGET_OS_TYPE def send_exploit_telemetry(self, result): - from control import ControlClient + from infection_monkey.control import ControlClient ControlClient.send_telemetry( 'exploit', {'result': result, 'machine': self.host.__dict__, 'exploiter': self.__class__.__name__, diff --git a/monkey/infection_monkey/exploit/elasticgroovy.py b/monkey/infection_monkey/exploit/elasticgroovy.py index 4dbd20e7b..c69e0112b 100644 --- a/monkey/infection_monkey/exploit/elasticgroovy.py +++ b/monkey/infection_monkey/exploit/elasticgroovy.py @@ -9,7 +9,6 @@ import logging import requests -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.model import DROPPER_ARG from infection_monkey.network.elasticfinger import ES_SERVICE, ES_PORT @@ -39,7 +38,6 @@ class ElasticGroovyExploiter(HostExploiter): def __init__(self, host): super(ElasticGroovyExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration self.skip_exist = self._config.skip_exploit_if_file_exist def is_os_supported(self): diff --git a/monkey/infection_monkey/exploit/rdpgrinder.py b/monkey/infection_monkey/exploit/rdpgrinder.py index 6b0110e47..3873a8ce3 100644 --- a/monkey/infection_monkey/exploit/rdpgrinder.py +++ b/monkey/infection_monkey/exploit/rdpgrinder.py @@ -9,7 +9,6 @@ from rdpy.core.error import RDPSecurityNegoFail from rdpy.protocol.rdp import rdp from twisted.internet import reactor -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.exploit.tools import HTTPTools, get_monkey_depth from infection_monkey.exploit.tools import get_target_monkey @@ -238,8 +237,6 @@ class RdpExploiter(HostExploiter): def __init__(self, host): super(RdpExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration - self._guid = infection_monkey.config.GUID def is_os_supported(self): if super(RdpExploiter, self).is_os_supported(): diff --git a/monkey/infection_monkey/exploit/sambacry.py b/monkey/infection_monkey/exploit/sambacry.py index d9d683bdd..e14b6aa93 100644 --- a/monkey/infection_monkey/exploit/sambacry.py +++ b/monkey/infection_monkey/exploit/sambacry.py @@ -15,7 +15,6 @@ from impacket.smb3structs import SMB2_IL_IMPERSONATION, SMB2_CREATE, SMB2_FLAGS_ SMB2Packet, SMB2Create_Response, SMB2_OPLOCK_LEVEL_NONE from impacket.smbconnection import SMBConnection -import infection_monkey.config import infection_monkey.monkeyfs as monkeyfs from infection_monkey.exploit import HostExploiter from infection_monkey.model import DROPPER_ARG @@ -53,7 +52,6 @@ class SambaCryExploiter(HostExploiter): def __init__(self, host): super(SambaCryExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration def exploit_host(self): if not self.is_vulnerable(): diff --git a/monkey/infection_monkey/exploit/shellshock.py b/monkey/infection_monkey/exploit/shellshock.py index 9e42d9b17..dd80af22c 100644 --- a/monkey/infection_monkey/exploit/shellshock.py +++ b/monkey/infection_monkey/exploit/shellshock.py @@ -6,7 +6,6 @@ from random import choice import requests -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.exploit.tools import get_target_monkey, HTTPTools, get_monkey_depth from infection_monkey.model import DROPPER_ARG @@ -30,7 +29,6 @@ class ShellShockExploiter(HostExploiter): def __init__(self, host): super(ShellShockExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration self.HTTP = [str(port) for port in self._config.HTTP_PORTS] self.success_flag = ''.join( choice(string.ascii_uppercase + string.digits diff --git a/monkey/infection_monkey/exploit/smbexec.py b/monkey/infection_monkey/exploit/smbexec.py index 7e6b68b20..7528e08ba 100644 --- a/monkey/infection_monkey/exploit/smbexec.py +++ b/monkey/infection_monkey/exploit/smbexec.py @@ -3,7 +3,6 @@ from logging import getLogger from impacket.dcerpc.v5 import transport, scmr from impacket.smbconnection import SMB_DIALECT -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.exploit.tools import SmbTools, get_target_monkey, get_monkey_depth from infection_monkey.model import MONKEY_CMDLINE_DETACHED_WINDOWS, DROPPER_CMDLINE_DETACHED_WINDOWS @@ -24,8 +23,6 @@ class SmbExploiter(HostExploiter): def __init__(self, host): super(SmbExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration - self._guid = infection_monkey.config.GUID def is_os_supported(self): if super(SmbExploiter, self).is_os_supported(): diff --git a/monkey/infection_monkey/exploit/sshexec.py b/monkey/infection_monkey/exploit/sshexec.py index 4d0187822..82dd1f4d7 100644 --- a/monkey/infection_monkey/exploit/sshexec.py +++ b/monkey/infection_monkey/exploit/sshexec.py @@ -5,7 +5,6 @@ import paramiko import StringIO import infection_monkey.monkeyfs as monkeyfs -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.exploit.tools import get_target_monkey, get_monkey_depth from infection_monkey.model import MONKEY_ARG @@ -24,7 +23,6 @@ class SSHExploiter(HostExploiter): def __init__(self, host): super(SSHExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration self._update_timestamp = 0 self.skip_exist = self._config.skip_exploit_if_file_exist diff --git a/monkey/infection_monkey/exploit/struts2.py b/monkey/infection_monkey/exploit/struts2.py index 0033c6ff7..843bc23d5 100644 --- a/monkey/infection_monkey/exploit/struts2.py +++ b/monkey/infection_monkey/exploit/struts2.py @@ -27,7 +27,6 @@ class Struts2Exploiter(HostExploiter): def __init__(self, host): super(Struts2Exploiter, self).__init__(host) - self._config = __import__('config').WormConfiguration self.skip_exist = self._config.skip_exploit_if_file_exist self.HTTP = [str(port) for port in self._config.HTTP_PORTS] diff --git a/monkey/infection_monkey/exploit/win_ms08_067.py b/monkey/infection_monkey/exploit/win_ms08_067.py index b25289543..9f8837157 100644 --- a/monkey/infection_monkey/exploit/win_ms08_067.py +++ b/monkey/infection_monkey/exploit/win_ms08_067.py @@ -14,7 +14,6 @@ from enum import IntEnum from impacket import uuid from impacket.dcerpc.v5 import transport -import infection_monkey.config from infection_monkey.exploit.tools import SmbTools, get_target_monkey, get_monkey_depth from infection_monkey.model import DROPPER_CMDLINE_WINDOWS, MONKEY_CMDLINE_WINDOWS from infection_monkey.network import SMBFinger @@ -159,8 +158,6 @@ class Ms08_067_Exploiter(HostExploiter): def __init__(self, host): super(Ms08_067_Exploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration - self._guid = infection_monkey.config.GUID def is_os_supported(self): if self.host.os.get('type') in self._TARGET_OS_TYPE and \ diff --git a/monkey/infection_monkey/exploit/wmiexec.py b/monkey/infection_monkey/exploit/wmiexec.py index 26cae60c3..1a8cb3386 100644 --- a/monkey/infection_monkey/exploit/wmiexec.py +++ b/monkey/infection_monkey/exploit/wmiexec.py @@ -5,7 +5,6 @@ import traceback from impacket.dcerpc.v5.rpcrt import DCERPCException -import infection_monkey.config from infection_monkey.exploit import HostExploiter from infection_monkey.exploit.tools import SmbTools, WmiTools, AccessDeniedException, get_target_monkey, \ get_monkey_depth, build_monkey_commandline @@ -19,8 +18,6 @@ class WmiExploiter(HostExploiter): def __init__(self, host): super(WmiExploiter, self).__init__(host) - self._config = infection_monkey.config.WormConfiguration - self._guid = infection_monkey.config.GUID @WmiTools.dcom_wrap def exploit_host(self): diff --git a/monkey/infection_monkey/network/mssql_fingerprint.py b/monkey/infection_monkey/network/mssql_fingerprint.py index bb5214c2f..6a0f6ad2e 100644 --- a/monkey/infection_monkey/network/mssql_fingerprint.py +++ b/monkey/infection_monkey/network/mssql_fingerprint.py @@ -3,6 +3,7 @@ import socket from infection_monkey.model.host import VictimHost from infection_monkey.network import HostFinger +import infection_monkey.config __author__ = 'Maor Rayzin' @@ -18,7 +19,7 @@ class MSSQLFinger(HostFinger): SERVICE_NAME = 'MSSQL' def __init__(self): - self._config = __import__('config').WormConfiguration + self._config = infection_monkey.config.WormConfiguration def get_host_fingerprint(self, host): """Gets Microsoft SQL Server instance information by querying the SQL Browser service.