Skip to content

Commit

Permalink
fix: Removed PySide2 dependencies from MITM.
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbl committed Mar 18, 2020
1 parent 7a4ea16 commit 791726d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions pyrdp/mitm/BasePathMITM.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
self.state.inputBuffer += keyName
5 changes: 2 additions & 3 deletions pyrdp/mitm/FastPathMITM.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 791726d

Please sign in to comment.