add fullscreen mode for client

This commit is contained in:
citronneur
2014-11-29 19:00:14 +01:00
parent 5af9f0708a
commit 3c3d7423a5
7 changed files with 44 additions and 30 deletions

View File

@@ -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. Remote Desktop Protocol in twisted PYthon.
RDPY is still under development. RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol. RDPY is built over the event driven network engine Twisted.
RDPY is a pure Python implementation ot the Microsoft RDP (Remote Desktop Protocol) protocol. RDPY is built over the event driven network engine Twisted.
## Build ## Build
@@ -22,9 +20,10 @@ sudo apt-get install python-qt4
#### Windows #### 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) [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) [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 $ 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-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 ### 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-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 ### 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-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 ### 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-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 ### 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-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: 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. 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: The RDP client code looks like this:
``` ```python
from rdpy.protocol.rdp import rdp from rdpy.protocol.rdp import rdp
class MyRDPFactory(rdp.ClientFactory): class MyRDPFactory(rdp.ClientFactory):
@@ -157,7 +158,7 @@ reactor.run()
``` ```
The VNC client code looks like this: The VNC client code looks like this:
``` ```python
from rdpy.protocol.rfb import rdp from rdpy.protocol.rfb import rdp
class MyRDPFactory(rfb.ClientFactory): class MyRDPFactory(rfb.ClientFactory):

View File

@@ -35,19 +35,21 @@ class RDPClientQtFactory(rdp.ClientFactory):
""" """
@summary: Factory create a RDP GUI client @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 width: width of client
@param heigth: heigth of client @param heigth: heigth of client
@param username: username present to the server @param username: username present to the server
@param password: password present to the server @param password: password present to the server
@param domain: microsoft domain @param domain: microsoft domain
@param fullscreen: show widget in fullscreen mode
""" """
self._width = width self._width = width
self._height = height self._height = height
self._username = username self._username = username
self._passwod = password self._passwod = password
self._domain = domain self._domain = domain
self._fullscreen = fullscreen
self._w = None self._w = None
def buildObserver(self, controller, addr): def buildObserver(self, controller, addr):
@@ -63,7 +65,10 @@ class RDPClientQtFactory(rdp.ClientFactory):
#create qt widget #create qt widget
self._w = client.getWidget() self._w = client.getWidget()
self._w.setWindowTitle('rdpy-rdpclient') self._w.setWindowTitle('rdpy-rdpclient')
self._w.show() if self._fullscreen:
self._w.showFullScreen()
else:
self._w.show()
controller.setUsername(self._username) controller.setUsername(self._username)
controller.setPassword(self._passwod) controller.setPassword(self._passwod)
@@ -104,12 +109,21 @@ def help():
print "\t-l: height of screen default value is 800" print "\t-l: height of screen default value is 800"
if __name__ == '__main__': if __name__ == '__main__':
#create application
app = QtGui.QApplication(sys.argv)
#add qt4 reactor
import qt4reactor
qt4reactor.install()
#default script argument #default script argument
username = "" username = ""
password = "" password = ""
domain = "" domain = ""
width = 1024 width = QtGui.QDesktopWidget().screenGeometry().width()
height = 800 height = QtGui.QDesktopWidget().screenGeometry().height()
fullscreen = True
try: try:
opts, args = getopt.getopt(sys.argv[1:], "hu:p:d:w:l:") opts, args = getopt.getopt(sys.argv[1:], "hu:p:d:w:l:")
@@ -127,22 +141,17 @@ if __name__ == '__main__':
domain = arg domain = arg
elif opt == "-w": elif opt == "-w":
width = int(arg) width = int(arg)
fullscreen = False
elif opt == "-l": elif opt == "-l":
height = int(arg) height = int(arg)
fullscreen = False
if ':' in args[0]: if ':' in args[0]:
ip, port = args[0].split(':') ip, port = args[0].split(':')
else: else:
ip, port = args[0], "3389" ip, port = args[0], "3389"
#create application
app = QtGui.QApplication(sys.argv)
#add qt4 reactor
import qt4reactor
qt4reactor.install()
from twisted.internet import reactor 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() reactor.runReturn()
app.exec_() app.exec_()

View File

@@ -4,8 +4,12 @@ import setuptools
from distutils.core import setup, Extension from distutils.core import setup, Extension
setup(name='rdpy', setup(name='rdpy',
version='1.0.1', version='1.1.0',
description='Remote Desktop Protocol in Python', 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='Sylvain Peyrefitte',
author_email='citronneur@gmail.com', author_email='citronneur@gmail.com',
url='https://github.com/citronneur/rdpy', url='https://github.com/citronneur/rdpy',
@@ -21,11 +25,11 @@ setup(name='rdpy',
], ],
ext_modules=[Extension('rle', ['ext/rle.c'])], ext_modules=[Extension('rle', ['ext/rle.c'])],
scripts = [ scripts = [
'bin/rdpy-rdpclient', 'bin/rdpy-rdpclient.py',
'bin/rdpy-rdpproxy', 'bin/rdpy-rdpproxy.py',
'bin/rdpy-rdpscreenshot', 'bin/rdpy-rdpscreenshot.py',
'bin/rdpy-vncclient', 'bin/rdpy-vncclient.py',
'bin/rdpy-vncscreenshot' 'bin/rdpy-vncscreenshot.py'
], ],
install_requires=[ install_requires=[
'twisted', 'twisted',