Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
878637a
add missing links
citronneur Jun 9, 2015
542b66d
prints with parenthesis for python3
bruno-rodrigues-bitsight Mar 29, 2021
71cf592
update rle.c
bruno-rodrigues-bitsight Mar 29, 2021
2c20ee9
rename qt4 to qt5
bruno-rodrigues-bitsight Mar 29, 2021
fba6c21
single cmd line help path - show and exit
bruno-rodrigues-bitsight Mar 29, 2021
94b4797
python3 import full path instead of just relative
bruno-rodrigues-bitsight Mar 29, 2021
fc7b963
python3 has_key -> in
bruno-rodrigues-bitsight Mar 29, 2021
53e34b2
python3 cmp to le gt etc
bruno-rodrigues-bitsight Mar 29, 2021
8927adf
python3 iteritems -> items
bruno-rodrigues-bitsight Mar 29, 2021
a6fc624
python3 dict_values is not a list type
bruno-rodrigues-bitsight Mar 29, 2021
29b7f79
python3 io.BytesIO instead of python2 StringIO
bruno-rodrigues-bitsight Mar 29, 2021
8ffdbae
python3 integer division // instead of / auto-casting to float
bruno-rodrigues-bitsight Mar 29, 2021
5a32b4d
log "save screenshot" only if some data was received
bruno-rodrigues-bitsight Mar 29, 2021
ad0f02c
more qt5
bruno-rodrigues-bitsight Mar 30, 2021
d71174c
python3 bytes vs string, assertEquals, md5/sha, BytesIO vs buflist, etc
bruno-rodrigues-bitsight Mar 30, 2021
c333389
update readme and travis
bruno-rodrigues-bitsight Mar 30, 2021
9e46190
no message
bruno-rodrigues-bitsight May 14, 2021
97f2683
debug
bruno-rodrigues-bitsight May 14, 2021
bc8e231
no message
bruno-rodrigues-bitsight May 18, 2021
1665aed
no message
bruno-rodrigues-bitsight Jun 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ README.md~
dist/*
build/*
rdpy.egg-info/*
# version
rdpy-*.*.*
temp
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
language: python

python:
- 2.7
- 3.8

before_install:
- sudo apt-get install python-qt4
- ln -s /usr/lib/python2.7/dist-packages/PyQt4/ $VIRTUAL_ENV/lib/python2.7/site-packages/
- ln -s /usr/lib/python2.7/dist-packages/sip.so $VIRTUAL_ENV/lib/python2.7/site-packages/
- pip install qt4reactor pyopenssl twisted service_identity rsa pyasn1
- sudo apt-get install python-qt5
- ln -s /usr/lib/python3.8/dist-packages/PyQt5/ $VIRTUAL_ENV/lib/python3.8/site-packages/
- ln -s /usr/lib/python3.8/dist-packages/sip.so $VIRTUAL_ENV/lib/python3.8/site-packages/
- pip install qt5reactor pyopenssl twisted service_identity rsa pyasn1

install:
- python setup.py install
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RDPY is fully implemented in python, except the bitmap decompression algorithm w

### Dependencies

Dependencies are only needed for pyqt4 binaries :
Dependencies are only needed for pyqt5 binaries :
* rdpy-rdpclient
* rdpy-rdpscreenshot
* rdpy-vncclient
Expand All @@ -30,7 +30,7 @@ Dependencies are only needed for pyqt4 binaries :

Example for Debian based systems :
```
sudo apt-get install python-qt4
sudo apt-get install python-qt5
```

#### OS X
Expand All @@ -41,16 +41,13 @@ $ brew install qt sip pyqt

#### Windows

x86 | x86_64
----|-------
[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-x64.exe/download)
[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.win-amd64-py2.7.exe/download)
… FIXME …

### Build

```
$ git clone https://github.com/citronneur/rdpy.git rdpy
$ pip install twisted pyopenssl qt4reactor service_identity rsa pyasn1
$ pip install twisted pyopenssl qt5reactor service_identity rsa pyasn1
$ python rdpy/setup.py install
```

Expand All @@ -59,10 +56,10 @@ Or use PIP:
$ pip install rdpy
```

For virtualenv, you will need to link the qt4 library to it:
For virtualenv, you will need to link the qt5 library to it:
```
$ ln -s /usr/lib/python2.7/dist-packages/PyQt4/ $VIRTUAL_ENV/lib/python2.7/site-packages/
$ ln -s /usr/lib/python2.7/dist-packages/sip.so $VIRTUAL_ENV/lib/python2.7/site-packages/
$ ln -s /usr/lib/python3.8/dist-packages/PyQt5/ $VIRTUAL_ENV/lib/python3.8/site-packages/
$ ln -s /usr/lib/python3.8/dist-packages/sip.so $VIRTUAL_ENV/lib/python3.8/site-packages/
```

## RDPY Binaries
Expand All @@ -71,7 +68,7 @@ RDPY comes with some very useful binaries. These binaries are linux and windows

### rdpy-rdpclient

rdpy-rdpclient is a simple RDP Qt4 client.
rdpy-rdpclient is a simple RDP Qt5 client.

```
$ rdpy-rdpclient.py [-u username] [-p password] [-d domain] [-r rss_ouput_file] [...] XXX.XXX.XXX.XXX[:3389]
Expand All @@ -81,7 +78,7 @@ You can use rdpy-rdpclient in a Recorder Session Scenario, used in rdpy-rdphoney

### rdpy-vncclient

rdpy-vncclient is a simple VNC Qt4 client .
rdpy-vncclient is a simple VNC Qt5 client .

```
$ rdpy-vncclient.py [-p password] XXX.XXX.XXX.XXX[:5900]
Expand Down Expand Up @@ -136,7 +133,7 @@ $ rdpy-rssplayer.py rss_file_path

## RDPY Qt Widget

RDPY can also be used as Qt widget through rdpy.ui.qt4.QRemoteDesktop class. It can be embedded in your own Qt application. qt4reactor must be used in your app for Twisted and Qt to work together. For more details, see sources of rdpy-rdpclient.
RDPY can also be used as Qt widget through rdpy.ui.qt5.QRemoteDesktop class. It can be embedded in your own Qt application. qt5reactor must be used in your app for Twisted and Qt to work together. For more details, see sources of rdpy-rdpclient.

## RDPY library

Expand Down
32 changes: 20 additions & 12 deletions bin/rdpy-rdpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@

import sys, os, getopt, socket

from PyQt4 import QtGui, QtCore
from rdpy.ui.qt4 import RDPClientQt
from PyQt5 import QtGui, QtCore, QtWidgets
from rdpy.ui.qt5 import RDPClientQt
from rdpy.protocol.rdp import rdp
from rdpy.core.error import RDPSecurityNegoFail
from rdpy.core import rss

import rdpy.core.log as log
log._LOG_LEVEL = log.Level.INFO

def stop(reactor):
try:
reactor.stop()
except Exception as e:
log.warning(f"Error stopping reactor: {e}")


class RDPClientQtRecorder(RDPClientQt):
"""
Expand Down Expand Up @@ -173,7 +179,8 @@ def clientConnectionLost(self, connector, reason):
return

log.info("Lost connection : %s"%reason)
reactor.stop()
# reactor.stop()
stop(reactor)
app.exit()

def clientConnectionFailed(self, connector, reason):
Expand All @@ -183,7 +190,8 @@ def clientConnectionFailed(self, connector, reason):
@param reason: str use to advertise reason of lost connection
"""
log.info("Connection failed : %s"%reason)
reactor.stop()
# reactor.stop()
stop(reactor)
app.exit()

def autoDetectKeyboardLayout():
Expand Down Expand Up @@ -211,7 +219,7 @@ def autoDetectKeyboardLayout():
return "en"

def help():
print """
print("""
Usage: rdpy-rdpclient [options] ip[:port]"
\t-u: user name
\t-p: password
Expand All @@ -222,7 +230,7 @@ def help():
\t-k: keyboard layout [en|fr] [default : en]
\t-o: optimized session (disable costly effect) [default : False]
\t-r: rss_filepath Recorded Session Scenario [default : None]
"""
""")

if __name__ == '__main__':

Expand All @@ -240,7 +248,7 @@ def help():
try:
opts, args = getopt.getopt(sys.argv[1:], "hfou:p:d:w:l:k:r:")
except getopt.GetoptError:
help()
opts = [('-h', '')]
for opt, arg in opts:
if opt == "-h":
help()
Expand Down Expand Up @@ -270,11 +278,11 @@ def help():
ip, port = args[0], "3389"

#create application
app = QtGui.QApplication(sys.argv)
#add qt4 reactor
import qt4reactor
qt4reactor.install()
app = QtWidgets.QApplication(sys.argv)

#add qt5 reactor
import qt5reactor
qt5reactor.install()

if fullscreen:
width = QtGui.QDesktopWidget().screenGeometry().width()
Expand Down
8 changes: 4 additions & 4 deletions bin/rdpy-rdphoneypot.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def loopScenario(self, nextEvent):
clientSize = nextEvent.event.width.value, nextEvent.event.height.value
serverSize = self._controller.getScreen()

self._dx, self._dy = (max(0, serverSize[0] - clientSize[0]) / 2), max(0, (serverSize[1] - clientSize[1]) / 2)
self._dx, self._dy = (max(0, serverSize[0] - clientSize[0]) // 2), max(0, (serverSize[1] - clientSize[1]) // 2)
#restart connection sequence
return

Expand Down Expand Up @@ -140,14 +140,14 @@ def help():
"""
@summary: Print help in console
"""
print """
print("""
Usage: rdpy-rdphoneypot.py
[-L logfile]
[-l listen_port default 3389]
[-k private_key_file_path (mandatory for SSL)]
[-c certificate_file_path (mandatory for SSL)]
rss_filepath(1..n)
"""
""")

if __name__ == '__main__':
listen = "3389"
Expand All @@ -158,7 +158,7 @@ def help():
try:
opts, args = getopt.getopt(sys.argv[1:], "hl:k:c:L:")
except getopt.GetoptError:
help()
opts = [('-h', '')]
for opt, arg in opts:
if opt == "-h":
help()
Expand Down
Loading