Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3.13 error: impacket.nmb.NetBIOSTimeout: The NETBIOS connection with the remote host timed out. #1824

Open
eamanu opened this issue Oct 5, 2024 · 2 comments
Assignees
Labels
in review This issue or pull request is being analyzed

Comments

@eamanu
Copy link
Contributor

eamanu commented Oct 5, 2024

Configuration

impacket version: HEAD
Python version:
Target OS: Debian sid

During the test execution we have this kind of errors:

 SimpleSMBServerFuncTests.test_smbserver_connect_disconnect_tree ________________________________________________________________________________________________________

self = <impacket.nmb.NetBIOSTCPSession object at 0x7f9149e7b0e0>, read_length = 4, timeout = 60

    def non_polling_read(self, read_length, timeout):
        data = b''
        if timeout is None:
            timeout = 3600
    
        start_time = time.time()
        bytes_left = read_length
    
        while bytes_left > 0:
            self._sock.settimeout(timeout)
            try:
>               received = self._sock.recv(bytes_left)
E               TimeoutError: timed out

impacket/nmb.py:986: TimeoutError

During handling of the above exception, another exception occurred:

self = <tests.SMB_RPC.test_smbserver.SimpleSMBServerFuncTests testMethod=test_smbserver_connect_disconnect_tree>

    def test_smbserver_connect_disconnect_tree(self):
        """Test connecting/disconnecting to a share tree.
        """
        server = self.get_smbserver()
        self.start_smbserver(server)
    
>       client = self.get_smbclient()

tests/SMB_RPC/test_smbserver.py:327: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/SMB_RPC/test_smbserver.py:227: in get_smbclient
    smbclient = SMBConnection(self.address, self.address, sess_port=int(self.port),
impacket/smbconnection.py:82: in __init__
    self.negotiateSession(preferredDialect)
impacket/smbconnection.py:122: in negotiateSession
    packet = self.negotiateSessionWildcard(self._myName, self._remoteName, self._remoteHost, self._sess_port,
impacket/smbconnection.py:182: in negotiateSessionWildcard
    resp = self._nmbSession.recv_packet(timeout)
impacket/nmb.py:917: in recv_packet
    data = self.__read(timeout)
impacket/nmb.py:1004: in __read
    data = self.read_function(4, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <impacket.nmb.NetBIOSTCPSession object at 0x7f9149e7b0e0>, read_length = 4, timeout = 60

    def non_polling_read(self, read_length, timeout):
        data = b''
        if timeout is None:
            timeout = 3600
    
        start_time = time.time()
        bytes_left = read_length
    
        while bytes_left > 0:
            self._sock.settimeout(timeout)
            try:
                received = self._sock.recv(bytes_left)
            except socket.timeout:
>               raise NetBIOSTimeout
E               impacket.nmb.NetBIOSTimeout: The NETBIOS connection with the remote host timed out.

impacket/nmb.py:988: NetBIOSTimeout
----------------------------------------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------------------------------------
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.13/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/eamanu/Debian/impacket/upstream/impacket/impacket/smbserver.py", line 4909, in start
    self.__srvsServer.start()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/threading.py", line 973, in start
    _start_joinable_thread(self._bootstrap, handle=self._handle,
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                           daemon=self.daemon)
                           ^^^^^^^^^^^^^^^^^^^
RuntimeError: thread already started
=========================================================================================================================== short test summary info ============================================================================================================================
FAILED tests/SMB_RPC/test_smbserver.py::SimpleSMBServerFuncTests::test_smbserver_connect_disconnect_tree - impacket.nmb.NetBIOSTimeout: The NETBIOS connection with the remote host timed out.

To reproduce it I run:

tox -e py3.13 -- tests/SMB_RPC/test_smbserver.py

I tried to figure out the issue but I couldn't.

Original reported here [0]

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082142

@eamanu eamanu changed the title impacket.nmb.NetBIOSTimeout: The NETBIOS connection with the remote host timed out. Python3.13 error: impacket.nmb.NetBIOSTimeout: The NETBIOS connection with the remote host timed out. Oct 5, 2024
@anadrianmanrique anadrianmanrique added the in review This issue or pull request is being analyzed label Oct 10, 2024
@anadrianmanrique anadrianmanrique self-assigned this Oct 10, 2024
@anadrianmanrique
Copy link
Contributor

Hello, thanks for reporting! We are not supporting offically 3.13 at the moment. Anyway, we plan to do it in the short term, so this report it's useful. We will keep you updated as soon as we can get more details about the issue. Thanks!

@eamanu
Copy link
Contributor Author

eamanu commented Nov 16, 2024

Hi @anadrianmanrique,

Thanks for the response. I will patch out these tests to avoid break the Py3.13 transition.

I will keep my eyes here to avoid ignore this issue.

cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review This issue or pull request is being analyzed
Projects
None yet
Development

No branches or pull requests

2 participants