From 3c3d7423a5666a5b5d93fd02a3e6f42178c4d6a8 Mon Sep 17 00:00:00 2001 From: citronneur Date: Sat, 29 Nov 2014 19:00:14 +0100 Subject: [PATCH] add fullscreen mode for client --- README.md | 25 +++++++------- bin/{rdpy-rdpclient => rdpy-rdpclient.py} | 33 ++++++++++++------- bin/{rdpy-rdpproxy => rdpy-rdpproxy.py} | 0 ...py-rdpscreenshot => rdpy-rdpscreenshot.py} | 0 bin/{rdpy-vncclient => rdpy-vncclient.py} | 0 ...py-vncscreenshot => rdpy-vncscreenshot.py} | 0 setup.py | 16 +++++---- 7 files changed, 44 insertions(+), 30 deletions(-) rename bin/{rdpy-rdpclient => rdpy-rdpclient.py} (90%) rename bin/{rdpy-rdpproxy => rdpy-rdpproxy.py} (100%) rename bin/{rdpy-rdpscreenshot => rdpy-rdpscreenshot.py} (100%) rename bin/{rdpy-vncclient => rdpy-vncclient.py} (100%) rename bin/{rdpy-vncscreenshot => rdpy-vncscreenshot.py} (100%) diff --git a/README.md b/README.md index bfdf510..d65a924 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ -# RDPY [![Build Status](https://travis-ci.org/citronneur/rdpy.svg?branch=master)](https://travis-ci.org/citronneur/rdpy) +# RDPY [![Build Status](https://travis-ci.org/citronneur/rdpy.svg?branch=dev)](https://travis-ci.org/citronneur/rdpy) Remote Desktop Protocol in twisted PYthon. -RDPY is still under development. - -RDPY is a pure Python implementation ot the Microsoft RDP (Remote Desktop Protocol) protocol. RDPY is built over the event driven network engine Twisted. +RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol. RDPY is built over the event driven network engine Twisted. ## Build @@ -22,9 +20,10 @@ sudo apt-get install python-qt4 #### Windows [PyQt4](http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt4-4.11.3-gpl-Py2.7-Qt4.8.6-x32.exe) + [PyWin32](http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/pywin32-218.win32-py2.7.exe/download) -### Make +### Build ``` $ git clone https://github.com/citronneur/rdpy.git rdpy @@ -52,7 +51,7 @@ RDPY comes with some very useful binaries; These binaries are linux and windows rdpy-rdpclient is a simple RDP Qt4 client . ``` -$ rdpy/bin/rdpy-rdpclient [-u username] [-p password] [-d domain] [...] XXX.XXX.XXX.XXX[:3389] +$ rdpy-rdpclient.py [-u username] [-p password] [-d domain] [...] XXX.XXX.XXX.XXX[:3389] ``` ### rdpy-vncclient @@ -60,7 +59,7 @@ $ rdpy/bin/rdpy-rdpclient [-u username] [-p password] [-d domain] [...] XXX.XXX. rdpy-vncclient is a simple VNC Qt4 client . ``` -$ rdpy/bin/rdpy-vncclient [-p password] XXX.XXX.XXX.XXX[:5900] +$ rdpy-vncclient.py [-p password] XXX.XXX.XXX.XXX[:5900] ``` ### rdpy-rdpscreenshot @@ -68,7 +67,7 @@ $ rdpy/bin/rdpy-vncclient [-p password] XXX.XXX.XXX.XXX[:5900] rdpy-rdpscreenshot save login screen in file. ``` -$ rdpy/bin/rdpy-rdpscreenshot [-w width] [-l height] [-o output_file_path] XXX.XXX.XXX.XXX[:3389] +$ rdpy-rdpscreenshot.py [-w width] [-l height] [-o output_file_path] XXX.XXX.XXX.XXX[:3389] ``` ### rdpy-vncscreenshot @@ -76,7 +75,7 @@ $ rdpy/bin/rdpy-rdpscreenshot [-w width] [-l height] [-o output_file_path] XXX.X rdpy-vncscreenshot save first screen update in file. ``` -$ rdpy/bin/rdpy-vncscreenshot [-p password] [-o output_file_path] XXX.XXX.XXX.XXX[:5900] +$ rdpy-vncscreenshot.py [-p password] [-o output_file_path] XXX.XXX.XXX.XXX[:5900] ``` ### rdpy-rdpproxy @@ -84,7 +83,7 @@ $ rdpy/bin/rdpy-vncscreenshot [-p password] [-o output_file_path] XXX.XXX.XXX.XX rdpy-rdpproxy is a RDP proxy. It is used to manage and control access to the RDP servers as well as watch live sessions through any RDP client. It can be compared to a HTTP reverse proxy with added spy features. ``` -$ rdpy/bin/rdpy-rdpproxy -f credentials_file_path -k private_key_file_path -c certificate_file_path [-i admin_ip[:admin_port]] listen_port +$ rdpy-rdpproxy.py -f credentials_file_path -k private_key_file_path -c certificate_file_path [-i admin_ip[:admin_port]] listen_port ``` The credentials file is JSON file that must conform with the following format: @@ -120,9 +119,11 @@ RDPY can also be used as Qt widget throw rdpy.ui.qt4.QRemoteDesktop class. It ca In a nutshell the RDPY can be used as a protocol library with a twisted engine. +### Client library + The RDP client code looks like this: -``` +```python from rdpy.protocol.rdp import rdp class MyRDPFactory(rdp.ClientFactory): @@ -157,7 +158,7 @@ reactor.run() ``` The VNC client code looks like this: -``` +```python from rdpy.protocol.rfb import rdp class MyRDPFactory(rfb.ClientFactory): diff --git a/bin/rdpy-rdpclient b/bin/rdpy-rdpclient.py similarity index 90% rename from bin/rdpy-rdpclient rename to bin/rdpy-rdpclient.py index 1424e81..f40209c 100755 --- a/bin/rdpy-rdpclient +++ b/bin/rdpy-rdpclient.py @@ -35,19 +35,21 @@ class RDPClientQtFactory(rdp.ClientFactory): """ @summary: Factory create a RDP GUI client """ - def __init__(self, width, height, username, password, domain): + def __init__(self, width, height, username, password, domain, fullscreen): """ @param width: width of client @param heigth: heigth of client @param username: username present to the server @param password: password present to the server @param domain: microsoft domain + @param fullscreen: show widget in fullscreen mode """ self._width = width self._height = height self._username = username self._passwod = password self._domain = domain + self._fullscreen = fullscreen self._w = None def buildObserver(self, controller, addr): @@ -63,7 +65,10 @@ class RDPClientQtFactory(rdp.ClientFactory): #create qt widget self._w = client.getWidget() self._w.setWindowTitle('rdpy-rdpclient') - self._w.show() + if self._fullscreen: + self._w.showFullScreen() + else: + self._w.show() controller.setUsername(self._username) controller.setPassword(self._passwod) @@ -104,12 +109,21 @@ def help(): print "\t-l: height of screen default value is 800" if __name__ == '__main__': + + #create application + app = QtGui.QApplication(sys.argv) + + #add qt4 reactor + import qt4reactor + qt4reactor.install() + #default script argument username = "" password = "" domain = "" - width = 1024 - height = 800 + width = QtGui.QDesktopWidget().screenGeometry().width() + height = QtGui.QDesktopWidget().screenGeometry().height() + fullscreen = True try: opts, args = getopt.getopt(sys.argv[1:], "hu:p:d:w:l:") @@ -127,22 +141,17 @@ if __name__ == '__main__': domain = arg elif opt == "-w": width = int(arg) + fullscreen = False elif opt == "-l": height = int(arg) + fullscreen = False if ':' in args[0]: ip, port = args[0].split(':') else: ip, port = args[0], "3389" - - #create application - app = QtGui.QApplication(sys.argv) - - #add qt4 reactor - import qt4reactor - qt4reactor.install() from twisted.internet import reactor - reactor.connectTCP(ip, int(port), RDPClientQtFactory(width, height, username, password, domain)) + reactor.connectTCP(ip, int(port), RDPClientQtFactory(width, height, username, password, domain, fullscreen)) reactor.runReturn() app.exec_() \ No newline at end of file diff --git a/bin/rdpy-rdpproxy b/bin/rdpy-rdpproxy.py similarity index 100% rename from bin/rdpy-rdpproxy rename to bin/rdpy-rdpproxy.py diff --git a/bin/rdpy-rdpscreenshot b/bin/rdpy-rdpscreenshot.py similarity index 100% rename from bin/rdpy-rdpscreenshot rename to bin/rdpy-rdpscreenshot.py diff --git a/bin/rdpy-vncclient b/bin/rdpy-vncclient.py similarity index 100% rename from bin/rdpy-vncclient rename to bin/rdpy-vncclient.py diff --git a/bin/rdpy-vncscreenshot b/bin/rdpy-vncscreenshot.py similarity index 100% rename from bin/rdpy-vncscreenshot rename to bin/rdpy-vncscreenshot.py diff --git a/setup.py b/setup.py index 127c4c9..a818be0 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,12 @@ import setuptools from distutils.core import setup, Extension setup(name='rdpy', - version='1.0.1', + version='1.1.0', description='Remote Desktop Protocol in Python', + long_description=""" + RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol. + RDPY is built over the event driven network engine Twisted. + """, author='Sylvain Peyrefitte', author_email='citronneur@gmail.com', url='https://github.com/citronneur/rdpy', @@ -21,11 +25,11 @@ setup(name='rdpy', ], ext_modules=[Extension('rle', ['ext/rle.c'])], scripts = [ - 'bin/rdpy-rdpclient', - 'bin/rdpy-rdpproxy', - 'bin/rdpy-rdpscreenshot', - 'bin/rdpy-vncclient', - 'bin/rdpy-vncscreenshot' + 'bin/rdpy-rdpclient.py', + 'bin/rdpy-rdpproxy.py', + 'bin/rdpy-rdpscreenshot.py', + 'bin/rdpy-vncclient.py', + 'bin/rdpy-vncscreenshot.py' ], install_requires=[ 'twisted',