本文整理汇总了Python中impacket.smbserver.SMBSERVER属性的典型用法代码示例。如果您正苦于以下问题:Python smbserver.SMBSERVER属性的具体用法?Python smbserver.SMBSERVER怎么用?Python smbserver.SMBSERVER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.smbserver
的用法示例。
在下文中一共展示了smbserver.SMBSERVER属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def login(self, host, username, password, domain, lmhash, nthash, port):
try:
if port == 445:
smbconn = SMBConnection(host, host, sess_port=445, timeout=4)
smbconn.login(username, password, domain, lmhash, nthash)
else:
smbconn = SMBConnection('*SMBSERVER', host, sess_port=139, timeout=4)
smbconn.login(username, password, domain, lmhash, nthash)
'''
if self.smbconn[host].isGuestSession() > 0:
if verbose and not self.grepable:
print('[+] Guest SMB session established on %s...' % (host))
else:
if verbose and not self.grepable:
print('[+] User SMB session established on %s...' % (host))
'''
return smbconn
except Exception as e:
if self.verbose:
print('[!] Authentication error on %s' % (host))
return False
示例2: login_rpc
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def login_rpc(self, host, username, password, domain):
try:
self.smbconn[host] = SMBConnection('*SMBSERVER', host, sess_port=139, timeout=4)
self.smbconn[host].login(username, password, domain)
'''
if self.smbconn[host].isGuestSession() > 0:
if verbose and not self.grepable:
print('[+] Guest RPC session established on %s...' % (host))
else:
if verbose and not self.grepable:
print('[+] User RPC session established on %s...' % (host))
'''
return True
except Exception as e:
print('[!] RPC Authentication error occurred')
return False
示例3: login_rpc_hash
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def login_rpc_hash(self, host, username, ntlmhash, domain):
lmhash, nthash = ntlmhash.split(':')
try:
self.smbconn[host] = SMBConnection('*SMBSERVER', host, sess_port=139, timeout=2)
self.smbconn[host].login(username, '', domain, lmhash=lmhash, nthash=nthash)
if self.smbconn[host].isGuestSession() > 0:
color('[+] Guest RPC session established on %s...' % (host))
else:
color('[+] User RPC session establishd on %s...' % (host) )
return True
except Exception as e:
color('[!] RPC Authentication error occured')
return False
示例4: __init__
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def __init__(self,config):
Thread.__init__(self)
self.daemon = True
self.server = 0
#Config object
self.config = config
#Current target IP
self.target = None
#Targets handler
self.targetprocessor = self.config.target
#Username we auth as gets stored here later
self.authUser = None
self.proxyTranslator = None
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file','smb.log')
smbConfig.set('global','credentials_file','')
if self.config.outputFile is not None:
smbConfig.set('global','jtr_dump_path',self.config.outputFile)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path','')
self.server = SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
self.server.processConfigFile()
self.origSmbComNegotiate = self.server.hookSmbCommand(smb.SMB.SMB_COM_NEGOTIATE, self.SmbComNegotiate)
self.origSmbSessionSetupAndX = self.server.hookSmbCommand(smb.SMB.SMB_COM_SESSION_SETUP_ANDX, self.SmbSessionSetupAndX)
# Let's use the SMBServer Connection dictionary to keep track of our client connections as well
#TODO: See if this is the best way to accomplish this
self.server.addConnection('SMBRelay', '0.0.0.0', 445)
示例5: __init__
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def __init__(self,config):
Thread.__init__(self)
self.daemon = True
self.server = 0
#Config object
self.config = config
#Current target IP
self.target = None
#Targets handler
self.targetprocessor = self.config.target
#Username we auth as gets stored here later
self.authUser = None
self.proxyTranslator = None
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file','smb.log')
smbConfig.set('global','credentials_file','')
if self.config.outputFile is not None:
smbConfig.set('global','jtr_dump_path',self.config.outputFile)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path','')
self.server = SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
self.server.processConfigFile()
self.origSmbComNegotiate = self.server.hookSmbCommand(smb.SMB.SMB_COM_NEGOTIATE, self.SmbComNegotiate)
self.origSmbSessionSetupAndX = self.server.hookSmbCommand(smb.SMB.SMB_COM_SESSION_SETUP_ANDX, self.SmbSessionSetupAndX)
# Let's use the SMBServer Connection dictionary to keep track of our client connections as well
#TODO: See if this is the best way to accomplish this
self.server.addConnection('SMBRelay', '0.0.0.0', 445)
示例6: run
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def run(self):
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file',SMBSERVER_DIR + '/smb.log')
smbConfig.set('global','credentials_file','')
# Let's add a dummy share
smbConfig.add_section(DUMMY_SHARE)
smbConfig.set(DUMMY_SHARE,'comment','')
smbConfig.set(DUMMY_SHARE,'read only','no')
smbConfig.set(DUMMY_SHARE,'share type','0')
smbConfig.set(DUMMY_SHARE,'path',SMBSERVER_DIR)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path')
self.smb = smbserver.SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
logging.info('Creating tmp directory')
try:
os.mkdir(SMBSERVER_DIR)
except Exception as e:
logging.critical(str(e))
pass
logging.info('Setting up SMB Server')
self.smb.processConfigFile()
logging.info('Ready to listen...')
try:
self.smb.serve_forever()
except:
pass
示例7: run
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def run(self):
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file',SMBSERVER_DIR + '/smb.log')
smbConfig.set('global','credentials_file','')
# Let's add a dummy share
smbConfig.add_section(DUMMY_SHARE)
smbConfig.set(DUMMY_SHARE,'comment','')
smbConfig.set(DUMMY_SHARE,'read only','no')
smbConfig.set(DUMMY_SHARE,'share type','0')
smbConfig.set(DUMMY_SHARE,'path',SMBSERVER_DIR)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path')
try:
self.smb = smbserver.SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
except Exception as e:
if 'in use' not in str(e):
raise(e)
return
info('[*] Creating tmp directory')
try:
os.mkdir(SMBSERVER_DIR)
except Exception, e:
color('[!]', e)
pass
示例8: login_rpc
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def login_rpc(self, host, username, password, domain):
try:
self.smbconn[host] = SMBConnection('*SMBSERVER', host, sess_port=139, timeout=2)
self.smbconn[host].login(username, password, domain)
if self.smbconn[host].isGuestSession() > 0:
color('[+] Guest RPC session established on %s...' % (host))
else:
color('[+] User RPC session establishd on %s...' % (host) )
return True
except Exception as e:
color('[!] RPC Authentication error occured')
return False
示例9: run
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def run(self):
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file',SMBSERVER_DIR + '/smb.log')
smbConfig.set('global','credentials_file','')
# Let's add a dummy share
smbConfig.add_section(DUMMY_SHARE)
smbConfig.set(DUMMY_SHARE,'comment','')
smbConfig.set(DUMMY_SHARE,'read only','no')
smbConfig.set(DUMMY_SHARE,'share type','0')
smbConfig.set(DUMMY_SHARE,'path',SMBSERVER_DIR)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path')
self.smb = smbserver.SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
logging.info('Creating tmp directory')
try:
os.mkdir(SMBSERVER_DIR)
except Exception, e:
logging.critical(str(e))
pass
示例10: __init__
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def __init__(self, outputFile = None):
Thread.__init__(self)
self.daemon = True
self.server = 0
self.target = ''
self.mode = 'REFLECTION'
self.domainIp = None
self.machineAccount = None
self.machineHashes = None
self.exeFile = None
self.returnStatus = STATUS_SUCCESS
self.command = None
self.one_shot = False
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file','smb.log')
smbConfig.set('global','credentials_file','')
if outputFile is not None:
smbConfig.set('global','jtr_dump_path',outputFile)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path','')
self.server = SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
self.server.processConfigFile()
self.origSmbComNegotiate = self.server.hookSmbCommand(SMB.SMB_COM_NEGOTIATE, self.SmbComNegotiate)
self.origSmbSessionSetupAndX = self.server.hookSmbCommand(SMB.SMB_COM_SESSION_SETUP_ANDX,
self.SmbSessionSetupAndX)
# Let's use the SMBServer Connection dictionary to keep track of our client connections as well
self.server.addConnection('SMBRelay', '0.0.0.0', 445)
示例11: run
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def run(self):
# Here we write a mini config for the server
smbConfig = configparser.ConfigParser(allow_no_value=True)
smbConfig.add_section('global')
smbConfig.set('global','server_name','nopsec')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file', SMBSERVER_DIR + '/smb.log')
smbConfig.set('global','credentials_file','')
# Let's add a dummy share
smbConfig.add_section(DUMMY_SHARE)
smbConfig.set(DUMMY_SHARE,'comment','')
smbConfig.set(DUMMY_SHARE,'read only','no')
smbConfig.set(DUMMY_SHARE,'share type','0')
smbConfig.set(DUMMY_SHARE,'path',SMBSERVER_DIR)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path')
self.smb = smbserver.SMBSERVER(('0.0.0.0', 445), config_parser = smbConfig)
try:
os.mkdir(SMBSERVER_DIR)
except Exception as e:
pass
self.smb.processConfigFile()
self.__srvsServer = SRVSServer()
self.__srvsServer.daemon = True
self.__wkstServer = WKSTServer()
self.__wkstServer.daemon = True
self.smb.registerNamedPipe('srvsvc',('127.0.0.1',self.__srvsServer.getListenPort()))
self.smb.registerNamedPipe('wkssvc',('127.0.0.1',self.__wkstServer.getListenPort()))
try:
print('[+] SMB server started...')
self.__srvsServer.start()
self.__wkstServer.start()
self.smb.serve_forever()
except Exception as e:
print('[!] Error starting SMB server: ', e)
pass
示例12: __init__
# 需要导入模块: from impacket import smbserver [as 别名]
# 或者: from impacket.smbserver import SMBSERVER [as 别名]
def __init__(self, outputFile = None):
Thread.__init__(self)
self.daemon = True
self.server = 0
self.target = ''
self.mode = 'REFLECTION'
self.domainIp = None
self.machineAccount = None
self.machineHashes = None
self.exeFile = None
self.returnStatus = STATUS_SUCCESS
self.command = None
self.one_shot = False
self.runSocks = False
# Here we write a mini config for the server
smbConfig = ConfigParser.ConfigParser()
smbConfig.add_section('global')
smbConfig.set('global','server_name','server_name')
smbConfig.set('global','server_os','UNIX')
smbConfig.set('global','server_domain','WORKGROUP')
smbConfig.set('global','log_file','smb.log')
smbConfig.set('global','credentials_file','')
if outputFile is not None:
smbConfig.set('global','jtr_dump_path',outputFile)
# IPC always needed
smbConfig.add_section('IPC$')
smbConfig.set('IPC$','comment','')
smbConfig.set('IPC$','read only','yes')
smbConfig.set('IPC$','share type','3')
smbConfig.set('IPC$','path','')
self.server = SMBSERVER(('0.0.0.0',445), config_parser = smbConfig)
self.server.processConfigFile()
self.origSmbComNegotiate = self.server.hookSmbCommand(SMB.SMB_COM_NEGOTIATE, self.SmbComNegotiate)
self.origSmbSessionSetupAndX = self.server.hookSmbCommand(SMB.SMB_COM_SESSION_SETUP_ANDX,
self.SmbSessionSetupAndX)
# Let's use the SMBServer Connection dictionary to keep track of our client connections as well
self.server.addConnection('SMBRelay', '0.0.0.0', 445)