From 791726d8b539bd0610729bcca8bade4aec5f31cf Mon Sep 17 00:00:00 2001 From: Alexandre Beaulieu Date: Wed, 18 Mar 2020 10:18:06 -0400 Subject: [PATCH] fix: Removed PySide2 dependencies from MITM. --- pyrdp/mitm/BasePathMITM.py | 8 ++++---- pyrdp/mitm/FastPathMITM.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pyrdp/mitm/BasePathMITM.py b/pyrdp/mitm/BasePathMITM.py index 0e7b07512..8f0e20d3e 100644 --- a/pyrdp/mitm/BasePathMITM.py +++ b/pyrdp/mitm/BasePathMITM.py @@ -1,12 +1,12 @@ # # This file is part of the PyRDP project. -# Copyright (C) 2019 GoSecure Inc. +# Copyright (C) 2019-2020 GoSecure Inc. # Licensed under the GPLv3 or later. # from pyrdp.mitm.state import RDPMITMState -from pyrdp.player import keyboard from pyrdp.enum import ScanCode +from pyrdp.enum.scancode import getKeyName from pyrdp.pdu.pdu import PDU from pyrdp.layer.layer import Layer from pyrdp.logging.StatCounter import StatCounter, STAT @@ -32,7 +32,7 @@ def onScanCode(self, scanCode: int, isReleased: bool, isExtended: bool): """ Handle scan code. """ - keyName = keyboard.getKeyName(scanCode, isExtended, self.state.shiftPressed, self.state.capsLockOn) + keyName = getKeyName(scanCode, isExtended, self.state.shiftPressed, self.state.capsLockOn) scanCodeTuple = (scanCode, isExtended) # Left or right shift @@ -60,4 +60,4 @@ def onScanCode(self, scanCode: int, isReleased: bool, isExtended: bool): # Normal input elif len(keyName) == 1: if not isReleased: - self.state.inputBuffer += keyName \ No newline at end of file + self.state.inputBuffer += keyName diff --git a/pyrdp/mitm/FastPathMITM.py b/pyrdp/mitm/FastPathMITM.py index ed8caad61..673cbe950 100644 --- a/pyrdp/mitm/FastPathMITM.py +++ b/pyrdp/mitm/FastPathMITM.py @@ -8,8 +8,7 @@ from pyrdp.logging.StatCounter import StatCounter, STAT from pyrdp.mitm.state import RDPMITMState from pyrdp.pdu import FastPathPDU, FastPathScanCodeEvent -from pyrdp.player import keyboard -from pyrdp.enum import ScanCode +from pyrdp.enum import scancode from pyrdp.mitm.BasePathMITM import BasePathMITM class FastPathMITM(BasePathMITM): @@ -42,7 +41,7 @@ def onClientPDUReceived(self, pdu: FastPathPDU): if not self.state.loggedIn: for event in pdu.events: if isinstance(event, FastPathScanCodeEvent): - self.onScanCode(event.scanCode, event.isReleased, event.rawHeaderByte & keyboard.KBDFLAGS_EXTENDED != 0) + self.onScanCode(event.scanCode, event.isReleased, event.rawHeaderByte & scancode.KBDFLAGS_EXTENDED != 0) def onServerPDUReceived(self, pdu: FastPathPDU): self.statCounter.increment(STAT.IO_OUTPUT_FASTPATH)