jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
318 stars 73 forks source link

connection.send/receive calls in open.py do not use timeouts #161

Open linuskr opened 2 years ago

linuskr commented 2 years ago

Since there is no timeout set, these calls wait indefinitely if the server does not respond for some reason.

jborean93 commented 2 years ago

Unfortunately this is somewhat as designed as one of the original purposes of making this library was to create a PSExec like tool in Python. One of the functions of this was to connect to a named pipe and continuously read from the pipe as data was available. This means that the client could be waiting for a long time if there was no output so a timeout didn't make sense. That doesn't mean there couldn't be an explicit timeout argument added to control such a thing. There is also arguably a hackish way to do this today by setting send=False and calling connection.receive(...) with your own timeout but this is pretty hackish.