本文整理汇总了Python中impacket.nt_errors.ERROR_MESSAGES属性的典型用法代码示例。如果您正苦于以下问题:Python nt_errors.ERROR_MESSAGES属性的具体用法?Python nt_errors.ERROR_MESSAGES怎么用?Python nt_errors.ERROR_MESSAGES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.nt_errors
的用法示例。
在下文中一共展示了nt_errors.ERROR_MESSAGES属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
error_class = SessionError.error_classes.get( self.error_class, None )
if not error_class:
error_code_str = self.error_code
error_class_str = self.error_class
else:
error_class_str = error_class[0]
error_code = error_class[1].get( self.error_code, None )
if not error_code:
error_code_str = self.error_code
else:
error_code_str = '%s(%s)' % error_code
if self.nt_status:
return 'SMB SessionError: %s(%s)' % nt_errors.ERROR_MESSAGES[self.error_code]
else:
# Fall back to the old format
return 'SMB SessionError: class: %s, code: %s' % (error_class_str, error_code_str)
# Raised when an supported feature is present/required in the protocol but is not
# currently supported by pysmb
示例2: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if system_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = system_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = system_errors.ERROR_MESSAGES[key][1]
return 'NRPC SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
elif nt_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'NRPC SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'NRPC SessionError: unknown error code: 0x%x' % (self.error_code)
################################################################################
# CONSTANTS
################################################################################
# 2.2.1.2.5 NL_DNS_NAME_INFO
# Type
示例3: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if key in system_errors.ERROR_MESSAGES:
error_msg_short = system_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = system_errors.ERROR_MESSAGES[key][1]
return 'NRPC SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
elif key in nt_errors.ERROR_MESSAGES:
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'NRPC SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'NRPC SessionError: unknown error code: 0x%x' % (self.error_code)
################################################################################
# CONSTANTS
################################################################################
# 2.2.1.2.5 NL_DNS_NAME_INFO
# Type
示例4: smbcheck
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def smbcheck(target):
if checkPort(target,'445'):
conn = MYSMB(target)
try:
conn.login(USERNAME, PASSWORD)
except smb.SessionError as e:
#print('Login failed: ' + nt_errors.ERROR_MESSAGES[e.error_code][0])
sys.exit()
finally:
#print('OS: ' + conn.get_server_os())
TragetOS = '(' + conn.get_server_os()+')'
tid = conn.tree_connect_andx('\\\\'+target+'\\'+'IPC$')
conn.set_default_tid(tid)
# test if target is vulnerable
TRANS_PEEK_NMPIPE = 0x23
recvPkt = conn.send_trans(pack('<H', TRANS_PEEK_NMPIPE), maxParameterCount=0xffff, maxDataCount=0x800)
status = recvPkt.getNTStatus()
if status == 0xC0000205: # STATUS_INSUFF_SERVER_RESOURCES
#print('The target is not patched')
CheckResult = 'MS17-010\t'+TragetOS
return CheckResult
示例5: getErrorString
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def getErrorString( self ):
return nt_errors.ERROR_MESSAGES[self.error]
示例6: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
if nt_errors.ERROR_MESSAGES.has_key(self.error):
return 'SMB SessionError: %s(%s)' % (nt_errors.ERROR_MESSAGES[self.error])
else:
return 'SMB SessionError: 0x%x' % self.error
示例7: getErrorString
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def getErrorString( self ):
return constants.ERROR_MESSAGES[self.error]
示例8: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
retString = 'Kerberos SessionError: %s(%s)' % (constants.ERROR_MESSAGES[self.error])
try:
# Let's try to get the NT ERROR, if not, we quit and give the general one
if self.error == constants.ErrorCodes.KRB_ERR_GENERIC.value:
eData = decoder.decode(str(self.packet['e-data']), asn1Spec = KERB_ERROR_DATA())[0]
nt_error = struct.unpack('<L', str(eData['data-value'])[:4])[0]
retString += '\nNT ERROR: %s(%s)' % (nt_errors.ERROR_MESSAGES[nt_error])
except:
pass
return retString
示例9: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if nt_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'LSAD SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'LSAD SessionError: unknown error code: 0x%x' % self.error_code
################################################################################
# CONSTANTS
################################################################################
# 2.2.1.1.2 ACCESS_MASK for Policy Objects
示例10: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if nt_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'LSAT SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'LSAT SessionError: unknown error code: 0x%x' % self.error_code
################################################################################
# CONSTANTS
################################################################################
# 2.2.10 ACCESS_MASK
示例11: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if nt_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'Mimikatz SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'Mimikatz SessionError: unknown error code: 0x%x' % self.error_code
################################################################################
# CONSTANTS
################################################################################
示例12: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
key = self.error_code
if nt_errors.ERROR_MESSAGES.has_key(key):
error_msg_short = nt_errors.ERROR_MESSAGES[key][0]
error_msg_verbose = nt_errors.ERROR_MESSAGES[key][1]
return 'MGMT SessionError: code: 0x%x - %s - %s' % (self.error_code, error_msg_short, error_msg_verbose)
else:
return 'MGMT SessionError: unknown error code: 0x%x' % self.error_code
################################################################################
# CONSTANTS
################################################################################
示例13: execute
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def execute(self, host, port='139', user=None, password='', password_hash=None, domain='', persistent='1'):
with Timing() as timing:
fp, _ = self.bind(host, port)
try:
if user is None:
fp.login('', '') # retrieve workgroup/domain and computer name
else:
with Timing() as timing:
if password_hash:
if ':' in password_hash:
lmhash, nthash = password_hash.split(':')
else:
lmhash, nthash = 'aad3b435b51404eeaad3b435b51404ee', password_hash
fp.login(user, '', domain, lmhash, nthash)
else:
fp.login(user, password, domain)
logger.debug('No error')
code, mesg = '0', '%s\\%s (%s)' % (fp.getServerDomain(), fp.getServerName(), fp.getServerOS())
self.reset()
except SessionError as e:
code = '%x' % e.getErrorCode()
mesg = nt_errors.ERROR_MESSAGES[e.getErrorCode()][0]
if persistent == '0':
self.reset()
return self.Response(code, mesg, timing)
示例14: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
if self.error in nt_errors.ERROR_MESSAGES:
return 'SMB SessionError: %s(%s)' % (nt_errors.ERROR_MESSAGES[self.error])
else:
return 'SMB SessionError: 0x%x' % self.error
示例15: __str__
# 需要导入模块: from impacket import nt_errors [as 别名]
# 或者: from impacket.nt_errors import ERROR_MESSAGES [as 别名]
def __str__( self ):
retString = 'Kerberos SessionError: %s(%s)' % (constants.ERROR_MESSAGES[self.error])
try:
# Let's try to get the NT ERROR, if not, we quit and give the general one
if self.error == constants.ErrorCodes.KRB_ERR_GENERIC.value:
eData = decoder.decode(self.packet['e-data'], asn1Spec = KERB_ERROR_DATA())[0]
nt_error = struct.unpack('<L', eData['data-value'].asOctets()[:4])[0]
retString += '\nNT ERROR: %s(%s)' % (nt_errors.ERROR_MESSAGES[nt_error])
except:
pass
return retString