#!/usr/bin/python ''' @author: sylvain ''' import sys, os # Change path so we find rdpy sys.path.insert(1, os.path.join(sys.path[0], '..')) from rdpy.protocol.rdp import rdp from twisted.internet import reactor class ProxyServer(rdp.RDPServerObserver): def onReady(self): reactor.connectTCP("wav-glw-013", 3389, ProxyClientFactory(self)) def clientConnected(self, client): print "ok" class ProxyClient(rdp.RDPClientObserver): def __init__(self, controller, server): rdp.RDPClientObserver.__init__(self, controller) self._server = server def onReady(self): self._server.clientConnected(self) def onUpdate(self, destLeft, destTop, destRight, destBottom, width, height, bitsPerPixel, isCompress, data): pass class ProxyServerFactory(rdp.ServerFactory): def __init__(self): rdp.ServerFactory.__init__(self, "/home/speyrefitte/dev/certificate/rdpy.key", "/home/speyrefitte/dev/certificate/rdpy.crt") def buildObserver(self, controller): return ProxyServer(controller) def startedConnecting(self, connector): pass def clientConnectionLost(self, connector, reason): pass def clientConnectionFailed(self, connector, reason): pass class ProxyClientFactory(rdp.ClientFactory): def __init__(self, server): self._server = server def buildObserver(self, controller): return ProxyClient(controller, self._server) def startedConnecting(self, connector): pass def clientConnectionLost(self, connector, reason): pass def clientConnectionFailed(self, connector, reason): pass if __name__ == '__main__': reactor.listenTCP(33389, ProxyServerFactory()) reactor.run()