Having worked out how the protocol object is created. Created config
object once, and set as an attr on each protocol. More elegant, and allows for further config options in the future.main
parent
b6a7028999
commit
fffc24ae46
|
@ -44,7 +44,7 @@ def main():
|
|||
|
||||
cme_path = os.path.expanduser('~/.cme')
|
||||
|
||||
config = ConfigParser()
|
||||
config = ConfigParser({'pwn3d_label': 'Pwn3d!'})
|
||||
config.read(os.path.join(cme_path, 'cme.conf'))
|
||||
|
||||
module = None
|
||||
|
@ -134,6 +134,8 @@ def main():
|
|||
db_connection.isolation_level = None
|
||||
db = protocol_db_object(db_connection)
|
||||
|
||||
setattr(protocol_object, 'config', config)
|
||||
|
||||
if hasattr(args, 'module'):
|
||||
|
||||
loader = module_loader(args, db, logger)
|
||||
|
|
|
@ -19,11 +19,6 @@ class mssql(connection):
|
|||
self.domain = None
|
||||
self.hash = None
|
||||
|
||||
cme_path = os.path.expanduser('~/.cme')
|
||||
config = ConfigParser({'pwn3d_label': 'Pwn3d!'})
|
||||
config.read(os.path.join(cme_path, 'cme.conf'))
|
||||
self.pwn3d = config.get('CME','pwn3d_label')
|
||||
|
||||
connection.__init__(self, args, db, host)
|
||||
|
||||
@staticmethod
|
||||
|
@ -178,7 +173,8 @@ class mssql(connection):
|
|||
out = u'{}{}:{} {}'.format('{}\\'.format(domain.decode('utf-8')) if self.args.auth_type is 'windows' else '',
|
||||
username.decode('utf-8'),
|
||||
password.decode('utf-8'),
|
||||
highlight('('+self.pwn3d+')') if self.admin_privs else '')
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')') if self.admin_privs else '')
|
||||
|
||||
|
||||
self.logger.success(out)
|
||||
|
||||
|
@ -211,7 +207,7 @@ class mssql(connection):
|
|||
out = u'{}\\{} {} {}'.format(domain.decode('utf-8'),
|
||||
username.decode('utf-8'),
|
||||
ntlm_hash,
|
||||
highlight('('+self.pwn3d+')') if self.admin_privs else '')
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')') if self.admin_privs else '')
|
||||
|
||||
self.logger.success(out)
|
||||
|
||||
|
|
|
@ -106,11 +106,6 @@ class smb(connection):
|
|||
self.signing = False
|
||||
self.smb_share_name = smb_share_name
|
||||
|
||||
cme_path = os.path.expanduser('~/.cme')
|
||||
config = ConfigParser({'pwn3d_label': 'Pwn3d!'})
|
||||
config.read(os.path.join(cme_path, 'cme.conf'))
|
||||
self.pwn3d = config.get('CME','pwn3d_label')
|
||||
|
||||
connection.__init__(self, args, db, host)
|
||||
|
||||
@staticmethod
|
||||
|
@ -264,7 +259,7 @@ class smb(connection):
|
|||
out = u'{}\\{}:{} {}'.format(domain.decode('utf-8'),
|
||||
username.decode('utf-8'),
|
||||
password.decode('utf-8'),
|
||||
highlight('('+self.pwn3d+')') if self.admin_privs else '')
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')') if self.admin_privs else '')
|
||||
|
||||
self.logger.success(out)
|
||||
return True
|
||||
|
@ -308,7 +303,7 @@ class smb(connection):
|
|||
out = u'{}\\{} {} {}'.format(domain.decode('utf-8'),
|
||||
username.decode('utf-8'),
|
||||
ntlm_hash,
|
||||
highlight('('+self.pwn3d+')') if self.admin_privs else '')
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')') if self.admin_privs else '')
|
||||
|
||||
self.logger.success(out)
|
||||
return True
|
||||
|
|
|
@ -9,12 +9,6 @@ from ConfigParser import ConfigParser
|
|||
|
||||
class ssh(connection):
|
||||
|
||||
def __init__(self, args, db, host):
|
||||
cme_path = os.path.expanduser('~/.cme')
|
||||
config = ConfigParser({'pwn3d_label': 'Pwn3d!'})
|
||||
config.read(os.path.join(cme_path, 'cme.conf'))
|
||||
self.pwn3d = config.get('CME','pwn3d_label')
|
||||
|
||||
@staticmethod
|
||||
def proto_args(parser, std_parser, module_parser):
|
||||
ssh_parser = parser.add_parser('ssh', help="own stuff using SSH", parents=[std_parser, module_parser])
|
||||
|
@ -66,7 +60,7 @@ class ssh(connection):
|
|||
|
||||
self.logger.success(u'{}:{} {}'.format(username.decode('utf-8'),
|
||||
password.decode('utf-8'),
|
||||
highlight('('+self.pwn3d+')') if self.admin_privs else ''))
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')') if self.admin_privs else ''))
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
|
|
|
@ -19,11 +19,6 @@ class winrm(connection):
|
|||
def __init__(self, args, db, host):
|
||||
self.domain = None
|
||||
|
||||
cme_path = os.path.expanduser('~/.cme')
|
||||
config = ConfigParser({'pwn3d_label': 'Pwn3d!'})
|
||||
config.read(os.path.join(cme_path, 'cme.conf'))
|
||||
self.pwn3d = config.get('CME','pwn3d_label')
|
||||
|
||||
connection.__init__(self, args, db, host)
|
||||
|
||||
@staticmethod
|
||||
|
@ -125,7 +120,7 @@ class winrm(connection):
|
|||
self.logger.success(u'{}\\{}:{} {}'.format(self.domain.decode('utf-8'),
|
||||
username.decode('utf-8'),
|
||||
password.decode('utf-8'),
|
||||
highlight('('+self.pwn3d+')')))
|
||||
highlight('('+self.config.get('CME','pwn3d_label')+')')))
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue