Correct bug from cssp security layer
This commit is contained in:
@@ -271,7 +271,7 @@ if __name__ == '__main__':
|
|||||||
clientSecurity = rdp.SecurityLevel.RDP_LEVEL_SSL
|
clientSecurity = rdp.SecurityLevel.RDP_LEVEL_SSL
|
||||||
|
|
||||||
try:
|
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:
|
except getopt.GetoptError:
|
||||||
help()
|
help()
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ class RDPScreenShotFactory(rdp.ClientFactory):
|
|||||||
self._height = height
|
self._height = height
|
||||||
self._path = path
|
self._path = path
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
self._security = "ssl"
|
#NLA server can't be screenshooting
|
||||||
|
self._security = rdp.SecurityLevel.RDP_LEVEL_SSL
|
||||||
|
|
||||||
def clientConnectionLost(self, connector, reason):
|
def clientConnectionLost(self, connector, reason):
|
||||||
"""
|
"""
|
||||||
@@ -66,7 +67,7 @@ class RDPScreenShotFactory(rdp.ClientFactory):
|
|||||||
"""
|
"""
|
||||||
if reason.type == RDPSecurityNegoFail and self._security != "rdp":
|
if reason.type == RDPSecurityNegoFail and self._security != "rdp":
|
||||||
log.info("due to RDPSecurityNegoFail try standard security layer")
|
log.info("due to RDPSecurityNegoFail try standard security layer")
|
||||||
self._security = "rdp"
|
self._security = rdp.SecurityLevel.RDP_LEVEL_RDP
|
||||||
connector.connect()
|
connector.connect()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,13 @@ class CSSP(protocol.Protocol):
|
|||||||
"""
|
"""
|
||||||
self._layer.dataReceived(data)
|
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):
|
def connectionMade(self):
|
||||||
"""
|
"""
|
||||||
@summary: install proxy
|
@summary: install proxy
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ class RDPClientController(pdu.layer.PDUClientListener):
|
|||||||
@return: return Protocol layer for twisted
|
@return: return Protocol layer for twisted
|
||||||
In case of RDP TPKT is the Raw layer
|
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))
|
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):
|
def getColorDepth(self):
|
||||||
@@ -521,8 +520,9 @@ class ClientFactory(layer.RawLayerClientFactory):
|
|||||||
@summary: Factory of Client RDP protocol
|
@summary: Factory of Client RDP protocol
|
||||||
@param reason: twisted reason
|
@param reason: twisted reason
|
||||||
"""
|
"""
|
||||||
def connectionLost(self, tpktLayer, reason):
|
def connectionLost(self, csspLayer, reason):
|
||||||
#retrieve controller
|
#retrieve controller
|
||||||
|
tpktLayer = csspLayer._layer
|
||||||
x224Layer = tpktLayer._presentation
|
x224Layer = tpktLayer._presentation
|
||||||
mcsLayer = x224Layer._presentation
|
mcsLayer = x224Layer._presentation
|
||||||
secLayer = mcsLayer._channels[mcs.Channel.MCS_GLOBAL_CHANNEL]
|
secLayer = mcsLayer._channels[mcs.Channel.MCS_GLOBAL_CHANNEL]
|
||||||
|
|||||||
@@ -213,14 +213,14 @@ class Client(X224Layer):
|
|||||||
|
|
||||||
if self._selectedProtocol == Protocols.PROTOCOL_RDP:
|
if self._selectedProtocol == Protocols.PROTOCOL_RDP:
|
||||||
log.warning("*" * 43)
|
log.warning("*" * 43)
|
||||||
log.warning("*" * 10 + " RDP Security selected " + "*" * 10)
|
log.warning("*" + " " * 10 + "RDP Security selected" + " " * 10 + "*")
|
||||||
log.warning("*" * 43)
|
log.warning("*" * 43)
|
||||||
#connection is done send to presentation
|
#connection is done send to presentation
|
||||||
self._presentation.connect()
|
self._presentation.connect()
|
||||||
|
|
||||||
elif self._selectedProtocol == Protocols.PROTOCOL_SSL:
|
elif self._selectedProtocol == Protocols.PROTOCOL_SSL:
|
||||||
log.info("*" * 43)
|
log.info("*" * 43)
|
||||||
log.info("*" * 10 + " SSL Security selected " + "*" * 10)
|
log.info("*" + " " * 10 + "SSL Security selected" + " " * 10 + "*")
|
||||||
log.info("*" * 43)
|
log.info("*" * 43)
|
||||||
self._transport.startTLS(ClientTLSContext())
|
self._transport.startTLS(ClientTLSContext())
|
||||||
#connection is done send to presentation
|
#connection is done send to presentation
|
||||||
|
|||||||
Reference in New Issue
Block a user