Is it possible to connect to SSH using JavaScript?

后端 未结 4 936
自闭症患者
自闭症患者 2020-12-28 15:15

I know there is an implementation of VNC using WebSockets (http://novnc.com) but that still requires a server. I am looking to create a simple client-side JavaScript only (n

4条回答
  •  囚心锁ツ
    2020-12-28 16:07

    Sorry, given your constraints (client-side Javascript only), there is no way to connect to a plain old SSH server.

    WebSockets is not plain TCP. It's a framed protocol with a HTTP-like handshake between the client and server that includes origin policy.

    Flash can make plain TCP connections, but it also has origin policy enforcement. The way it does this is by making a connection to the same server on port 843 and asking for a special XML file that contains the origin policy. If you are willing to relax your constraints slightly such that you are willing to run a generic WebSockets to TCP proxy either on a server (any server) or on the client then you can do what you are wanting to do. noVNC includes a C and python WebSockets to TCP proxy: http://github.com/kanaka/noVNC/tree/master/utils/.

    Other info you might find useful:

    • Current WebSocket draft: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76

    • Simple (insecure) way of running a flash policy server (Linux/UNIX with socat) is described here: http://github.com/kanaka/noVNC/blob/master/docs/flash_policy.txt

    • More info about the flash policy file: http://code.google.com/p/doctype/wiki/ArticleFlashSecurity

提交回复
热议问题