fix issue on unhandle upadte
This commit is contained in:
@@ -70,7 +70,7 @@ class HoneyPotServer(rdp.RDPServerObserver):
|
|||||||
def onClose(self):
|
def onClose(self):
|
||||||
""" HoneyPot """
|
""" HoneyPot """
|
||||||
|
|
||||||
def onKeyEventScancode(self, code, isPressed):
|
def onKeyEventScancode(self, code, isPressed, isExtended):
|
||||||
""" HoneyPot """
|
""" HoneyPot """
|
||||||
|
|
||||||
def onKeyEventUnicode(self, code, isPressed):
|
def onKeyEventUnicode(self, code, isPressed):
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class LicPacket(CompositeType):
|
|||||||
if self.bMsgtype.value == c._MESSAGE_TYPE_:
|
if self.bMsgtype.value == c._MESSAGE_TYPE_:
|
||||||
return c(readLen = self.wMsgSize - 4)
|
return c(readLen = self.wMsgSize - 4)
|
||||||
log.debug("unknown license message : %s"%self.bMsgtype.value)
|
log.debug("unknown license message : %s"%self.bMsgtype.value)
|
||||||
return String()
|
return String(readLen = self.wMsgSize - 4)
|
||||||
|
|
||||||
if message is None:
|
if message is None:
|
||||||
message = FactoryType(LicensingMessageFactory)
|
message = FactoryType(LicensingMessageFactory)
|
||||||
|
|||||||
@@ -202,6 +202,16 @@ class Display(object):
|
|||||||
SUPPRESS_DISPLAY_UPDATES = 0x00
|
SUPPRESS_DISPLAY_UPDATES = 0x00
|
||||||
ALLOW_DISPLAY_UPDATES = 0x01
|
ALLOW_DISPLAY_UPDATES = 0x01
|
||||||
|
|
||||||
|
class ToogleFlag(object):
|
||||||
|
"""
|
||||||
|
@summary: Use to known state of keyboard
|
||||||
|
@see: https://msdn.microsoft.com/en-us/library/cc240588.aspx
|
||||||
|
"""
|
||||||
|
TS_SYNC_SCROLL_LOCK = 0x00000001
|
||||||
|
TS_SYNC_NUM_LOCK = 0x00000002
|
||||||
|
TS_SYNC_CAPS_LOCK = 0x00000004
|
||||||
|
TS_SYNC_KANA_LOCK = 0x00000008
|
||||||
|
|
||||||
class ErrorInfo(object):
|
class ErrorInfo(object):
|
||||||
"""
|
"""
|
||||||
@summary: Error code use in Error info PDU
|
@summary: Error code use in Error info PDU
|
||||||
@@ -542,9 +552,9 @@ class DataPDU(CompositeType):
|
|||||||
"""
|
"""
|
||||||
for c in [UpdateDataPDU, SynchronizeDataPDU, ControlDataPDU, ErrorInfoDataPDU, FontListDataPDU, FontMapDataPDU, PersistentListPDU, ClientInputEventPDU, ShutdownDeniedPDU, ShutdownRequestPDU, SupressOutputDataPDU, SaveSessionInfoPDU]:
|
for c in [UpdateDataPDU, SynchronizeDataPDU, ControlDataPDU, ErrorInfoDataPDU, FontListDataPDU, FontMapDataPDU, PersistentListPDU, ClientInputEventPDU, ShutdownDeniedPDU, ShutdownRequestPDU, SupressOutputDataPDU, SaveSessionInfoPDU]:
|
||||||
if self.shareDataHeader.pduType2.value == c._PDUTYPE2_:
|
if self.shareDataHeader.pduType2.value == c._PDUTYPE2_:
|
||||||
return c(readLen = CallableValue(self.shareDataHeader.uncompressedLength.value - 18))
|
return c(readLen = CallableValue(readLen.value - sizeof(self.shareDataHeader)))
|
||||||
log.debug("unknown PDU data type : %s"%hex(self.shareDataHeader.pduType2.value))
|
log.debug("unknown PDU data type : %s"%hex(self.shareDataHeader.pduType2.value))
|
||||||
return String(readLen = CallableValue(self.shareDataHeader.uncompressedLength.value - 18))
|
return String(readLen = CallableValue(readLen.value - sizeof(self.shareDataHeader)))
|
||||||
|
|
||||||
if pduData is None:
|
if pduData is None:
|
||||||
pduData = FactoryType(PDUDataFactory)
|
pduData = FactoryType(PDUDataFactory)
|
||||||
@@ -759,15 +769,9 @@ class UpdateDataPDU(CompositeType):
|
|||||||
"""
|
"""
|
||||||
for c in [BitmapUpdateDataPDU]:
|
for c in [BitmapUpdateDataPDU]:
|
||||||
if self.updateType.value == c._UPDATE_TYPE_:
|
if self.updateType.value == c._UPDATE_TYPE_:
|
||||||
if not readLen is None:
|
return c(readLen = CallableValue(readLen.value - 2))
|
||||||
return c(readLen = CallableValue(readLen.value - 2))
|
|
||||||
else:
|
|
||||||
return c()
|
|
||||||
log.debug("unknown PDU update data type : %s"%hex(self.updateType.value))
|
log.debug("unknown PDU update data type : %s"%hex(self.updateType.value))
|
||||||
if not readLen is None:
|
return String(readLen = CallableValue(readLen.value - 2))
|
||||||
return String(readLen = CallableValue(readLen.value - 2))
|
|
||||||
else:
|
|
||||||
return String()
|
|
||||||
|
|
||||||
if updateData is None:
|
if updateData is None:
|
||||||
updateData = FactoryType(UpdateDataFactory, conditional = lambda:(self.updateType.value != UpdateType.UPDATETYPE_SYNCHRONIZE))
|
updateData = FactoryType(UpdateDataFactory, conditional = lambda:(self.updateType.value != UpdateType.UPDATETYPE_SYNCHRONIZE))
|
||||||
@@ -915,11 +919,10 @@ class SlowPathInputEvent(CompositeType):
|
|||||||
self.messageType = UInt16Le(lambda:self.slowPathInputData.__class__._INPUT_MESSAGE_TYPE_)
|
self.messageType = UInt16Le(lambda:self.slowPathInputData.__class__._INPUT_MESSAGE_TYPE_)
|
||||||
|
|
||||||
def SlowPathInputDataFactory():
|
def SlowPathInputDataFactory():
|
||||||
for c in [PointerEvent, ScancodeKeyEvent, UnicodeKeyEvent]:
|
for c in [PointerEvent, ScancodeKeyEvent, UnicodeKeyEvent, SynchronizeEvent]:
|
||||||
if self.messageType.value == c._INPUT_MESSAGE_TYPE_:
|
if self.messageType.value == c._INPUT_MESSAGE_TYPE_:
|
||||||
return c()
|
return c()
|
||||||
log.debug("unknown slow path input : %s"%hex(self.messageType.value))
|
raise InvalidExpectedDataException("unknown slow path input : %s"%hex(self.messageType.value))
|
||||||
return String()
|
|
||||||
|
|
||||||
if messageData is None:
|
if messageData is None:
|
||||||
messageData = FactoryType(SlowPathInputDataFactory)
|
messageData = FactoryType(SlowPathInputDataFactory)
|
||||||
@@ -927,7 +930,19 @@ class SlowPathInputEvent(CompositeType):
|
|||||||
raise InvalidExpectedDataException("try to send an invalid Slow Path Input Event")
|
raise InvalidExpectedDataException("try to send an invalid Slow Path Input Event")
|
||||||
|
|
||||||
self.slowPathInputData = messageData
|
self.slowPathInputData = messageData
|
||||||
|
|
||||||
|
class SynchronizeEvent(CompositeType):
|
||||||
|
"""
|
||||||
|
@summary: Synchronize keyboard
|
||||||
|
@see: https://msdn.microsoft.com/en-us/library/cc240588.aspx
|
||||||
|
"""
|
||||||
|
_INPUT_MESSAGE_TYPE_ = InputMessageType.INPUT_EVENT_SYNC
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
CompositeType.__init__(self)
|
||||||
|
self.pad2Octets = UInt16Le()
|
||||||
|
self.toggleFlags = UInt32Le()
|
||||||
|
|
||||||
class PointerEvent(CompositeType):
|
class PointerEvent(CompositeType):
|
||||||
"""
|
"""
|
||||||
@summary: Event use to communicate mouse position
|
@summary: Event use to communicate mouse position
|
||||||
|
|||||||
@@ -332,8 +332,8 @@ class Client(PDULayer):
|
|||||||
generalCapability.osMajorType.value = caps.MajorType.OSMAJORTYPE_WINDOWS
|
generalCapability.osMajorType.value = caps.MajorType.OSMAJORTYPE_WINDOWS
|
||||||
generalCapability.osMinorType.value = caps.MinorType.OSMINORTYPE_WINDOWS_NT
|
generalCapability.osMinorType.value = caps.MinorType.OSMINORTYPE_WINDOWS_NT
|
||||||
generalCapability.extraFlags.value = caps.GeneralExtraFlag.LONG_CREDENTIALS_SUPPORTED | caps.GeneralExtraFlag.NO_BITMAP_COMPRESSION_HDR | caps.GeneralExtraFlag.ENC_SALTED_CHECKSUM
|
generalCapability.extraFlags.value = caps.GeneralExtraFlag.LONG_CREDENTIALS_SUPPORTED | caps.GeneralExtraFlag.NO_BITMAP_COMPRESSION_HDR | caps.GeneralExtraFlag.ENC_SALTED_CHECKSUM
|
||||||
#if not self._fastPathSender is None:
|
if not self._fastPathSender is None:
|
||||||
# generalCapability.extraFlags.value |= caps.GeneralExtraFlag.FASTPATH_OUTPUT_SUPPORTED
|
generalCapability.extraFlags.value |= caps.GeneralExtraFlag.FASTPATH_OUTPUT_SUPPORTED
|
||||||
|
|
||||||
#init bitmap capability
|
#init bitmap capability
|
||||||
bitmapCapability = self._clientCapabilities[caps.CapsType.CAPSTYPE_BITMAP].capability
|
bitmapCapability = self._clientCapabilities[caps.CapsType.CAPSTYPE_BITMAP].capability
|
||||||
|
|||||||
@@ -241,7 +241,6 @@ class RDPClientQt(RDPClientObserver, QAdaptor):
|
|||||||
self._widget = QRemoteDesktop(width, height, self)
|
self._widget = QRemoteDesktop(width, height, self)
|
||||||
#set widget screen to RDP stack
|
#set widget screen to RDP stack
|
||||||
controller.setScreen(width, height)
|
controller.setScreen(width, height)
|
||||||
self._i = 0
|
|
||||||
|
|
||||||
def getWidget(self):
|
def getWidget(self):
|
||||||
"""
|
"""
|
||||||
@@ -305,8 +304,6 @@ class RDPClientQt(RDPClientObserver, QAdaptor):
|
|||||||
@param data: {str} bitmap data
|
@param data: {str} bitmap data
|
||||||
"""
|
"""
|
||||||
image = RDPBitmapToQtImage(width, height, bitsPerPixel, isCompress, data)
|
image = RDPBitmapToQtImage(width, height, bitsPerPixel, isCompress, data)
|
||||||
image.save("/tmp/%s.png"%self._i)
|
|
||||||
self._i += 1
|
|
||||||
#if image need to be cut
|
#if image need to be cut
|
||||||
#For bit alignement server may send more than image pixel
|
#For bit alignement server may send more than image pixel
|
||||||
self._widget.notifyImage(destLeft, destTop, image, destRight - destLeft + 1, destBottom - destTop + 1)
|
self._widget.notifyImage(destLeft, destTop, image, destRight - destLeft + 1, destBottom - destTop + 1)
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -4,7 +4,7 @@ import setuptools
|
|||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
|
|
||||||
setup(name='rdpy',
|
setup(name='rdpy',
|
||||||
version='1.3.1',
|
version='1.3.2',
|
||||||
description='Remote Desktop Protocol in Python',
|
description='Remote Desktop Protocol in Python',
|
||||||
long_description="""
|
long_description="""
|
||||||
RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol (Client and Server side). RDPY is built over the event driven network engine Twisted.
|
RDPY is a pure Python implementation of the Microsoft RDP (Remote Desktop Protocol) protocol (Client and Server side). RDPY is built over the event driven network engine Twisted.
|
||||||
|
|||||||
Reference in New Issue
Block a user