Open bert128 opened 1 month ago
impacket version: v0.12.0.dev1 Python version: 3.11.9 Target OS: Linux
impacket-smbserver -debug -ip :: tmp /tmp
# impacket-smbserver -debug -ip :: tmp /tmp Impacket v0.12.0.dev1 - Copyright 2023 Fortra [+] Impacket Library Installation Path: /usr/lib/python3/dist-packages/impacket Traceback (most recent call last): File "/usr/share/doc/python3-impacket/examples/smbserver.py", line 71, in <module> server = smbserver.SimpleSMBServer(listenAddress=options.interface_address, listenPort=int(options.port)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/impacket/smbserver.py", line 4891, in __init__ self.__server = SMBSERVER((listenAddress, listenPort), config_parser=self.__smbConfig) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/impacket/smbserver.py", line 3986, in __init__ socketserver.TCPServer.__init__(self, server_address, handler_class) File "/usr/lib/python3.11/socketserver.py", line 456, in __init__ self.server_bind() File "/usr/lib/python3.11/socketserver.py", line 472, in server_bind self.socket.bind(self.server_address) socket.gaierror: [Errno -9] Address family for hostname not supported
In socketserver.py line 439 we have an explicit bind to a legacy socket:
address_family = socket.AF_INET
changing this to AF_INET6 is enough to make it support explicit bindings to ipv6 addresses.
It also by default only tries to bind to the legacy any address in examples/smbserver.py line 43:
parser.add_argument('-ip', '--interface-address', action='store', default='0.0.0.0', help='ip address of listening interface')
Changing the default to :: fixes it.
linked with #1811
Configuration
impacket version: v0.12.0.dev1 Python version: 3.11.9 Target OS: Linux
Debug Output With Command String
impacket-smbserver -debug -ip :: tmp /tmp
Additional context
In socketserver.py line 439 we have an explicit bind to a legacy socket:
address_family = socket.AF_INET
changing this to AF_INET6 is enough to make it support explicit bindings to ipv6 addresses.
It also by default only tries to bind to the legacy any address in examples/smbserver.py line 43:
parser.add_argument('-ip', '--interface-address', action='store', default='0.0.0.0', help='ip address of listening interface')
Changing the default to :: fixes it.