mirror of https://github.com/huashengdun/webssh
Merge 84a95d0ed3
into 1cf19c7186
commit
2b3d96e080
17
README.md
17
README.md
|
@ -1,3 +1,18 @@
|
||||||
|
## 我的修改
|
||||||
|
增加生成SSH Link功能,方便收藏,下次使用不需要输入密码。
|
||||||
|

|
||||||
|
|
||||||
|
部署到容器的教程:
|
||||||
|
|
||||||
|
https://zelikk.blogspot.com/2023/10/huashengdun-webssh-codesandbox.html
|
||||||
|
|
||||||
|
补充 部署到Hugging Face的教程 / 作者 Xiang xjfkkk
|
||||||
|
|
||||||
|
https://linux.do/t/topic/135264
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>原项目readme (点击展开)</summary>
|
||||||
|
|
||||||
## WebSSH
|
## WebSSH
|
||||||
|
|
||||||
[](https://github.com/huashengdun/webssh/actions/workflows/python.yml)
|
[](https://github.com/huashengdun/webssh/actions/workflows/python.yml)
|
||||||
|
@ -210,3 +225,5 @@ wssh --port=8080 --sslport=4433 --certfile='cert.crt' --keyfile='cert.key' --xhe
|
||||||
* For whatever deployment choice you choose, don't forget to enable SSL.
|
* For 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.
|
* 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.
|
* 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.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name Build SSH Link
|
||||||
|
// @namespace http://tampermonkey.net/
|
||||||
|
// @version 0.1
|
||||||
|
// @description Build SSH link for huashengdun-webssh
|
||||||
|
// @author ǝɔ∀ǝdʎz∀ɹɔ 👽
|
||||||
|
// @match https://ssh.vps.vc/*
|
||||||
|
// @match https://ssh.hax.co.id/*
|
||||||
|
// @match https://ssh-crazypeace.koyeb.app/*
|
||||||
|
// @icon https://www.google.com/s2/favicons?sz=64&domain=koyeb.app
|
||||||
|
// @grant none
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Your code here...
|
||||||
|
// 获取 form 元素
|
||||||
|
var form = document.getElementById("connect");
|
||||||
|
|
||||||
|
/////////////////////
|
||||||
|
// 创建 `<button>` 元素
|
||||||
|
var buildLinkBtn = document.createElement("button");
|
||||||
|
|
||||||
|
// 设置 `<button>` 的属性
|
||||||
|
buildLinkBtn.type="button";
|
||||||
|
buildLinkBtn.className="btn btn-info";
|
||||||
|
buildLinkBtn.innerHTML="buildSSHLink";
|
||||||
|
buildLinkBtn.id="sshlinkBtnA";
|
||||||
|
|
||||||
|
// 将 `<button>` 添加到 `<form>` 元素范围内部的尾部
|
||||||
|
form.appendChild(buildLinkBtn);
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
// 创建 `<div>` 元素
|
||||||
|
var sshlinkdiv = document.createElement("div");
|
||||||
|
|
||||||
|
// 设置 `<div>` 的属性
|
||||||
|
sshlinkdiv.id = "sshlinkA";
|
||||||
|
|
||||||
|
// 将 `<div>` 添加到 `<form>` 元素范围内部的尾部
|
||||||
|
form.appendChild(sshlinkdiv);
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
// 让按钮的click事件 调用 updateSSHlinkA 函数
|
||||||
|
document.querySelector('#sshlinkBtnA').addEventListener("click", updateSSHlinkA);
|
||||||
|
})();
|
||||||
|
|
||||||
|
function updateSSHlinkA() {
|
||||||
|
var thisPageProtocol = window.location.protocol;
|
||||||
|
var thisPageUrl = window.location.host;
|
||||||
|
|
||||||
|
var hostnamestr = document.getElementById("hostname").value;
|
||||||
|
var portstr = document.getElementById("port").value;
|
||||||
|
if (portstr == "") {
|
||||||
|
portstr = "22"
|
||||||
|
}
|
||||||
|
var usrnamestr = document.getElementById("username").value;
|
||||||
|
if (usrnamestr == "") {
|
||||||
|
portstr = "root"
|
||||||
|
}
|
||||||
|
var passwdstr = document.getElementById("password").value;
|
||||||
|
var passwdstrAfterBase64 = window.btoa(passwdstr);
|
||||||
|
|
||||||
|
var sshlinkstr;
|
||||||
|
sshlinkstr = thisPageProtocol+"//"+thisPageUrl+"/?hostname="+hostnamestr+"&port="+portstr+"&username="+usrnamestr+"&password="+passwdstrAfterBase64;
|
||||||
|
|
||||||
|
document.getElementById("sshlinkA").innerHTML = sshlinkstr;
|
||||||
|
}
|
|
@ -48,7 +48,7 @@ define('delay', type=float, default=3, help='The delay to call recycle_worker')
|
||||||
define('maxconn', type=int, default=20,
|
define('maxconn', type=int, default=20,
|
||||||
help='Maximum live connections (ssh sessions) per client')
|
help='Maximum live connections (ssh sessions) per client')
|
||||||
define('font', default='', help='custom font filename')
|
define('font', default='', help='custom font filename')
|
||||||
define('encoding', default='',
|
define('encoding', default='utf-8',
|
||||||
help='''The default character encoding of ssh servers.
|
help='''The default character encoding of ssh servers.
|
||||||
Example: --encoding='utf-8' to solve the problem with some switches&routers''')
|
Example: --encoding='utf-8' to solve the problem with some switches&routers''')
|
||||||
define('version', type=bool, help='Show version information',
|
define('version', type=bool, help='Show version information',
|
||||||
|
|
Binary file not shown.
|
@ -32,8 +32,34 @@ var wssh = {};
|
||||||
data[name] = value;
|
data[name] = value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.querySelector('#sshlinkBtn').addEventListener("click", updateSSHlink);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
function updateSSHlink() {
|
||||||
|
var thisPageProtocol = window.location.protocol;
|
||||||
|
var thisPageUrl = window.location.host;
|
||||||
|
|
||||||
|
var hostnamestr = document.getElementById("hostname").value;
|
||||||
|
var portstr = document.getElementById("port").value;
|
||||||
|
if (portstr == "") {
|
||||||
|
portstr = "22"
|
||||||
|
}
|
||||||
|
var usrnamestr = document.getElementById("username").value;
|
||||||
|
if (usrnamestr == "") {
|
||||||
|
portstr = "root"
|
||||||
|
}
|
||||||
|
var passwdstr = document.getElementById("password").value;
|
||||||
|
var passwdstrAfterBase64 = window.btoa(passwdstr);
|
||||||
|
|
||||||
|
var initcmdstr = document.getElementById("initcmd").value;
|
||||||
|
var initcmdstrAfterURI = encodeURIComponent(initcmdstr);
|
||||||
|
|
||||||
|
var sshlinkstr;
|
||||||
|
sshlinkstr = thisPageProtocol+"//"+thisPageUrl+"/?hostname="+hostnamestr+"&port="+portstr+"&username="+usrnamestr+"&password="+passwdstrAfterBase64+"&command="+initcmdstrAfterURI;
|
||||||
|
|
||||||
|
document.getElementById("sshlink").innerHTML = sshlinkstr;
|
||||||
|
}
|
||||||
|
|
||||||
jQuery(function($){
|
jQuery(function($){
|
||||||
var status = $('#status'),
|
var status = $('#status'),
|
||||||
|
|
|
@ -77,12 +77,18 @@
|
||||||
<input class="form-control" type="password" id="totp" name="totp" value="">
|
<input class="form-control" type="password" id="totp" name="totp" value="">
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
<label for="InitCmd">Init Command (execute the command after login)</label>
|
||||||
|
<input class="form-control" type="text" id="initcmd" name="initcmd" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="term" name="term" value="xterm-256color">
|
<input type="hidden" id="term" name="term" value="xterm-256color">
|
||||||
{% module xsrf_form_html() %}
|
{% module xsrf_form_html() %}
|
||||||
<button type="submit" class="btn btn-primary">Connect</button>
|
<button type="submit" class="btn btn-primary">Connect</button>
|
||||||
<button type="reset" class="btn btn-danger">Reset</button>
|
<button type="reset" class="btn btn-danger">Reset</button>
|
||||||
|
<button type="button" class="btn btn-info" id="sshlinkBtn">SSH Link</button>
|
||||||
|
<div id="sshlink"></div>
|
||||||
|
<div>Github: <a href="https://github.com/crazypeace/huashengdun-webssh">https://github.com/crazypeace/huashengdun-webssh</a></div>
|
||||||
|
<div>自建教程: <a href="https://zelikk.blogspot.com/search/label/webssh">https://zelikk.blogspot.com/search/label/webssh</a></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue