jborean93 / pypsexec

Remote Windows execution like PsExec on Python
MIT License
113 stars 38 forks source link

connection.receive(request) NEVER TIMES OUT #12

Open pacmanoth opened 5 years ago

pacmanoth commented 5 years ago

When calling into connection.py->receive() method, the timeout=# parameter is never sent. Hence, the receive() may hang indefinitely.

scmr.py, _invoke() method, line 673 should either send a hard-coded timeout value, or allow the caller to specify one. resp = self.tree.session.connection.receive(request, timeout=####)

Any chance you can fix this quickly?

pacmanoth commented 5 years ago

Hi, just wondering if you've been able to make any headway with this one?

jborean93 commented 5 years ago

I haven't looked into it personally, eventually I will get there but I have a few things on my plate. Feel free to open a PR in smbprotocol to fix this and force me to actually review it.

pacmanoth commented 5 years ago

I provided a sample fix in the original report. This one is super easy to fix.

Peter

On Thu, Jul 18, 2019 at 7:20 PM Jordan Borean notifications@github.com wrote:

I haven't looked into it personally, eventually I will get there but I have a few things on my plate. Feel free to open a PR in smbprotocol to fix this and force me to actually review it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jborean93/pypsexec/issues/12?email_source=notifications&email_token=AKHD2CCMXKWWKBKEQNHTST3QAEJFBA5CNFSM4HPLLMBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2KI5DI#issuecomment-513052301, or mute the thread https://github.com/notifications/unsubscribe-auth/AKHD2CH6QO6NLMOODEX2EMDQAEJFBANCNFSM4HPLLMBA .

jborean93 commented 5 years ago

Hi, I'm just coming around to investigating this issue, it's true there is no timeout on the receive call but I'm trying to see why it would be needed. I found an issue with the timeout not being honoured on the initial connection in smbprotocol and that has been fixed with https://github.com/jborean93/smbprotocol/pull/9.

This is not the only place where we call .receive() and I can't see any other location where we set an explicit timeout. Could your issue be related to that PR I linked above?