本文整理汇总了Python中impacket.ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY属性的典型用法代码示例。如果您正苦于以下问题:Python ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY属性的具体用法?Python ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY怎么用?Python ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类impacket.ntlm
的用法示例。
在下文中一共展示了ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from impacket import ntlm [as 别名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY [as 别名]
def __init__(self, flags, randomSessionKey):
self.__flags = flags
if self.__flags & ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY:
self.__clientSigningKey = ntlm.SIGNKEY(self.__flags, randomSessionKey)
self.__serverSigningKey = ntlm.SIGNKEY(self.__flags, randomSessionKey,"Server")
self.__clientSealingKey = ntlm.SEALKEY(self.__flags, randomSessionKey)
self.__serverSealingKey = ntlm.SEALKEY(self.__flags, randomSessionKey,"Server")
# Preparing the keys handle states
cipher3 = ARC4.new(self.__clientSealingKey)
self.__clientSealingHandle = cipher3.encrypt
cipher4 = ARC4.new(self.__serverSealingKey)
self.__serverSealingHandle = cipher4.encrypt
else:
# Same key for everything
self.__clientSigningKey = randomSessionKey
self.__serverSigningKey = randomSessionKey
self.__clientSealingKey = randomSessionKey
self.__clientSealingKey = randomSessionKey
cipher = ARC4.new(self.__clientSigningKey)
self.__clientSealingHandle = cipher.encrypt
self.__serverSealingHandle = cipher.encrypt
self.__sequence = 0
示例2: encrypt
# 需要导入模块: from impacket import ntlm [as 别名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY [as 别名]
def encrypt(self, plain_data):
if self.__flags & ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY:
# When NTLM2 is on, we sign the whole pdu, but encrypt just
# the data, not the dcerpc header. Weird..
sealedMessage, signature = ntlm.SEAL(self.__flags,
self.__clientSigningKey,
self.__clientSealingKey,
plain_data,
plain_data,
self.__sequence,
self.__clientSealingHandle)
else:
sealedMessage, signature = ntlm.SEAL(self.__flags,
self.__clientSigningKey,
self.__clientSealingKey,
plain_data,
plain_data,
self.__sequence,
self.__clientSealingHandle)
self.__sequence += 1
return signature, sealedMessage
示例3: decrypt
# 需要导入模块: from impacket import ntlm [as 别名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY [as 别名]
def decrypt(self, answer):
if self.__flags & ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY:
# TODO: FIX THIS, it's not calculating the signature well
# Since I'm not testing it we don't care... yet
answer, signature = ntlm.SEAL(self.__flags,
self.__serverSigningKey,
self.__serverSealingKey,
answer,
answer,
self.__sequence,
self.__serverSealingHandle)
else:
answer, signature = ntlm.SEAL(self.__flags,
self.__serverSigningKey,
self.__serverSealingKey,
answer,
answer,
self.__sequence,
self.__serverSealingHandle)
self.__sequence += 1
return signature, answer
示例4: getExtended
# 需要导入模块: from impacket import ntlm [as 别名]
# 或者: from impacket.ntlm import NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY [as 别名]
def getExtended(self):
#
return (self.RESPONSE_INFO['flags'] & ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY == ntlm.NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY)