NetExec
NetExec copied to clipboard
Bug when using RDP, VNC protocol
Describe the bug I using netexec connect RDP from WSL2 to my Windows machine. But it show message bellow.
To Reproduce
Command: nxc --debug --verbose rdp 172.20.16.1
Resulted in:
$ nxc --debug --verbose rdp 172.20.16.1
[10:24:17] ERROR Exception for target 172.20.16.1: There is no current event loop in thread 'ThreadPoolExecutor-0_0'. netexec.py:66
╭──────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /home/wsl/.local/pipx/venvs/netexec/lib/python3.8/site-packages/nxc/netexec.py:64 in start_run │
│ │
│ 61 │ │ │ │ progress.update(tasks, completed=current) │
│ 62 │ for future in as_completed(futures): │
│ 63 │ │ try: │
│ ❱ 64 │ │ │ future.result() │
│ 65 │ │ except Exception: │
│ 66 │ │ │ nxc_logger.exception(f"Exception for target │
│ {targets[futures.index(future)]}: {future.exception()}") │
│ 67 │
│ │
│ /usr/lib/python3.8/concurrent/futures/_base.py:432 in result │
│ │
│ 429 │ │ │ if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]: │
│ 430 │ │ │ │ raise CancelledError() │
│ 431 │ │ │ elif self._state == FINISHED: │
│ ❱ 432 │ │ │ │ return self.__get_result() │
│ 433 │ │ │ │
│ 434 │ │ │ self._condition.wait(timeout) │
│ 435 │
│ │
│ /usr/lib/python3.8/concurrent/futures/_base.py:388 in __get_result │
│ │
│ 385 │ │
│ 386 │ def __get_result(self): │
│ 387 │ │ if self._exception: │
│ ❱ 388 │ │ │ raise self._exception │
│ 389 │ │ else: │
│ 390 │ │ │ return self._result │
│ 391 │
│ │
│ /usr/lib/python3.8/concurrent/futures/thread.py:57 in run │
│ │
│ 54 │ │ │ return │
│ 55 │ │ │
│ 56 │ │ try: │
│ ❱ 57 │ │ │ result = self.fn(*self.args, **self.kwargs) │
│ 58 │ │ except BaseException as exc: │
│ 59 │ │ │ self.future.set_exception(exc) │
│ 60 │ │ │ # Break a reference cycle with the exception 'exc' │
│ │
│ /home/wsl/.local/pipx/venvs/netexec/lib/python3.8/site-packages/nxc/protocols/rdp.py:30 in __init__ │
│ │
│ 27 │ def __init__(self, args, db, host): │
│ 28 │ │ self.domain = None │
│ 29 │ │ self.server_os = None │
│ ❱ 30 │ │ self.iosettings = RDPIOSettings() │
│ 31 │ │ self.iosettings.channels = [] │
│ 32 │ │ self.iosettings.video_out_format = VIDEO_FORMAT.RAW │
│ 33 │ │ self.iosettings.clipboard_use_pyperclip = False │
│ │
│ /home/wsl/.local/pipx/venvs/netexec/lib/python3.8/site-packages/aardwolf/commons/iosettings.py:17 in __init__ │
│ │
│ 14 │ │ # Which channels should be enabled │
│ 15 │ │ self.channels = [RDPECLIPChannel, RDPEDYCChannel] │
│ 16 │ │ self.vchannels = { │
│ ❱ 17 │ │ │ 'ECHO' : VchannelECHO(), │
│ 18 │ │ │ #'DATATEST1' : VchannelTEST(), │
│ 19 │ │ } │
│ 20 │ │ # Authentication protocols supported │
│ │
│ /home/wsl/.local/pipx/venvs/netexec/lib/python3.8/site-packages/aardwolf/extensions/RDPEDYC/vchannels/echo/__init__.py:7 in __init__ │
│ │
│ 4 │
│ 5 class VchannelECHO(VirtualChannelBase): │
│ 6 │ def __init__(self): │
│ ❱ 7 │ │ VirtualChannelBase.__init__(self, 'ECHO') │
│ 8 │ │
│ 9 │ async def channel_init(self): │
│ 10 │ │ #print('ECHO channel started!') │
│ │
│ /home/wsl/.local/pipx/venvs/netexec/lib/python3.8/site-packages/aardwolf/extensions/RDPEDYC/vchannels/__init__.py:10 in __init__ │
│ │
│ 7 │ def __init__(self, name:str, buffered = True): │
│ 8 │ │ self.channel_name:str = name │
│ 9 │ │ self.channel_id:int = None │
│ ❱ 10 │ │ self.channel_closed_evt:asyncio.Event = asyncio.Event() │
│ 11 │ │ self.__channel_data_buffered = buffered │
│ 12 │ │ self.__virtual_channel_manager = None │
│ 13 │ │ self.__fragment_buffer:bytes = b'' │
│ │
│ /usr/lib/python3.8/asyncio/locks.py:260 in __init__ │
│ │
│ 257 │ │ self._waiters = collections.deque() │
│ 258 │ │ self._value = False │
│ 259 │ │ if loop is None: │
│ ❱ 260 │ │ │ self._loop = events.get_event_loop() │
│ 261 │ │ else: │
│ 262 │ │ │ self._loop = loop │
│ 263 │ │ │ warnings.warn("The loop argument is deprecated since Python 3.8, " │
│ │
│ /usr/lib/python3.8/asyncio/events.py:639 in get_event_loop │
│ │
│ 636 │ │ │ self.set_event_loop(self.new_event_loop()) │
│ 637 │ │ │
│ 638 │ │ if self._local._loop is None: │
│ ❱ 639 │ │ │ raise RuntimeError('There is no current event loop in thread %r.' │
│ 640 │ │ │ │ │ │ │ % threading.current_thread().name) │
│ 641 │ │ │
│ 642 │ │ return self._local._loop │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor-0_0'.
...
Screenshots
NetExec info
- OS: Ubuntu 20.04.1 LTS
- Version of nxc: 1.2.0
- Installed from: pipx install git+https://github.com/Pennyw0rth/NetExec
This might be an issue with your python version and asyncio in py3.8. Do you have the option to use a more recent version of python? Maybe pyenv would be a good solution.
There was an issue in the past with rdp, asyncio and python so it might be related: https://github.com/Pennyw0rth/NetExec/issues/73