本文整理匯總了Python中impacket.ntlm.NTLMSSP_NEGOTIATE_UNICODE屬性的典型用法代碼示例。如果您正苦於以下問題:Python ntlm.NTLMSSP_NEGOTIATE_UNICODE屬性的具體用法?Python ntlm.NTLMSSP_NEGOTIATE_UNICODE怎麽用?Python ntlm.NTLMSSP_NEGOTIATE_UNICODE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類impacket.ntlm
的用法示例。
在下文中一共展示了ntlm.NTLMSSP_NEGOTIATE_UNICODE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: do_ntlm_auth
# 需要導入模塊: from impacket import ntlm [as 別名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_UNICODE [as 別名]
def do_ntlm_auth(self,token,authenticateMessage):
#For some attacks it is important to know the authenticated username, so we store it
if authenticateMessage['flags'] & ntlm.NTLMSSP_NEGOTIATE_UNICODE:
self.authUser = ('%s/%s' % (authenticateMessage['domain_name'].decode('utf-16le'),
authenticateMessage['user_name'].decode('utf-16le'))).upper()
else:
self.authUser = ('%s/%s' % (authenticateMessage['domain_name'].decode('ascii'),
authenticateMessage['user_name'].decode('ascii'))).upper()
if authenticateMessage['user_name'] != '' or self.target.hostname == '127.0.0.1':
clientResponse, errorCode = self.client.sendAuth(token)
else:
# Anonymous login, send STATUS_ACCESS_DENIED so we force the client to send his credentials, except
# when coming from localhost
errorCode = STATUS_ACCESS_DENIED
if errorCode == STATUS_SUCCESS:
return True
return False
示例2: do_ntlm_auth
# 需要導入模塊: from impacket import ntlm [as 別名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_UNICODE [as 別名]
def do_ntlm_auth(self,token,authenticateMessage):
#For some attacks it is important to know the authenticated username, so we store it
if authenticateMessage['flags'] & ntlm.NTLMSSP_NEGOTIATE_UNICODE:
self.authUser = ('%s/%s' % (authenticateMessage['domain_name'].decode('utf-16le'),
authenticateMessage['user_name'].decode('utf-16le'))).upper()
else:
self.authUser = ('%s/%s' % (authenticateMessage['domain_name'].decode('ascii'),
authenticateMessage['user_name'].decode('ascii'))).upper()
if authenticateMessage['user_name'] != '' or self.target.hostname == '127.0.0.1':
clientResponse, errorCode = self.client.sendAuth(token)
else:
# Anonymous login, send STATUS_ACCESS_DENIED so we force the client to send his credentials, except
# when coming from localhost
errorCode = STATUS_ACCESS_DENIED
if errorCode == STATUS_SUCCESS:
config.set_suc(True)
return True
else:
config.set_fail(True)
return False
return False
示例3: setUp
# 需要導入模塊: from impacket import ntlm [as 別名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_UNICODE [as 別名]
def setUp(self):
# Turn test case mode on
ntlm.TEST_CASE = True
self.user = "User"
self.domain = "Domain"
self.password = "Password"
self.serverName = "Server"
self.workstationName = "COMPUTER"
self.randomSessionKey = b("U"*16)
self.time = b('\x00'*8)
self.clientChallenge = b("\xaa"*8)
self.serverChallenge = b("\x01\x23\x45\x67\x89\xab\xcd\xef")
self.flags = ntlm.NTLMSSP_NEGOTIATE_KEY_EXCH | ntlm.NTLMSSP_NEGOTIATE_56 | ntlm.NTLMSSP_NEGOTIATE_128 | ntlm.NTLMSSP_NEGOTIATE_VERSION | ntlm.NTLMSSP_TARGET_TYPE_SERVER | ntlm.NTLMSSP_NEGOTIATE_ALWAYS_SIGN | ntlm.NTLMSSP_NEGOTIATE_NTLM | ntlm.NTLMSSP_NEGOTIATE_SEAL | ntlm.NTLMSSP_NEGOTIATE_SIGN | ntlm.NTLM_NEGOTIATE_OEM | ntlm.NTLMSSP_NEGOTIATE_UNICODE
self.seqNum = 0
self.nonce = b('\x00'*16)
self.plaintext = 'Plaintext'.encode('utf-16le')
print("## BEFORE RUNNING THESE TESTS")
print("Don't forget to set up aTime = '\\x00'*8 in computeResponseNTLMv2 otherwise the results won't be right. ")
print("Look for that in ntlm.py and uncomment the lines, comment the other ones and don't forget to revert everything back whenever finished testing")
print("Flags")
hexdump(struct.pack('<L',self.flags))