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 c0eba0ebb3536413aac1f81415fd71209171e79b
parent bec5b605fb17957779384e428e064a89fa2bdcca
Author: Sheng <webmaster0115@gmail.com>
Date:   Sat,  6 Jul 2019 10:12:28 +0800

Added a new field passphrase

Diffstat:
Mwebssh/handler.py | 8+++++---
Mwebssh/static/js/main.js | 11++++++-----
Mwebssh/templates/index.html | 15++++++++-------
3 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/webssh/handler.py b/webssh/handler.py @@ -310,10 +310,10 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): self.lookup_hostname(hostname, port) username = self.get_value('username') password = self.get_argument('password', u'') + passphrase = self.get_argument('passphrase', u'') privatekey, filename = self.get_privatekey() if privatekey: - pkey = PrivateKey(privatekey, password, filename).get_pkey_obj() - password = None + pkey = PrivateKey(privatekey, passphrase, filename).get_pkey_obj() else: pkey = None args = (hostname, port, username, password, pkey) @@ -336,7 +336,9 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): logging.info('Connecting to {}:{}'.format(*dst_addr)) try: - ssh.connect(*args, timeout=6) + ssh.connect( + *args, timeout=6, allow_agent=False, look_for_keys=False + ) except socket.error: raise ValueError('Unable to connect to {}:{}'.format(*dst_addr)) except paramiko.BadAuthenticationType: diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js @@ -515,9 +515,9 @@ jQuery(function($){ } - function normalize_data(data) { + function clean_data(data) { var i, attr, val; - var attrs = fields.concat('privatekey'); + var attrs = fields.concat(['password', 'privatekey', 'passphrase']); for (i = 0; i < attrs.length; i++) { attr = attrs[i]; @@ -530,7 +530,7 @@ jQuery(function($){ function validate_form_data(data) { - normalize_data(data); + clean_data(data); var hostname = data.get('hostname'), port = data.get('port'), @@ -668,7 +668,7 @@ jQuery(function($){ } - function connect(hostname, port, username, password, privatekey) { + function connect(hostname, port, username, password, privatekey, passphrase) { // for console use var result, opts; @@ -686,7 +686,8 @@ jQuery(function($){ port: port, username: username, password: password, - privatekey: privatekey + privatekey: privatekey, + passphrase: passphrase }; } else { opts = hostname; diff --git a/webssh/templates/index.html b/webssh/templates/index.html @@ -9,7 +9,7 @@ <link href="static/css/fullscreen.min.css" rel="stylesheet" type="text/css"/> <style> .row { - margin-top: 20px; + margin-top: 15px; margin-bottom: 10px; } @@ -18,7 +18,7 @@ } .btn { - margin-top: 10px; + margin-top: 15px; } .btn-danger { @@ -45,17 +45,18 @@ <input class="form-control" type="text" id="username" name="username" value="" required> </div> <div class="col"> - <label for="Username">Private Key</label> - <input class="form-control" type="file" id="privatekey" name="privatekey" value=""> + <label for="Password">Password</label> + <input class="form-control" type="password" name="password" value=""> </div> </div> <div class="row"> <div class="col"> - <label for="Password">Password</label> - <input class="form-control" type="password" name="password" value=""> + <label for="Username">Private Key</label> + <input class="form-control" type="file" id="privatekey" name="privatekey" value=""> </div> <div class="col"> - If Private Key is chosen, password will be used to decrypt the Private Key if it is encrypted, otherwise used as the password of username. + <label for="Passphrase">Passphrase</label> + <input class="form-control" type="password" name="passphrase" value=""> </div> </div> {% module xsrf_form_html() %}