Correct bug from cssp security layer

This commit is contained in:
speyrefitte
2015-03-13 10:17:13 +01:00
parent 20de5f6f82
commit bd362263f7
5 changed files with 15 additions and 7 deletions

View File

@@ -271,7 +271,7 @@ if __name__ == '__main__':
clientSecurity = rdp.SecurityLevel.RDP_LEVEL_SSL
try:
opts, args = getopt.getopt(sys.argv[1:], "hl:k:c:o:r")
opts, args = getopt.getopt(sys.argv[1:], "hl:k:c:o:rn")
except getopt.GetoptError:
help()
for opt, arg in opts:

View File

@@ -56,7 +56,8 @@ class RDPScreenShotFactory(rdp.ClientFactory):
self._height = height
self._path = path
self._timeout = timeout
self._security = "ssl"
#NLA server can't be screenshooting
self._security = rdp.SecurityLevel.RDP_LEVEL_SSL
def clientConnectionLost(self, connector, reason):
"""
@@ -66,7 +67,7 @@ class RDPScreenShotFactory(rdp.ClientFactory):
"""
if reason.type == RDPSecurityNegoFail and self._security != "rdp":
log.info("due to RDPSecurityNegoFail try standard security layer")
self._security = "rdp"
self._security = rdp.SecurityLevel.RDP_LEVEL_RDP
connector.connect()
return

View File

@@ -207,6 +207,13 @@ class CSSP(protocol.Protocol):
"""
self._layer.dataReceived(data)
def connectionLost(self, reason):
"""
@summary: Call from twisted engine when protocol is closed
@param reason: str represent reason of close connection
"""
self._layer._factory.connectionLost(self, reason)
def connectionMade(self):
"""
@summary: install proxy

View File

@@ -67,7 +67,6 @@ class RDPClientController(pdu.layer.PDUClientListener):
@return: return Protocol layer for twisted
In case of RDP TPKT is the Raw layer
"""
#build a cssp wrapper in case of nla authentication
return cssp.CSSP(self._tpktLayer, ntlm.NTLMv2(self._secLayer._info.domain.value, self._secLayer._info.userName.value, self._secLayer._info.password.value))
def getColorDepth(self):
@@ -521,8 +520,9 @@ class ClientFactory(layer.RawLayerClientFactory):
@summary: Factory of Client RDP protocol
@param reason: twisted reason
"""
def connectionLost(self, tpktLayer, reason):
def connectionLost(self, csspLayer, reason):
#retrieve controller
tpktLayer = csspLayer._layer
x224Layer = tpktLayer._presentation
mcsLayer = x224Layer._presentation
secLayer = mcsLayer._channels[mcs.Channel.MCS_GLOBAL_CHANNEL]

View File

@@ -213,14 +213,14 @@ class Client(X224Layer):
if self._selectedProtocol == Protocols.PROTOCOL_RDP:
log.warning("*" * 43)
log.warning("*" * 10 + " RDP Security selected " + "*" * 10)
log.warning("*" + " " * 10 + "RDP Security selected" + " " * 10 + "*")
log.warning("*" * 43)
#connection is done send to presentation
self._presentation.connect()
elif self._selectedProtocol == Protocols.PROTOCOL_SSL:
log.info("*" * 43)
log.info("*" * 10 + " SSL Security selected " + "*" * 10)
log.info("*" + " " * 10 + "SSL Security selected" + " " * 10 + "*")
log.info("*" * 43)
self._transport.startTLS(ClientTLSContext())
#connection is done send to presentation