简体   繁体   English

在Google Chrome扩展程序中使用SSH

[英]Using SSH in Google Chrome Extension

I want to write an Extension for the google chrome browser which reads some links from a website and copy these links into a file. 我想为Google chrome浏览器编写一个扩展程序,该扩展程序从网站读取一些链接并将这些链接复制到文件中。 I want to send this file via ssh to another computer in my local network. 我想通过ssh将此文件发送到本地网络中的另一台计算机。

How can I setup and use a ssh connection in my chrome extension? 如何在Chrome扩展程序中设置和使用ssh连接?

Assuming you mean scp, not ssh, here are your options: 假设您的意思是scp,而不是ssh,则可以选择以下几种:

  • Set up a WebSocket proxy. 设置一个WebSocket代理。 Write JavaScript to send the XHR-fetched ArrayBuffer. 编写JavaScript以发送XHR获取的ArrayBuffer。 WebSockets can go over SSL, so you'll probably be satisfied with that rather than implementing SSH in JavaScript (and then scp over that). WebSockets可以使用SSL,因此您可能会对此感到满意,而不是在JavaScript中实现SSH(然后对其进行scp)。
  • Same idea but an HTTP proxy. 相同的想法,但是一个HTTP代理。 This would be pretty painful. 这将是非常痛苦的。 See Web-based SSH for overview. 有关概述,请参见基于Web的SSH
  • Write a Chrome App, thereby getting access to chrome.sockets . 编写一个Chrome应用,从而访问chrome.sockets Implement SSH in JavaScript. 在JavaScript中实现SSH。 See paramikojs to get started. 请参阅paramikojs入门。
  • Chrome App, Native Client. Chrome应用,本机客户端。 This can actually work; 这实际上可以工作; see Secure Shell. 请参阅安全外壳。 Add scp functionality. 添加scp功能。

The Chrome-App-based solutions raise a separate question of how to get the web content. 基于Chrome-App的解决方案提出了有关如何获取网络内容的单独问题。 You might be able to use Chrome Apps webview. 您可能可以使用Chrome Apps Webview。 Or you can message the content between the app and a Chrome Extension. 或者,您可以在应用程序和Chrome扩展程序之间发送内容消息。

There are probably other approaches as well. 可能还有其他方法。 But you get the idea: you have a lot of coding ahead of you. 但是您有个主意:您前面有很多编码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM