本文整理汇总了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.