Projects STRLCPY aardwolf Commits 8115bd4f
🤬
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    aardwolf/commons/iosettings.py
    skipped 52 lines
    53 53   
    54 54   # file path of the ducky file (if used)
    55 55   self.ducky_file = None
     56 + # ducky script start delay, None means that typing will not start automatically
     57 + self.ducky_autostart_delay = 5
  • ■ ■ ■ ■ ■ ■
    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
  • ■ ■ ■ ■ ■ ■
    aardwolf/utils/ducky/__init__.py
    skipped 8 lines
    9 9  from aardwolf.keyboard import KeyboardLayout, VK_MODIFIERS
    10 10   
    11 11  class DuckyExecutorBase:
    12  - def __init__(self, keyboard_layout:KeyboardLayout, key_sender):
     12 + def __init__(self, keyboard_layout:KeyboardLayout, key_sender, send_as_char = False):
    13 13   self.keyboard_layout = keyboard_layout
    14 14   self.key_sender = key_sender
     15 + self.send_as_char = send_as_char
    15 16   self.default_delay = 100
    16 17   self.default_chardelay = 50/1000
    17 18   self.aliases = {
    skipped 95 lines
    113 114   await asyncio.sleep(delay)
    114 115   
    115 116   async def do_string(self, data:str):
    116  - print(data)
    117 117   data = ' '.join(data)
    118  - for c in data:
    119  - await self.keydispatch(c)
    120  - #await asyncio.sleep(self.default_delay)
    121  - #print(data)
     118 + if self.send_as_char is True:
     119 + for c in data:
     120 + await self.key_sender(c, True, True)
     121 + await asyncio.sleep(self.default_chardelay)
     122 + else:
     123 + for c in data:
     124 + await self.keydispatch(c)
    122 125   
    123 126   async def do_gui(self, data = []):
    124 127   if len(data) > 0:
    skipped 132 lines
    257 260   await asyncio.sleep(self.default_chardelay)
    258 261   await self.key_sender(code, False)
    259 262  
    260  - async def keydispatch(self, key, modifiers = 0):
    261  - #print(self.keyboard_layout.char_to_sc)
    262  - #print(self.keyboard_layout.sc_to_char)
     263 + async def keydispatch(self, key, modifiers = VK_MODIFIERS(0)):
    263 264   if key in '0123456789':
    264 265   key = 'VK_%s' % key
    265 266   if len(key) == 1:
    266 267   try:
    267 268   scancode, mo = self.keyboard_layout.char_to_scancode(key)
    268  - print('key : %s' % key)
    269  - print('scancode: %s' % scancode)
    270  - print('mo : %s' % mo)
     269 + #print('key : %s' % key)
     270 + #print('scancode: %s' % scancode)
     271 + #print('mo : %s' % mo)
    271 272   
    272 273   except KeyError:
    273 274   # this is bad...
    skipped 133 lines
Please wait...
Page is in error, reload to recover