Correct bug from cssp security layer
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -206,6 +206,13 @@ class CSSP(protocol.Protocol):
|
||||
@param data: string data receive from twisted
|
||||
"""
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user