diff --git a/bin/rdpy-rdpmitm.py b/bin/rdpy-rdpmitm.py index 0042a37..1a5c1c6 100755 --- a/bin/rdpy-rdpmitm.py +++ b/bin/rdpy-rdpmitm.py @@ -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: diff --git a/bin/rdpy-rdpscreenshot.py b/bin/rdpy-rdpscreenshot.py index 1862b6e..7ca58a7 100755 --- a/bin/rdpy-rdpscreenshot.py +++ b/bin/rdpy-rdpscreenshot.py @@ -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 diff --git a/rdpy/protocol/rdp/nla/cssp.py b/rdpy/protocol/rdp/nla/cssp.py index c42ca40..6d76756 100644 --- a/rdpy/protocol/rdp/nla/cssp.py +++ b/rdpy/protocol/rdp/nla/cssp.py @@ -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): """ diff --git a/rdpy/protocol/rdp/rdp.py b/rdpy/protocol/rdp/rdp.py index 84dd80b..ba3c4ba 100644 --- a/rdpy/protocol/rdp/rdp.py +++ b/rdpy/protocol/rdp/rdp.py @@ -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] diff --git a/rdpy/protocol/rdp/x224.py b/rdpy/protocol/rdp/x224.py index af3e289..bd900ce 100644 --- a/rdpy/protocol/rdp/x224.py +++ b/rdpy/protocol/rdp/x224.py @@ -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