Package: wizardwebssh
Wizard Web SSHWeb based ssh clientRequirementswizardwebssh requires Python 3.6 or above.To install Python 3.6, I recommend usingpyenv.# install pyenvgitclonehttps://github.com/pyenv/pyenv~/.pyenv# setup pyenv (you should also put these three lines in .bashrc or similar)exportPATH="${HOME}/.pyenv/bin:${PATH}"exportPYENV_ROOT="${HOME}/.pyenv"eval"$(pyenvinit-)"# install Python 3.6pyenvinstall3.6.12# make it available globallypyenvglobalsystem3.6.12InstallationWithpip:python3.6-mpipinstallwizardwebsshWithpipx:python3.6-mpipinstall--userpipx

pipxinstall--pythonpython3.6wizardwebsshIntroductionA simple web application to be used as an ssh client to connect to your ssh servers. It is written in Python, base on tornado, paramiko and xterm.js.FeaturesSSH password authentication supported, including empty password.SSH public-key authentication supported, including DSA RSA ECDSA Ed25519 keys.SSH Agent SupportSqlite DB support for SSH Config.PyQT5 MultiTabbed Terminal Widget for embedding into PyQT5 apps.Encrypted keys supported.Two-Factor Authentication (time-based one-time password, Duo Push Auth) supported.Fullscreen terminal supported.Terminal window resizable.Auto detect the ssh server's default encoding.Modern browsers including Chrome, Firefox, Safari, Edge, Opera supported.PreviewHow it works+---------+     http     +--------+    ssh    +-----------+
| browser | <==========> | wizardwebssh | <=======> | ssh server|
+---------+   websocket  +--------+    ssh    +-----------+RequirementsPython 2.7/3.4+QuickstartInstall this app, run commandpip install wizardwebsshStart a webserver, run commandwsshOpen your browser, navigate to127.0.0.1:8889Input your data, submit the form.Server options# start a http server with specified listen address and listen portwssh--address='2.2.2.2'--port=8000# start a https server, certfile and keyfile must be passedwssh--certfile='/path/to/cert.crt'--keyfile='/path/to/cert.key'# missing host key policywssh--policy=reject# logging levelwssh--logging=debug# log to filewssh--log-file-prefix=main.log# more optionswssh--helpBrowser console// connect to your ssh serverwssh.connect(hostname,port,username,password,privatekey,passphrase,totp);// pass an object to wssh.connectvaropts={hostname:'hostname',port:'port',username:'username',password:'password',privatekey:'the private key text',passphrase:'passphrase',totp:'totp'};wssh.connect(opts);// without an argument, wssh will use the form data to connectwssh.connect();// set a new encoding for client to usewssh.set_encoding(encoding);// reset encoding to use the default onewssh.reset_encoding();// send a command to the serverwssh.send('ls -l');Custom FontTo use custom font, put your font file in the directorywizardwebssh/static/css/fonts/and restart the server.URL ArgumentsSupport passing arguments by url (query or fragment) like following examples:Passing form data (password must be encoded in base64, privatekey not supported)http://localhost:8889/?hostname=xx&username=yy&password=str_base64_encodedPassing a terminal background colorhttp://localhost:8889/#bgcolor=greenPassing a user defined titlehttp://localhost:8889/?title=my-ssh-serverPassing an encodinghttp://localhost:8889/#encoding=gbkPassing a command executed right after loginhttp://localhost:8889/?command=pwdPassing a terminal typehttp://localhost:8889/?term=xterm-256colorUse Pyqt5 SSH Terminal WidgetStart up the wizardwebssh ssh serviceclass WizardWebssh(object):
    """ Threading example class
    The run() method will be started and it will run in the background
    until the application exits.
    """

    def __init__(self, interval=1):
        """ Constructor
        :type interval: int
        :param interval: Check interval, in seconds
        """
        self.interval = interval

        thread = threading.Thread(target=self.run, args=())
        thread.daemon = True  # Daemonize thread
        thread.start()  # Start the execution

    def run(self):
        """ Method that runs forever """
        while True:
            # Start WebSSH Service in background.
            print('Starting SSH websocket server in the background')
            import asyncio

            asyncio.set_event_loop(asyncio.new_event_loop())
            from wizardwebssh.main import main as wssh
            wssh()
            print('Stopped SSH websocket server in the background')
            QApplication.processEvents()
            time.sleep(self.interval)


    wizardwebssh_service = WizardWebssh()
    time.sleep(.300)Embed the widget as desiredwin = TabbedTerminal()
    win.show()Review tabbedbterminal.py for full standalone working example of SSH terminal widget.Use DockerStart up the appdocker-compose upTear down the appdocker-compose downTestsRequirementspip install pytest pytest-cov codecov flake8 mockUse unittest to run all testspython -m unittest discover testsUse pytest to run all testspython -m pytest testsDeploymentRunning behind an Nginx serverwssh--address='127.0.0.1'--port=8889--policy=reject# Nginx config examplelocation/{proxy_passhttp://127.0.0.1:8889;proxy_http_version1.1;proxy_read_timeout300;proxy_set_headerUpgrade$http_upgrade;proxy_set_headerConnection"upgrade";proxy_set_headerHost$http_host;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Real-PORT$remote_port;}Running as a standalone serverwssh--port=8080--sslport=4433--certfile='cert.crt'--keyfile='cert.key'--xheaders=False--policy=rejectTipsFor whatever deployment choice you choose, don't forget to enable SSL.By default plain http requests from a public network will be either redirected or blocked and being redirected takes precedence over being blocked.Try to use reject policy as the missing host key policy along with your verified known_hosts, this will prevent man-in-the-middle attacks. The idea is that it checks the system host keys file("~/.ssh/known_hosts") and the application host keys file("./known_hosts") in order, if the ssh server's hostname is not found or the key is not matched, the connection will be aborted.