citronneur / rdpy Goto Github PK
View Code? Open in Web Editor NEWRemote Desktop Protocol in Twisted Python
License: GNU General Public License v3.0
Remote Desktop Protocol in Twisted Python
License: GNU General Public License v3.0
$ rdpy-rdphoneypot.py LA: 0.24
[*] INFO: Build size map
[*] INFO: Connection from 127.0.0.1:48412
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "build/bdist.linux-x86_64/egg/rdpy/core/layer.py", line 209, in dataReceived
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/tpkt.py", line 195, in readData
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/x224.py", line 148, in recvData
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/t125/mcs.py", line 243, in recvData
File "build/bdist.linux-x86_64/egg/rdpy/core/layer.py", line 102, in <lambda>
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/sec.py", line 470, in recv
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/pdu/layer.py", line 504, in recvClientFontListPDU
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/rdp.py", line 480, in onReady
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.2-py2.7-linux-x86_64.egg/EGG-INFO/scripts/rdpy-rdphoneypot.py", line 56, in onReady
rssFilePath = sorted(self._rssFileSizeList, key = lambda x: abs(x[0][0] * x[0][1] - size))[0][1]
exceptions.IndexError: list index out of range
Hi,
Thank you for providing rpdy!
I am encountering two problems:
Any help would be appreciated.
Hi!
So you added in the RDP screenshot, and that works perfect. You had mentioned you could also create a VNC screenshot script. Could you please create that?
Thanks!
[*] INFO: *******************************************
[*] INFO: * NLA Security selected *
[*] INFO: *******************************************
Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "C:\Python27\lib\site-packages\twisted\internet\selectreactor.py", line 149, in _doReadOrWrite
why = getattr(selectable, method)()
File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 209, in doRead
return self._dataReceived(data)
File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 215, in _dataReceived
rval = self.protocol.dataReceived(data)
File "C:\Python27\lib\site-packages\twisted\protocols\tls.py", line 422, in dataReceived
self._flushReceiveBIO()
File "C:\Python27\lib\site-packages\twisted\protocols\tls.py", line 392, in _flushReceiveBIO
ProtocolWrapper.dataReceived(self, bytes)
File "C:\Python27\lib\site-packages\twisted\protocols\policies.py", line 120, in dataReceived
self.wrappedProtocol.dataReceived(data)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\nla\cssp.py", line 289, in <lambda>
self.dataReceived = lambda x: self.__class__.dataReceived(self, x)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\nla\cssp.py", line 208, in dataReceived
self._layer.dataReceived(data)
File "C:\Users\sjuul\workspace\rdpy\rdpy\core\layer.py", line 209, in dataReceived
self.recv(expectedData)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\tpkt.py", line 195, in readData
self._presentation.recv(data)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\x224.py", line 148, in recvData
self._presentation.recv(data)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\t125\mcs.py", line 243, in recvData
self._channels[channelId].recv(data)
File "C:\Users\sjuul\workspace\rdpy\rdpy\protocol\rdp\sec.py", line 636, in recvLicenceInfo
raise InvalidExpectedDataException("waiting license packet")
rdpy.core.error.InvalidExpectedDataException: waiting license packet
I'm trying to set up an rdp proxy by modifying the mitm code not to log the data. However I get the error above if I try to connect to the proxy
hello guys,
I'm going over your code and it seems like you don't support virtual channels redirection in rdpy yet.
moreover, I couldn't find the right place to add a support for other channels (I mostly see global channel messages).
thanks.
So, I have a use case that I would love to use rdpy for (assuming you were cool with it). I write a tool which is designed to take screenshots of web apps (along with other information), and aggregate all of that into a report. This really helps make the information gathering phase of pen tests go easier as we can automate this process.
I'd LOVE to be able to add in the ability to screenshot workstations/servers over RDP. This would also be great information to have for pen tests. I've never really developed with pyqt, so I figured I'd ask you first. Is there any easy way that you could add in the ability to take screenshots of the open window of rdpy? The most likely scenario how I would use this is to either take a screenshot of the login page itself (when not providing a username or password), or to take a screenshot after successfully having logged into the remote system. Is there any way you would be interested in adding a switch, or something that I could invoke which would screenshot the current rdpy screen? I'd really love that ability :)
Thanks again!
Hi, Thanks for your efforts in creating this library and sharing with us!
I am trying to use this code to handle some actions on a remote machine. I am able to connect to the remote machine using the rdpy client code sample, however, I am not able to send any mouse or key events to the remote machine. How do I achieve this?
Do I need to run the rdpy server code on the remote machine? if so, how can I do it since the port 3389 is already in use by the TCP services on windows and the rdpy server code throws exception saying that it cant listen on port 3389 since its already being listened by the windows TCP services.
Let me know...Thanks in advance!
Hello,
When replaying an RSS file with the rdpy-rssplayer, the keystrokes are displayed, but not all of them. Some are displayed as "" where xx is an hexadecimal code.
Is it the expected behavior ?
How can I get the real key pressed (specifying the keyboard layout somewhere?) ?
In last resort how can I map those hexadecimal value to an actual character or key that was pressed ?
Thanks and keep up with the good job !
Regards,
Arno
Hi there,
So I know that currently older versions of RDP are not supported. When RDPY connects to one of those older systems, an exception is thrown (obviously). However, if the same reactor is used after the previous exception has been hit, all of the following screenshots are only black screens.
This function (https://github.com/ChrisTruncer/EyeWitness/blob/Eyewitness_deaux_Shmoo/EyeWitness.py#L741-772) iterates over a list containing multiple IPs to connect to. If one of the IPs is running an old version of RDP, all screenshots will be black.
To re-create this ideally in a simpler manner, I'm going to try to edit your script to encounter the same issue. Try using this here - http://pastebin.com/8PsyVSA3
Just change the values of all_machines to IPs of systems on your network. Make one of them a Windows XP machine (or any unsupported RDP system). The script will likely finish, but all screenshots are black, even though two out of the three machines should have a screenshot.
Hope this helps to clarify the issue I am having. Just let me know otherwise.
I have tried rdpy-rdpmitm.py connecting to a target Win7 machine. If I use rdpy-rdpclient.py it works like a charm, but if I try with rdesktop
here's what happens. Still haven't tried with Microsoft's Terminal Services client mstsc
.
% ./rdpy-rdpmitm.py -o /tmp 192.168.56.3
ERROR : Error during read <class 'rdpy.protocol.rdp.x224.X224DataHeader'>::messageType
Unhandled Error
Traceback (most recent call last):
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "build/bdist.linux-x86_64/egg/rdpy/core/layer.py", line 209, in dataReceived
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/tpkt.py", line 195, in readData
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/x224.py", line 146, in recvData
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 897, in readType
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 97, in read
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 477, in __read__
rdpy.core.error.InvalidExpectedDataException: <class 'rdpy.core.type.UInt8'> const value expected 240 != 128
C:\Python27\Scripts>rdpy-rdpclient.py -w 900 -l 500 81.196.188.63:3389
[] INFO: -268368887
[] INFO: keyboard layout set to en
[*] INFO: Connection failed : [Failure instance: Traceback (failure with no frames): <
0060: A connection attempt failed because the connected party did not properly respond after
s failed to respond..
why ?
How can i solve this?
if i use x64 version is better?
Hello,
Is there a way to use preconnection PDU information somehow?
https://msdn.microsoft.com/en-us/library/cc242395.aspx
br,
Marko
I'd love to see rdpy have support for older versions of RDP. When I go on assessments, I still see a large number of Windows XP and Server 2003 in the networks. It would be awesome and really helpful if rdpy was able to add support for this older version.
Thanks
In the VNC example, you import RDP instead of RFB.
I'm connecting to a test VM, when I use rdesktop is all fine but with rdpy-rdpclient here's what I got. I tried removing some options, changing width&height, but no luck. :-(
% rdpy-rdpclient.py -u username -p password -w 800 -l 600 -r test.rss 192.168.1.102
INFO : keyboard layout set to en
ERROR : Error during read <class 'rdpy.protocol.rdp.gcc.ServerCoreData'>::clientRequestedProtocol
ERROR : Error during read <class 'rdpy.protocol.rdp.gcc.DataBlock'>::dataBlock
ERROR : Error during read <class 'rdpy.protocol.rdp.gcc.Settings'>::settings
Unhandled Error
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/lib64/python2.7/site-packages/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/lib64/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/lib64/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/lib64/python2.7/site-packages/qtreactor/qt4base.py", line 100, in _read
data = w.doRead()
File "/usr/lib64/python2.7/site-packages/twisted/internet/tcp.py", line 214, in doRead
return self._dataReceived(data)
File "/usr/lib64/python2.7/site-packages/twisted/internet/tcp.py", line 220, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/lib64/python2.7/site-packages/rdpy/core/layer.py", line 209, in dataReceived
self.recv(expectedData)
File "/usr/lib64/python2.7/site-packages/rdpy/protocol/rdp/tpkt.py", line 195, in readData
self._presentation.recv(data)
File "/usr/lib64/python2.7/site-packages/rdpy/protocol/rdp/x224.py", line 147, in recvData
self._presentation.recv(data)
File "/usr/lib64/python2.7/site-packages/rdpy/protocol/rdp/mcs.py", line 372, in recvConnectResponse
self._serverSettings = gcc.readConferenceCreateResponse(data)
File "/usr/lib64/python2.7/site-packages/rdpy/protocol/rdp/gcc.py", line 581, in readConferenceCreateResponse
s.readType(serverSettings)
File "/usr/lib64/python2.7/site-packages/rdpy/core/type.py", line 894, in readType
value.read(self)
File "/usr/lib64/python2.7/site-packages/rdpy/core/type.py", line 97, in read
self.__read__(s)
File "/usr/lib64/python2.7/site-packages/rdpy/core/type.py", line 477, in __read__
raise e
rdpy.core.error.InvalidSize: Impossible to read type <class 'rdpy.protocol.rdp.gcc.ServerCoreData'> : read length is too small
please support Clipboard channels
[] ERROR: Error during read <class 'rdpy.core.rss.UpdateEvent'>::length
[] ERROR: Error during read <class 'rdpy.core.rss.Event'>::event
Traceback (most recent call last):
File "/root/Documents/rdpy/rdpy/bin/rdpy-rssplayer.py", line 104, in
QtCore.QTimer.singleShot(e.timestamp.value,lambda:loop(widget, rssFile, e))
File "/root/Documents/rdpy/rdpy/bin/rdpy-rssplayer.py", line 103, in loop
e = rssFile.nextEvent()
File "build/bdist.linux-x86_64/egg/rdpy/core/rss.py", line 282, in nextEvent
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 898, in readType
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 97, in read
File "build/bdist.linux-x86_64/egg/rdpy/core/type.py", line 478, in read
rdpy.core.error.InvalidSize: Stream is too small to read expected SimpleType
Hitting an exception in type.py on line 478
def __read__(self, s):
"""
@summary: Read inner value from stream
Use struct package to unpack
In accordance of structFormat and typeSize fields
@param s: Stream that will be read
@raise InvalidSize: if there is not enough data in stream
"""
if s.dataLen() < self._typeSize:
raise InvalidSize("Stream is too small to read expected SimpleType ")
self.value = struct.unpack(self._structFormat, s.read(self._typeSize))[0]
dataLen is 1 but typeSize is 4
When running rdpy-rdphoneypot.py on Ubuntu 14.04 x64, some connections cause the following error:
[*] INFO: Connection from xx.xxx.x.xx:33804
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 597, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 208, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 214, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy/core/layer.py", line 209, in dataReceived
self.recv(expectedData)
File "/usr/local/lib/python2.7/dist-packages/rdpy/protocol/rdp/tpkt.py", line 195, in readData
self._presentation.recv(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy/protocol/rdp/x224.py", line 148, in recvData
self._presentation.recv(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy/protocol/rdp/t125/mcs.py", line 542, in recvErectDomainRequest
raise InvalidExpectedDataException("Invalid MCS PDU : ERECT_DOMAIN_REQUEST expected")
rdpy.core.error.InvalidExpectedDataException: Invalid MCS PDU : ERECT_DOMAIN_REQUEST expected
Hi there,
I know you don't have this in here currently, but I was curious if you thought about adding support for linux X servers? In the event that the server is set to allow unauthenticated access, users could screenshot the active desktop. Would that be something you would consider adding in?
I know there's a high chance that this is my fault, but I can't get anything to work. I'm running Arch Linux and installed all dependencies using PIP as suggested. Here's all the errors I'm getting:
$ rdpy-rdpclient.py
File "/usr/bin/rdpy-rdpclient.py", line 225
"""
^
SyntaxError: invalid syntax
$ rdpy-rdphoneypot.py
File "/usr/bin/rdpy-rdphoneypot.py", line 153
"""
^
SyntaxError: invalid syntax
$ rdpy-rdpmitm.py
File "/usr/bin/rdpy-rdpmitm.py", line 267
"""
^
SyntaxError: invalid syntax
$ rdpy-rdpscreenshot.py
File "/usr/bin/rdpy-rdpscreenshot.py", line 191
print "Usage: rdpy-rdpscreenshot [options] ip[:port]"
^
SyntaxError: Missing parentheses in call to 'print'
$ rdpy-rssplayer.py
File "/usr/bin/rdpy-rssplayer.py", line 73
print "Usage: rdpy-rssplayer [-h] rss_filepath"
^
SyntaxError: Missing parentheses in call to 'print'
$ rdpy-vncclient.py
Traceback (most recent call last):
File "/usr/bin/rdpy-vncclient.py", line 27, in <module>
from rdpy.ui.qt4 import RFBClientQt
File "/usr/lib/python3.5/site-packages/rdpy/ui/qt4.py", line 27, in <module>
from rdpy.protocol.rfb.rfb import RFBClientObserver
File "/usr/lib/python3.5/site-packages/rdpy/protocol/rfb/rfb.py", line 28, in <module>
from rdpy.core.layer import RawLayer, RawLayerClientFactory
File "/usr/lib/python3.5/site-packages/rdpy/core/layer.py", line 110, in <module>
from type import Stream
ImportError: No module named 'type'
$ rdpy-vncscreenshot.py
File "/usr/bin/rdpy-vncscreenshot.py", line 135
print "Usage: rdpy-vncscreenshot [options] ip[:port]"
^
SyntaxError: Missing parentheses in call to 'print'
Tried -o ~/rdp -n IP_ADDRESS
didn't seem to work (stuck).
How am I suppose to use it? How do I give the credentials?
Can I use this to record and replay the entire session or does it record just the login?
Thanks,
Hanan.
Hi there again!
I'm trying to go through and test your latest commits before I push out my stuff (finally), and I am running into a bug when trying to screenshot a rdp server.
I removed the IP address, but if you need one, let me know and I can send you one privately to test against. Here is the crash dump - http://pastebin.com/PtcytEsw
Thanks!
edit: markdown messed up the diff. This line:
elif value < 0xffff:
should be:
elif value <= 0xffff:
Qt4 has been deprecated and Qt5 (5.6 long term support, 5.7 latest). Unfortunately PyQt4 is no longer supported through homebrew on macOS and everything is migrating to Qt5 and so rdpy no longer functions.
Hey there,
First off, I know this is a work in project (so it seems). Having this built, would be AWESOME. I've been searching for a pure python RDP client, I would love to see this.
I tried building rdpy after cloning it, but it seems I am getting an error. I'm using Kali linux to test this on. Figured I'd post the error here for you:
scons -C rdpy/rdpy/core install
scons: Entering directory `/mnt/hgfs/gitrepos/rdpy/rdpy/core'
scons: Reading SConscript files ...
TypeError: File /mnt/hgfs/gitrepos/rdpy/rdpy/core/Sconstruct found where directory expected.:
File "/mnt/hgfs/gitrepos/rdpy/rdpy/core/SConstruct", line 4:
script_dir = os.path.dirname(os.path.realpath(Dir("#/Sconstruct").abspath))
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(_args, *_kw)
File "/usr/lib/scons/SCons/Environment.py", line 1978:
return self.fs.Dir(s, _args, *_kw)
File "/usr/lib/scons/SCons/Node/FS.py", line 1351:
return self._lookup(name, directory, Dir, create)
File "/usr/lib/scons/SCons/Node/FS.py", line 1318:
return root._lookup_abs(p, fsclass, create)
File "/usr/lib/scons/SCons/Node/FS.py", line 2215:
result.diskcheck_match()
File "/usr/lib/scons/SCons/Node/FS.py", line 1504:
"File %s found where directory expected.")
File "/usr/lib/scons/SCons/Node/FS.py", line 384:
return self.func(_args, *_kw)
File "/usr/lib/scons/SCons/Node/FS.py", line 405:
raise TypeError(errorfmt % node.abspath)
Hello,
In your opinion, is it possible to have a python RDP server (rdpy-rdpserver) thanks to this project?
The aim would be to use this project client side and server side in order to don't use RDP inherent in Windows.
Thank you in advance for your response,
I opened notepad and minimize it. Next, I run script rdpy and logon to the system, introduced alt + tab, then several keys through sendKeyEventUnicode. Then I come in again through the normal login. It turns out that window becomes active, but keys is not pressed (so with rdpy script letters are still introduced into the old window). So problem is that we need to wait until window will be in focus.
Another thing (that's my actually problem): I run a console with "win + r", then I want to enter a command. But the window "Run" out of focus. So all my further keys go wrong.
When connecting to win server 2008 r2, i see error
ERROR : INFO PDU : Unknown code 0x0L
but connection is correctly end. What does it mean?
Followed installation instructions.
on
rdpy-rdpclient.py server-name
Rdp window opens and I have a popup with this text:
Lost connection : [Failure instance: Traceback (failure with no frames):
<class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly. ]
And here is what I have in terminal:
INFO : failed to auto detect keyboard layout [Errno 2] No such file or directory
INFO : keyboard layout set to en
INFO : *******************************************
INFO : * NLA Security selected *
INFO : *******************************************
^[[A2015-03-13 11:48:59.010 Python[52516:d07] modalSession has been exited
prematurely - check for a reentrant call to endModalSession:
pyqt installed via homebrew (brew install qt sip pyqt)
I did not expected it to work on os x 10.9 as you don't mentioned os x at all, but it was worth checking out. If it would've work for me, that going to be my replacement for CoRD as I cannot make changes to that, and contributing to python source code is actually an option.
Thank you for this project!
Hello,
Thank you for your project. Good job :)
I have tried to use your Simple RDP Client code and your Simple RDP Server code. To use your RDP server code, I need to modify this following line:
reactor.listenTCP(3389, MyRDPFactory())
by
reactor.listenTCP(3389, MyRDPFactory(15))
Otherwise, I have this following error:
TypeError: __init__() takes at least 2 arguments (1 given)
Moreover, when I use the sample RDP client code, I have the following error when it is connecting to the sample RDP server:
[*] WARNING: *******************************************
[*] WARNING: * RDP Security selected *
[*] WARNING: *******************************************
[*] DEBUG: read RSA public key from proprietary certificate
[*] DEBUG: Still have correct data in packet <class 'rdpy.protocol.rdp.pdu.caps.PointerCapability'>, read 2 bytes as padding
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 611, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 209, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/nla/cssp.py", line 208, in dataReceived
self._layer.dataReceived(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/core/layer.py", line 209, in dataReceived
self.recv(expectedData)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/tpkt.py", line 195, in readData
self._presentation.recv(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/x224.py", line 148, in recvData
self._presentation.recv(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/t125/mcs.py", line 243, in recvData
self._channels[channelId].recv(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/core/layer.py", line 102, in <lambda>
callback = lambda x:self.__class__.recv(self, x)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/sec.py", line 470, in recv
self._presentation.recv(data)
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/pdu/layer.py", line 263, in recvServerFontMapPDU
self._listener.onReady()
File "/home/bobsecurity/Bureau/rdpy-master/rdpy/protocol/rdp/rdp.py", line 200, in onReady
observer.onReady()
File "rdpc.py", line 20, in onReady
self._controller.sendKeyEventUnicode(ord(unicode("r".toUtf8(), encoding="UTF-8")), True)
exceptions.AttributeError: 'str' object has no attribute 'toUtf8'
Thank you for your help,
Hi, is it possible to get credentials data from the .rss files, or by mitmproxy programmatically?
Hi,
Is there a way to convert the rss file into any video formats so that I can fast forward the RDP capture. I have a big capture file that I want to go through at a fast rate. Also, if there is a way that this can be done directly in rssplayer that would also be useful.
Thanks.
Tested freerdp version 1.2.0_beta1_pre20141115 against rdpmitm, here's the output:
% ./rdpy-rdpmitm.py -o /tmp 192.168.56.3
Unhandled Error
Traceback (most recent call last):
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "venv/lib/python2.7/site-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "build/bdist.linux-x86_64/egg/rdpy/core/layer.py", line 209, in dataReceived
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/tpkt.py", line 195, in readData
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/x224.py", line 147, in recvData
File "build/bdist.linux-x86_64/egg/rdpy/protocol/rdp/mcs.py", line 520, in recvConnectInitial
exceptions.AttributeError: 'NoneType' object has no attribute 'channelDefArray'
Hi,
Cool project, love the idea. I was testing out the rdpy-rdphoneypot.py and I've encountered the following errors when testing with hydra and ncrack. I'm running Ubuntu 12.04.5 LTS and Python 2.7.3. Please let me know if you need any more info.
Thanks,
Zach
Here's the stack trace when I test with Hydra:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/core/layer.py", line 209, in dataReceived
self.recv(expectedData)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/tpkt.py", line 195, in readData
self._presentation.recv(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/x224.py", line 147, in recvData
data.readType(header)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/core/type.py", line 897, in readType
value.read(self)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/core/type.py", line 97, in read
self.__read__(s)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/core/type.py", line 477, in __read__
raise e
rdpy.core.error.InvalidExpectedDataException: <class 'rdpy.core.type.UInt8'> const value expected 240 != 128
Here's the stack trace from ncrack:
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/core/layer.py", line 209, in dataReceived
self.recv(expectedData)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/tpkt.py", line 195, in readData
self._presentation.recv(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/x224.py", line 148, in recvData
self._presentation.recv(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/t125/mcs.py", line 544, in recvErectDomainRequest
per.readInteger(data)
File "/usr/local/lib/python2.7/dist-packages/rdpy-1.3.0-py2.7-linux-x86_64.egg/rdpy/protocol/rdp/t125/per.py", line 144, in readInteger
raise InvalidValue("invalid integer size %d"%size)
rdpy.core.error.InvalidValue: invalid integer size 0
[18:02:20:794] [10716:-1236563136] [ERROR][com.freerdp.core] - invalid signature length (got 56, expected 64)
[18:02:20:794] [10716:-1236563136] [ERROR][com.freerdp.core.gcc] - gcc_read_server_data_blocks: gcc_read_server_security_data failed
[18:02:20:794] [10716:-1236563136] [ERROR][com.freerdp.core.gcc] - gcc_read_conference_create_response: gcc_read_server_data_blocks failed
[18:02:20:794] [10716:-1236563136] [ERROR][com.freerdp.core] - gcc_read_conference_create_response failed
[18:02:20:794] [10716:-1236563136] [ERROR][com.freerdp.core.connection] - rdp_client_connect_mcs_connect_response: mcs_recv_connect_response failed
i use the commmand:
rdpy-rdpmitm.py -o c:/123 192.168.83.185
the result is:
Traceback (most recent call last):
File "C:\Python27\Scripts\rdpy-rdpmitm.py", line 309, in
reactor.listenTCP(int(listen), ProxyServerFactory(parseIpPort(args[0]), oupu
tDirectory, privateKeyFilePath, certificateFilePath, clientSecurity))
File "C:\Python27\lib\site-packages\twisted\internet\posixbase.py", line 478,
in listenTCP
p.startListening()
File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 984, in sta
rtListening
raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on any:3389: [Errno 10
048] Only one usage of each socket address (protocol/network address/port) is no
rmally permitted.
As the title says, I need a way to handle the License Error PDU-Valid Client.
Please add a copy of the GPLv3 license to the top-level directory. This makes it easy for people to find the terms.
I want to open Explorer on the remote machine, to which I joined by the rdpy.
To do this, i need to press the hotkeys win + e.
I do this with the following code:
self._controller.sendKeyEventScancode (347, True)
self._controller.sendKeyEventScancode (18, True)
self._controller.sendKeyEventScancode (18, False)
self._controller.sendKeyEventScancode (347, False)
Since the keys scancode lwin = 347.
But the key is not pressed.
Can you please tell me what code i should write to do this.
The client (windows) no longer prompts you for credentials before you establish a remote desktop connection, so no logon data is stored in cleartext.
This window doesn't appear..
2.
The keyboard layout of the client isn't detected automatically, always the US keyboard will be used even if the client has a different layout. I think always the default value found in gcc.py self.kbdLayout = UInt32Le(KeyboardLayout.US) will be used cause if i change that value i get a different keyboard layout.
Got a workaround for keyboard layout for me (chaniung the gcc.py self.kbdLayout = UInt32Le(KeyboardLayout.US value) so that is solved for me only the credentials Problem is still valid
Hi there,
I'm attempting to loop over connecting to multiple machines via RDP, and I'm getting an error in rdpy. If I'm writing this code wrong, I'd love to know, otherwise I wanted to report this bug to you. The pastebin here (http://pastebin.com/3Rx4vd5B) shows the error that I'm getting. The top is the error, the bottom part is the specific function I am using to connect via RDP and make a screenshot.
If you need to see my full code, it's here - https://github.com/ChrisTruncer/EyeWitness/tree/Eyewitness_deaux_Shmoo
Hi Silvain,
First of all, thanks for your library!
I'm experiencing issues with the server when attempting to connect with microsoft RDP client (like the one bundled in XP), see error below:
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, _args, *_kw)
File "/usr/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(args,*kw)
--- ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in doRead
return self._dataReceived(data)
File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 221, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/home/test/rdpy-master/rdpy/../rdpy/protocol/network/layer.py", line 114, in dataReceived
self.recv(expectedData)
File "/home/test/rdpy-master/rdpy/../rdpy/protocol/rdp/tpkt.py", line 90, in readData
self._presentation.recv(data)
File "/home/test/rdpy-master/rdpy/../rdpy/protocol/rdp/tpdu.py", line 108, in recvConnectionConfirm
raise InvalidExpectedDataException("invalid TPDU header code X224_TPDU_CONNECTION_CONFIRM != %d"%header.code)
exceptions.TypeError: %d format: a number is required, not UInt8
Thanks !
Thanks for your project. It's great.
I'm trying to implement a Python script to processing a list of RDP servers and run a batch script with saving results. Can you give me any advice for this task. Thanks a lot.
thank you for making these tools, can you please port the timeout fix you did for the rdp one to the vnc bin? it is badly broke on my system and im sure timeout would help greatly. thank you
So, Im using this code:
`#!/usr/bin/env python
from rdpy.protocol.rdp import rdp
from twisted.internet import reactor
from rdpy.core.error import RDPSecurityNegoFail
class RDPFactory(rdp.ClientFactory):
def __init__(self, username, password):
self.username = username
self.password = password
def clientConnectionLost(self, connector, reason):
print "Connection lost. Reason: %s" % reason.type
reactor.stop()
def clientConnectionFailed(self, connector, reason):
print "Connection Failed. Reason: %s" % reason.type
reactor.stop()
def buildObserver(self, controller, addr):
controller.setUsername(self.username)
controller.setPassword(self.password)
class MyObserver(rdp.RDPClientObserver):
def onReady(self):
"""
@summary: Call when stack is ready
"""
print "Observer ready"
def onClose(self):
"""
@summary: Call when stack is close
"""
print "Obsever closed"
return MyObserver(controller)
`
Is there a way to have a credentials callback? If the username and password is wrong, how can I show it to the user?
Thanks
Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 88, in callWi
thLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\log.py", line 73, in callWi
thContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\context.py", line 118, in c
allWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "C:\Python27\lib\site-packages\twisted\python\context.py", line 81, in ca
llWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "C:\Python27\lib\site-packages\qtreactor\qt4base.py", line 100, in _read
data = w.doRead()
File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 209, in doR
ead
return self._dataReceived(data)
File "C:\Python27\lib\site-packages\twisted\internet\tcp.py", line 215, in _da
taReceived
rval = self.protocol.dataReceived(data)
File "build\bdist.win32\egg\rdpy\protocol\rdp\nla\cssp.py", line 208, in dataR
eceived
File "build\bdist.win32\egg\rdpy\core\layer.py", line 209, in dataReceived
File "build\bdist.win32\egg\rdpy\protocol\rdp\tpkt.py", line 195, in readData
File "build\bdist.win32\egg\rdpy\protocol\rdp\x224.py", line 199, in recvConne
ctionConfirm
rdpy.core.error.RDPSecurityNegoFail: negotiation failure code 2
Hello, why this error is unhandled? Can I catch it (so it is not displayed in the console) so as not to disrupt the logic of the program?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.