■ ■ ■ ■ ■ ■
aardwolf/examples/aardpclient.py
| skipped 9 lines |
10 | 10 | | from aardwolf.commons.url import RDPConnectionURL |
11 | 11 | | from aardwolf.commons.iosettings import RDPIOSettings |
12 | 12 | | from aardwolf.commons.queuedata import RDPDATATYPE |
13 | | - | from aardwolf.commons.queuedata.keyboard import RDP_KEYBOARD_SCANCODE |
| 13 | + | from aardwolf.commons.queuedata.keyboard import RDP_KEYBOARD_SCANCODE, RDP_KEYBOARD_UNICODE |
14 | 14 | | from aardwolf.commons.queuedata.mouse import RDP_MOUSE |
15 | 15 | | from aardwolf.extensions.RDPECLIP.protocol.formatlist import CLIPBRD_FORMAT |
16 | 16 | | from aardwolf.commons.queuedata.clipboard import RDP_CLIPBOARD_DATA_TXT |
17 | 17 | | from aardwolf.commons.queuedata.constants import MOUSEBUTTON, VIDEO_FORMAT |
| 18 | + | from aardwolf.commons.target import RDPConnectionDialect |
18 | 19 | | |
19 | 20 | | from PyQt5.QtWidgets import QApplication, QMainWindow, qApp, QLabel |
20 | 21 | | from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QThread, Qt |
| skipped 26 lines |
47 | 48 | | |
48 | 49 | | def __init__(self, parent=None, **kwargs): |
49 | 50 | | super().__init__(parent, **kwargs) |
50 | | - | self.settings = None |
| 51 | + | self.settings:RDPClientConsoleSettings = None |
51 | 52 | | self.conn = None |
52 | 53 | | self.input_evt = None |
53 | 54 | | self.in_q = None |
| skipped 17 lines |
71 | 72 | | async def ducky_keyboard_sender(self, scancode, is_pressed, as_char = False): |
72 | 73 | | ### Callback function for the duckyexecutor to dispatch scancodes/characters to the remote end |
73 | 74 | | try: |
74 | | - | print('SCANCODE: %s' % scancode) |
75 | | - | print('is_pressed: %s' % is_pressed) |
76 | | - | print('as_char: %s' % as_char) |
| 75 | + | #print('SCANCODE: %s' % scancode) |
| 76 | + | #print('is_pressed: %s' % is_pressed) |
| 77 | + | #print('as_char: %s' % as_char) |
77 | 78 | | if as_char is False: |
78 | 79 | | ki = RDP_KEYBOARD_SCANCODE() |
79 | 80 | | ki.keyCode = scancode |
80 | 81 | | ki.is_pressed = is_pressed |
81 | | - | ki.modifiers = [] |
| 82 | + | ki.modifiers = VK_MODIFIERS(0) |
| 83 | + | await self.conn.ext_in_queue.put(ki) |
| 84 | + | else: |
| 85 | + | ki = RDP_KEYBOARD_UNICODE() |
| 86 | + | ki.char = scancode |
| 87 | + | ki.is_pressed = is_pressed |
82 | 88 | | await self.conn.ext_in_queue.put(ki) |
83 | | - | await asyncio.sleep(0.5) |
84 | 89 | | except Exception as e: |
85 | 90 | | traceback.print_exc() |
86 | 91 | | |
87 | 92 | | async def ducky_exec(self): |
88 | 93 | | try: |
89 | | - | await asyncio.sleep(5) |
90 | 94 | | from aardwolf.keyboard.layoutmanager import KeyboardLayoutManager |
91 | 95 | | from aardwolf.utils.ducky import DuckyExecutorBase, DuckyReaderFile |
| 96 | + | if self.settings.iosettings.ducky_autostart_delay is not None: |
| 97 | + | await asyncio.sleep(self.settings.iosettings.ducky_autostart_delay) |
| 98 | + | |
92 | 99 | | layout = KeyboardLayoutManager().get_layout_by_shortname('enus') |
93 | | - | executor = DuckyExecutorBase(layout, self.ducky_keyboard_sender) |
| 100 | + | executor = DuckyExecutorBase(layout, self.ducky_keyboard_sender, send_as_char = True if self.conn.target.dialect == RDPConnectionDialect.VNC else False) |
94 | 101 | | reader = DuckyReaderFile.from_file(self.settings.iosettings.ducky_file, executor) |
95 | 102 | | await reader.parse() |
96 | 103 | | except Exception as e: |
| skipped 88 lines |
185 | 192 | | self.is_rdp = True if settings.url.lower().startswith('rdp') is True else False |
186 | 193 | | |
187 | 194 | | # setting up the main window with the requested resolution |
188 | | - | self.setGeometry(0,0, self.settings.iosettings.video_width, self.settings.iosettings.video_height) |
| 195 | + | self.setGeometry(0, 0, self.settings.iosettings.video_width, self.settings.iosettings.video_height) |
189 | 196 | | # this buffer will hold the current frame and will be contantly updated |
190 | 197 | | # as new rectangle info comes in from the server |
191 | 198 | | self._buffer = QImage(self.settings.iosettings.video_width, self.settings.iosettings.video_height, QImage.Format_RGB32) |
| skipped 219 lines |
411 | 418 | | iosettings.video_bpp_max = args.bpp |
412 | 419 | | iosettings.video_out_format = VIDEO_FORMAT.QT5 |
413 | 420 | | iosettings.ducky_file = args.ducky |
| 421 | + | iosettings.ducky_autostart_delay = 5 |
414 | 422 | | |
415 | 423 | | settings = RDPClientConsoleSettings(args.url, iosettings) |
416 | 424 | | settings.mhover = args.no_mouse_hover |
| skipped 11 lines |