本文整理匯總了Python中impacket.ntlm.computeResponseNTLMv2方法的典型用法代碼示例。如果您正苦於以下問題:Python ntlm.computeResponseNTLMv2方法的具體用法?Python ntlm.computeResponseNTLMv2怎麽用?Python ntlm.computeResponseNTLMv2使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類impacket.ntlm
的用法示例。
在下文中一共展示了ntlm.computeResponseNTLMv2方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setUp
# 需要導入模塊: from impacket import ntlm [as 別名]
# 或者: from impacket.ntlm import computeResponseNTLMv2 [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))
示例2: check
# 需要導入模塊: from impacket import ntlm [as 別名]
# 或者: from impacket.ntlm import computeResponseNTLMv2 [as 別名]
def check(self, remote_host):
# Validate credentials first
if not self.creds_validated:
self.validate_creds(remote_host)
self.creds_validated = True
# Now start scanner
try:
smbClient = SMBConnection(remote_host, remote_host, sess_port=int(self.__port)) #, preferredDialect=SMB2_DIALECT_21
except:
return
ntlm.computeResponseNTLMv2 = mod_computeResponseNTLMv2
try:
smbClient.login(self.__username, self.__password, self.__domain, self.__lmhash, self.__nthash)
logging.info('Target %s is VULNERABLE to CVE-2019-1040 (authentication was accepted)', remote_host)
except SessionError as exc:
if 'STATUS_INVALID_PARAMETER' in str(exc):
logging.info('Target %s is not vulnerable to CVE-2019-1040 (authentication was rejected)', remote_host)
else:
logging.warning('Unexpected Exception while authenticating to %s: %s', remote_host, exc)
smbClient.close()
# Process command-line arguments.