2015-08-30 15:27:35 +08:00
|
|
|
from abc import ABCMeta, abstractmethod
|
|
|
|
|
|
|
|
__author__ = 'itamar'
|
|
|
|
|
2016-09-05 22:45:27 +08:00
|
|
|
|
2015-08-30 15:27:35 +08:00
|
|
|
class HostExploiter(object):
|
|
|
|
__metaclass__ = ABCMeta
|
2015-09-29 22:58:06 +08:00
|
|
|
|
2017-10-16 15:58:11 +08:00
|
|
|
_TARGET_OS_TYPE = []
|
|
|
|
|
2017-10-11 23:05:03 +08:00
|
|
|
def __init__(self, host):
|
2017-10-16 15:58:11 +08:00
|
|
|
|
2017-10-11 23:05:03 +08:00
|
|
|
self._exploit_info = {}
|
|
|
|
self._exploit_attempts = []
|
|
|
|
self.host = host
|
|
|
|
|
|
|
|
def is_os_supported(self):
|
2017-10-16 15:58:11 +08:00
|
|
|
return self.host.os.get('type') in self._TARGET_OS_TYPE
|
2017-10-11 23:05:03 +08:00
|
|
|
|
|
|
|
def send_exploit_telemetry(self, result):
|
|
|
|
from control import ControlClient
|
|
|
|
ControlClient.send_telemetry(
|
|
|
|
'exploit',
|
|
|
|
{'result': result, 'machine': self.host.__dict__, 'exploiter': self.__class__.__name__,
|
|
|
|
'info': self._exploit_info, 'attempts': self._exploit_attempts})
|
|
|
|
|
|
|
|
def report_login_attempt(self, result, user, password, lm_hash='', ntlm_hash=''):
|
|
|
|
self._exploit_attempts.append({'result': result, 'user': user, 'password': password,
|
|
|
|
'lm_hash': lm_hash, 'ntlm_hash': ntlm_hash})
|
2015-08-30 15:27:35 +08:00
|
|
|
|
|
|
|
@abstractmethod
|
2017-10-11 23:05:03 +08:00
|
|
|
def exploit_host(self):
|
2015-08-30 15:27:35 +08:00
|
|
|
raise NotImplementedError()
|
2015-11-30 20:11:19 +08:00
|
|
|
|
2017-09-26 20:43:46 +08:00
|
|
|
|
2015-11-30 20:11:19 +08:00
|
|
|
from win_ms08_067 import Ms08_067_Exploiter
|
|
|
|
from wmiexec import WmiExploiter
|
|
|
|
from smbexec import SmbExploiter
|
|
|
|
from rdpgrinder import RdpExploiter
|
|
|
|
from sshexec import SSHExploiter
|
2016-09-05 22:45:27 +08:00
|
|
|
from shellshock import ShellShockExploiter
|
2017-08-31 22:50:55 +08:00
|
|
|
from sambacry import SambaCryExploiter
|
2017-09-26 20:43:46 +08:00
|
|
|
from elasticgroovy import ElasticGroovyExploiter
|