Paramiko : Error reading SSH protocol banner

前端 未结 3 669
滥情空心
滥情空心 2020-12-09 07:04

Recently, I made a code that connect to work station with different usernames (thanks to a private key) based on paramiko.

I never had any issues with it, but today,

3条回答
  •  再見小時候
    2020-12-09 08:03

    When changing the timeout value (as TinBane mentioned) in the transport.py file from 15 to higher the issue resolved partially. that is at line #484:

    self.banner_timeout = 200 # It was 15
    

    However, to resolve it permanently I added a static line to transport.py to declare the new higher value at the _check_banner(self): function.

    Here is specifically the change:

    • It was like this:
    
     def _check_banner(self):
            for i in range(100):
                if i == 0:
                    timeout = self.banner_timeout
                else:
                    timeout = 2
    
    • After the permanent change became like this:
    
     def _check_banner(self):
            for i in range(100):
                if i == 0:
                    timeout = self.banner_timeout
                    timeout = 200 # <<<< Here is the explicit declaration 
                else:
                    timeout = 2
    
    

提交回复
热议问题