Merge pull request #176 from acepace/feature/support-common-folder-exploit-import

Feature/support common folder exploit import
This commit is contained in:
itaymmguardicore 2018-08-29 14:52:34 +03:00 committed by GitHub
commit 7a5e53ee69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 5 additions and 24 deletions

View File

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

View File

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

View File

@ -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():

View File

@ -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():

View File

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

View File

@ -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():

View File

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

View File

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

View File

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

View File

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

View File

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