webssh

Web based ssh client https://github.com/huashengdun/webssh webssh.huashengdun.org/
git clone http://git.hanabi.in/repos/webssh.git
Log | Files | Refs | README | LICENSE

commit 02c56e7a34b8299c2e9df40a4cf6381e5417a112
parent c9913a41084733f08aff754f9e5414299f5fc212
Author: Sheng <psychopathme@gmail.com>
Date:   Fri,  8 Dec 2017 15:43:19 +0800

Generated friendly error message for some exception types

Diffstat:
Mmain.py | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/main.py b/main.py @@ -1,6 +1,7 @@ import io import logging import os.path +import socket import traceback import uuid import weakref @@ -186,7 +187,12 @@ class IndexHandler(tornado.web.RequestHandler): args = self.get_args() dst_addr = '{}:{}'.format(*args[:2]) logging.info('Connecting to {}'.format(dst_addr)) - ssh.connect(*args) + try: + ssh.connect(*args, timeout=6) + except socket.error: + raise ValueError('Unable to connect to {}'.format(dst_addr)) + except paramiko.BadAuthenticationType: + raise ValueError('Authentication failed.') chan = ssh.invoke_shell(term='xterm') chan.setblocking(0) worker = Worker(ssh, chan, dst_addr)