commit dc0b48ce9aa5e047f9d0c7aaca0eebdf8a88b008
parent 650382ad568824035b2721430228ea656b6e175d
Author: Sheng <webmaster0115@gmail.com>
Date: Thu, 15 Mar 2018 06:50:46 +0800
Enhancement
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/main.py b/main.py
@@ -200,7 +200,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
if isinstance(self.settings['policy'], paramiko.client.AutoAddPolicy):
ssh.load_host_keys(self.settings['host_file'])
else:
- ssh._host_keys = self.settings.get('host_keys')
+ ssh._host_keys = self.settings['host_keys']
ssh.set_missing_host_key_policy(self.settings['policy'])
args = self.get_args()
dst_addr = (args[0], args[1])
@@ -253,7 +253,7 @@ class WsockHandler(MixinHandler, tornado.websocket.WebSocketHandler):
def open(self):
self.src_addr = self.get_client_addr()
logging.info('Connected from {}:{}'.format(*self.src_addr))
- worker = workers.get(self.get_argument('id'), None)
+ worker = workers.get(self.get_argument('id'))
if worker and worker.src_addr[0] == self.src_addr[0]:
workers.pop(worker.id)
self.set_nodelay(True)
@@ -304,8 +304,8 @@ def get_policy_class(policy):
if not policy.endswith('policy'):
policy += 'policy'
- dic = {k.lower(): v for k, v in vars(paramiko.client).items()}
-
+ dic = {k.lower(): v for k, v in vars(paramiko.client).items() if type(v)
+ is type and issubclass(v, paramiko.client.MissingHostKeyPolicy)}
try:
cls = dic[policy]
except KeyError: