bug fix
This commit is contained in:
@@ -403,12 +403,12 @@ class RSAPublicKey(CompositeType):
|
|||||||
def __init__(self, readLen):
|
def __init__(self, readLen):
|
||||||
CompositeType.__init__(self, readLen = readLen)
|
CompositeType.__init__(self, readLen = readLen)
|
||||||
self.magic = UInt32Le(0x31415352, constant = True)
|
self.magic = UInt32Le(0x31415352, constant = True)
|
||||||
self.keylen = UInt32Le(lambda:sizeof(self.modulus))
|
self.keylen = UInt32Le(lambda:(sizeof(self.modulus) + sizeof(self.padding)))
|
||||||
self.bitlen = UInt32Le(lambda:((self.keylen.value - 8) * 8))
|
self.bitlen = UInt32Le(lambda:((self.keylen.value - 8) * 8))
|
||||||
self.datalen = UInt32Le(lambda:((self.bitlen.value / 8) - 1))
|
self.datalen = UInt32Le(lambda:((self.bitlen.value / 8) - 1))
|
||||||
self.pubExp = UInt32Le()
|
self.pubExp = UInt32Le()
|
||||||
self.modulus = String(readLen = UInt16Le(lambda:(self.keylen.value - 8)))
|
self.modulus = String(readLen = UInt16Le(lambda:(self.keylen.value - 8)))
|
||||||
self.padding = String(readLen = UInt8(8))
|
self.padding = String("\x00" * 8, readLen = UInt8(8))
|
||||||
|
|
||||||
class ChannelDef(CompositeType):
|
class ChannelDef(CompositeType):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -488,14 +488,11 @@ class Server(MCSLayer):
|
|||||||
"""
|
"""
|
||||||
#basic rdp security layer
|
#basic rdp security layer
|
||||||
if self._transport._selectedProtocol == 0:
|
if self._transport._selectedProtocol == 0:
|
||||||
certificate = gcc.ProprietaryServerCertificate()
|
|
||||||
certificate.PublicKeyBlob.modulus.value = hex(self._presentation._rsaPublicKey.n)[2:-1].decode('hex')[::-1]
|
|
||||||
certificate.PublicKeyBlob.pubExp.value = self._presentation._rsaPublicKey.e
|
|
||||||
|
|
||||||
self._serverSettings.SC_SECURITY.encryptionMethod.value = gcc.EncryptionMethod.ENCRYPTION_FLAG_128BIT
|
self._serverSettings.SC_SECURITY.encryptionMethod.value = gcc.EncryptionMethod.ENCRYPTION_FLAG_128BIT
|
||||||
self._serverSettings.SC_SECURITY.encryptionLevel.value = gcc.EncryptionLevel.ENCRYPTION_LEVEL_HIGH
|
self._serverSettings.SC_SECURITY.encryptionLevel.value = gcc.EncryptionLevel.ENCRYPTION_LEVEL_HIGH
|
||||||
self._serverSettings.SC_SECURITY.serverRandom.value = rsa.randnum.read_random_bits(256)
|
self._serverSettings.SC_SECURITY.serverRandom.value = rsa.randnum.read_random_bits(256)
|
||||||
self._serverSettings.SC_SECURITY.serverCertificate.certData = certificate
|
self._serverSettings.SC_SECURITY.serverCertificate.certData = self._presentation.getCertificate()
|
||||||
|
|
||||||
self._serverSettings.SC_CORE.clientRequestedProtocol.value = self._transport._requestedProtocol
|
self._serverSettings.SC_CORE.clientRequestedProtocol.value = self._transport._requestedProtocol
|
||||||
self.setNextState(self.recvConnectInitial)
|
self.setNextState(self.recvConnectInitial)
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ class Server(SecLayer):
|
|||||||
@param presentation: {Layer}
|
@param presentation: {Layer}
|
||||||
"""
|
"""
|
||||||
SecLayer.__init__(self, presentation)
|
SecLayer.__init__(self, presentation)
|
||||||
self._rsaPublicKey, self._rsaPrivateKey = rsa.newkeys(512)
|
self._rsaPublicKey, self._rsaPrivaterKey = rsa.newkeys(512)
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""
|
"""
|
||||||
@@ -603,6 +603,16 @@ class Server(SecLayer):
|
|||||||
else:
|
else:
|
||||||
self.setNextState(self.recvInfoPkt)
|
self.setNextState(self.recvInfoPkt)
|
||||||
|
|
||||||
|
def getCertificate(self):
|
||||||
|
"""
|
||||||
|
@summary: generate proprietary certificate from rsa public key
|
||||||
|
"""
|
||||||
|
certificate = gcc.ProprietaryServerCertificate()
|
||||||
|
certificate.PublicKeyBlob.modulus.value = hex(self._rsaPublicKey.n)[2:-1].decode('hex')[::-1]
|
||||||
|
certificate.PublicKeyBlob.pubExp.value = self._rsaPublicKey.e
|
||||||
|
certificate.SignatureBlob.value = "\x00" * 72
|
||||||
|
return certificate
|
||||||
|
|
||||||
def recvClientRandom(self, s):
|
def recvClientRandom(self, s):
|
||||||
"""
|
"""
|
||||||
@summary: receive client random and generate session keys
|
@summary: receive client random and generate session keys
|
||||||
|
|||||||
Reference in New Issue
Block a user