#ssh.py def get_host_fingerprint(self, settings): """ Returns a the hash of the given host's public key by making a remote connection to the server (not just by looking at known_hosts). """ out_dict = {} if'port'notin settings: port = 22 else: port = settings['port'] if'host'notin settings: out_dict['result'] = _("Error: You must supply a 'host'.") message = {'terminal:sshjs_display_fingerprint': out_dict} self.write_message(message) else: host = settings['host'] self.ssh_log.debug( "get_host_fingerprint(%s:%s)" % (host, port), metadata={'host': host, 'port': port}) out_dict.update({ 'result': 'Success', 'host': host, 'fingerprint': None }) ssh = which('ssh') command = "%s -p %s -oUserKnownHostsFile=none -F. %s" % (ssh, port, host) m = self.new_multiplex( command, 'get_host_key', logging=False) # Logging is false so we don't make tons of silly logs
#ssh.js ..... var document = window.document, // Have to do this because we're sandboxed go = GateOne, prefix = go.prefs.prefix, u = go.Utils, v = go.Visual, E = go.Events, t = go.Terminal, gettext = go.i18n.gettext, urlObj = (window.URL || window.webkitURL), logFatal = GateOne.Logging.logFatal, logError = GateOne.Logging.logError, logWarning = GateOne.Logging.logWarning, logInfo = GateOne.Logging.logInfo, logDebug = GateOne.Logging.logDebug; .......
handleConnect: function(connectString) { /**:GateOne.SSH.handleConnect(connectString) Handles the `terminal:sshjs_connect` WebSocket action which should provide an SSH *connectString* in the form of 'user@host:port'. The *connectString* will be stored in `GateOne.Terminal.terminals[term]['sshConnectString']` which is meant to be used in duplicating terminals (because you can't rely on the title). Also requests the host's public SSH key so it can be displayed to the user. */ logDebug('sshjs_connect: ' + connectString); var host = connectString.split('@')[1].split(':')[0], port = connectString.split('@')[1].split(':')[1], message = {'host': host, 'port': port}, term = localStorage[prefix+'selectedTerminal']; t.terminals[term]['sshConnectString'] = connectString; go.ws.send(JSON.stringify({'terminal:ssh_get_host_fingerprint': message})); }