本文整理匯總了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)