You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Connecting to a host, disconnecting from said host, then reconnecting fails with the below error:
Traceback (mostrecentcalllast):
File"/root/windows/reboot_test.py", line31, in<module>c.connect()
File"/usr/local/lib/python3.10/dist-packages/pypsexec/client.py", line103, inconnectself.connection.connect(timeout=timeout)
File"/usr/local/lib/python3.10/dist-packages/smbprotocol/connection.py", line799, inconnectsmb_response=self._send_smb2_negotiate(dialect, timeout, enc_algos, sign_algos)
File"/usr/local/lib/python3.10/dist-packages/smbprotocol/connection.py", line1497, in_send_smb2_negotiateresponse=self.receive(request, timeout=timeout)
File"/usr/local/lib/python3.10/dist-packages/smbprotocol/connection.py", line931, inreceiveself._check_worker_running() # The worker may have failed while waiting for the response, check againFile"/usr/local/lib/python3.10/dist-packages/smbprotocol/connection.py", line1082, in_check_worker_runningraiseSMBConnectionClosed('SMB socket was closed, cannot send or receive any more data')
smbprotocol.exceptions.SMBConnectionClosed: SMBsocketwasclosed, cannotsendorreceiveanymoredata
Here is a trivial script to reproduce this error:
c=Client("IPHERE", username="Administrator", password="PASSWORDHERE")
c.connect()
try:
# these three functions succeedc.create_service()
c.remove_service()
c.disconnect()
# not necessary for reproductiontime.sleep(1)
# this fails with the above errorc.connect()
# this code is never executedc.create_service()
This appears to be a bug since if I reinitialize the client object after the first disconnect call, everything works fine:
c=Client("IPHERE", username="Administrator", password="PASSWORDHERE")
c.connect()
try:
# these three functions succeedc.create_service()
c.remove_service()
c.disconnect()
# not necessary for reproductiontime.sleep(1)
# added this line, which makes everything workc=Client("IPHERE", username="Administrator", password="PASSWORDHERE")
# this now succeedsc.connect()
c.create_service()
Host OS: Ubuntu 22.04 LTS, installed via pip as specified in the README
Target OS: I've tested this on Windows Server 2008 R2, Windows 7, Windows 10, Windows Server 2016, and Windows 11 and it occurred on all of them.
Based off the error message and the code, it appears that the worker is failing while waiting for a response form the client. I haven't had time to more extensively debug this, but destroying the thread on disconnect and then recreating the thread on connect may work to solve this.
The text was updated successfully, but these errors were encountered:
Connecting to a host, disconnecting from said host, then reconnecting fails with the below error:
Here is a trivial script to reproduce this error:
This appears to be a bug since if I reinitialize the client object after the first disconnect call, everything works fine:
Host OS: Ubuntu 22.04 LTS, installed via pip as specified in the README
Target OS: I've tested this on Windows Server 2008 R2, Windows 7, Windows 10, Windows Server 2016, and Windows 11 and it occurred on all of them.
Based off the error message and the code, it appears that the worker is failing while waiting for a response form the client. I haven't had time to more extensively debug this, but destroying the thread on disconnect and then recreating the thread on connect may work to solve this.
The text was updated successfully, but these errors were encountered: