lgandx/Responder

Failed to start with resolvectl error

psyray opened this issue · 4 comments

psyray commented

According to your latest change 44bfd1d

If a system use init.d instead of systemd Responder failed to start.
I think you should check before if resolvectl is installed, and if not, fallback to resolv.conf

For example, Exegol is using init.d instead of systemd

Responder.py --interface "$INTERFACE" -w
                                         __
  .----.-----.-----.-----.-----.-----.--|  |.-----.----.
  |   _|  -__|__ --|  _  |  _  |     |  _  ||  -__|   _|
  |__| |_____|_____|   __|_____|__|__|_____||_____|__|
                   |__|

           NBT-NS, LLMNR & MDNS Responder 3.1.4.0

  To support this project:
  Github -> https://github.com/sponsors/lgandx
  Paypal  -> https://paypal.me/PythonResponder

  Author: Laurent Gaffie (laurent.gaffie@gmail.com)
  To kill this script hit CTRL-C

[+] You don't have an IPv6 address assigned.
Traceback (most recent call last):
  File "/opt/tools/Responder/Responder.py", line 63, in <module>
    settings.Config.populate(options)
  File "/opt/tools/Responder/settings.py", line 338, in populate
    DNS = subprocess.check_output(["resolvectl", "status"])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.7/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.7/lib/python3.11/subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.pyenv/versions/3.11.7/lib/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/root/.pyenv/versions/3.11.7/lib/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'resolvectl'

Commenting the resolvectl line and replacing with resolv.conf works

lgandx commented
psyray commented

The subprocess call should have a specific process to catch error no ?
Maybe this can help (stderr ?)
https://stackoverflow.com/a/35633457

lgandx commented

Solved in 1a2f2fd

Thanks

psyray commented

Tested and working
Thanks 😉