是否可以连接使用JavaScript通过SSH? [英] Is it possible to connect to SSH using JavaScript?

查看:1064
本文介绍了是否可以连接使用JavaScript通过SSH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有使用的WebSockets(http://novnc.com)VNC的实现,但是,仍然需要一台服务器。我期待创建一个简单的客户端JavaScript只(不闪光)连接到端口上运行SSH。我猜的WebSockets是去,因为它的TCP的唯一途径。例如任何code?任何其他方式?

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 (no Flash) connection to a port running SSH. I am guessing WebSockets is the only way to go since it does TCP. Any example code? Any other way?

推荐答案

对不起,鉴于你的约束(客户端只有JavaScript),是没有办法连接到一个普通的老SSH服务器。

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

的WebSockets不是普通的TCP。这是一个框架协议,在客户端和服务器,包括原产地政策之间的HTTP的握手。

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可以做出简单的TCP连接,但它也有原产地政策执行。它这样做的方式是通过端口843到同一台服务器的连接,并要求包含同源策略一个特殊的XML文件。
如果你愿意放松限制略微这样你愿意到一个服务器(任何服务器)或客户端,那么你可以做你想要做的运行一个通用的WebSockets到TCP代理。 noVNC包括一个C和Python的WebSockets到TCP代理:<一href=\"http://github.com/kanaka/noVNC/tree/master/utils/\">http://github.com/kanaka/noVNC/tree/master/utils/.

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:


  • 目前的WebSocket草案:<一href=\"http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76\">http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76

中运行的Flash策略服务器(Linux / UNIX的用socat)这里描述的简单的(不安全)的方式:<一href=\"http://github.com/kanaka/noVNC/blob/master/docs/flash_policy.txt\">http://github.com/kanaka/noVNC/blob/master/docs/flash_policy.txt

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

更​​多信息:<一href=\"http://$c$c.google.com/p/doctype/wiki/ArticleFlashSecurity\">http://$c$c.google.com/p/doctype/wiki/ArticleFlashSecurity

这篇关于是否可以连接使用JavaScript通过SSH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆