从浏览器打开PuTTY客户端的HTML代码 [英] HTML code to open PuTTY client from browser

查看:871
本文介绍了从浏览器打开PuTTY客户端的HTML代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个网页,其中包含我们团队以表格形式管理的整个服务器清单。我使用简单的LAMP堆栈和库存输入作为CSV文件。

该表有三列:主机名,IP地址和设备序列号。



虽然这个工作非常好,但我想更进一步,让表中的每个IP地址成为一个超链接,点击它将打开一个SSH客户端,它将连接到该IP地址。任何暗示如何做到这一点?我希望会有类似于 mailto:标记的东西,它打开了一个电子邮件客户端(Outlook窗口)。

解决方案

我已经完成了信息



如果原始页面丢失,以供日后参考,请按以下步骤操作:


  1. 您不能直接将ssh://方案映射到PuTTY,但可以将其映射到中间脚本,并转而使用正确的参数来使用PuTTY。我的名字叫做putty_ssh.bat,它有以下内容:


      @echo off 
    set var =%1
    set extract =%var:〜6,-1%
    C:\程序文件(x86)\ PuTTY \putty.exe%extract%



  2. 脚本必须在注册表中注册。你可以用下面的内容创建一个ssh.reg文件并打开它(根据需要定制最后一行):


      REGEDIT4 
    [HKEY_CLASSES_ROOT \ssh]
    @ =URL:ssh Protocol
    URL Protocol=
    [HKEY_CLASSES_ROOT \ssh\ shell]
    [HKEY_CLASSES_ROOT \ssh\shell\open]
    [HKEY_CLASSES_ROOT\ssh\shell\open\命令]
    @ =\C:\\ \\路径\\\\\\\\\\\\\\\\\\\\\\\\\\\\' li>

当我点击网页中的ssh://链接时,它现在会打开PuTTY。


I am trying to make a webpage which will have the entire inventory of servers that our team manages in the form of a table. I am using a simple LAMP stack and the inventory input as a CSV file.

The table has three columns: Hostname, IP address and device serial number.

While this works perfectly fine, I want to take this a step further and make every IP address in the table a hyperlink, clicking which will open an SSH client, which will connect to that IP address. Any cues to how this can be done? I was hoping there would be something like the the mailto: tag which opens an email client (Outlook window).

解决方案

I've done it following the info of this blog post.

For future reference in case the original page becomes missing, here is the process:

  1. you cannot directly map the ssh:// scheme to PuTTY, but you can map it to an intermediary script which will in turn lanch PuTTY with the right arguments. Mine is called putty_ssh.bat and has the following content:

    @echo off
    set var=%1
    set extract=%var:~6,-1%
    "C:\Program Files (x86)\PuTTY\putty.exe" %extract%
    

  2. the script has to be registered in the registry. You can just create a ssh.reg file with the following content and open it (customizing last line as needed):

    REGEDIT4
    [HKEY_CLASSES_ROOT\ssh]
    @="URL:ssh Protocol"
    "URL Protocol"=""
    [HKEY_CLASSES_ROOT\ssh\shell]
    [HKEY_CLASSES_ROOT\ssh\shell\open]
    [HKEY_CLASSES_ROOT\ssh\shell\open\command]
    @="\"C:\\path\\to\\putty_ssh.bat\" %1"
    

When I click on ssh:// links in web pages, it now opens PuTTY.

这篇关于从浏览器打开PuTTY客户端的HTML代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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