NetExec
NetExec copied to clipboard
Exception when scanning responder host using SMB
Describe the bug When doing SMB scan against a host which is running responder SMB server, netexec generates an exception each time.
To Reproduce
Run responder
Command: responder -I eth0
Run netexec against subnet, including a host running responder.
Command: nxc smb 192.168.1.0/24
Resulted in:
Running nxc against 254 targets ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nxc/connection.py", line 166, in __init__
self.proto_flow()
~~~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/nxc/connection.py", line 231, in proto_flow
self.enum_host_info()
~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/nxc/protocols/smb.py", line 261, in enum_host_info
if "Windows 6.1" in self.server_os and self.server_os_build == 0 and self.os_arch == 0:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nxc/netexec.py", line 64, in start_run
future.result()
~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3/dist-packages/nxc/protocols/smb.py", line 170, in __init__
connection.__init__(self, args, db, host)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nxc/connection.py", line 174, in __init__
self.logger.exception(f"Exception while calling proto_flow() on target {target}: {e}")
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1929, in exception
self.log(ERROR, msg, *args, exc_info=exc_info, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1943, in log
msg, kwargs = self.process(msg, kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1887, in process
if self.merge_extra and "extra" in kwargs:
^^^^^^^^^^^^^^^^
AttributeError: 'NXCAdapter' object has no attribute 'merge_extra'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/nxc", line 8, in <module>
sys.exit(main())
~~~~^^
File "/usr/lib/python3/dist-packages/nxc/netexec.py", line 222, in main
asyncio.run(start_run(protocol_object, args, db, targets))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/usr/lib/python3/dist-packages/nxc/netexec.py", line 66, in start_run
nxc_logger.exception(f"Exception for target {targets[futures.index(future)]}: {future.exception()}")
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1929, in exception
self.log(ERROR, msg, *args, exc_info=exc_info, **kwargs)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1943, in log
msg, kwargs = self.process(msg, kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/lib/python3.13/logging/__init__.py", line 1887, in process
if self.merge_extra and "extra" in kwargs:
^^^^^^^^^^^^^^^^
AttributeError: 'NXCAdapter' object has no attribute 'merge_extra'
...
Expected behavior Do not generate an exception error when running SMB scan against host running SMB server using responder.
NetExec info
- OS: Kali
- Version of nxc: 1.3.0
- Installed from: apt
Hi and thanks for the bug report. This has already been fixed since the last release. Until a new release is out you can install NetExec with pipx so you get the latest bug fixes