Xshell for JumpServer

JumpServer自动打开Xshell

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

Advertisement:

Autor
gdisk
Denně instalací
0
Celkem instalací
1
Hodnocení
0 0 0
Verze
1.0.0
Vytvořeno
25. 06. 2026
Aktualizováno
25. 06. 2026
velikost
5,9 KB
Licence
MIT
Spustit na
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\xshell]
@="URL:xshell Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\xshell\shell]
[HKEY_CLASSES_ROOT\xshell\shell\open]
[HKEY_CLASSES_ROOT\xshell\shell\open\command]
@="\"wscript.exe\" \"D:\\Softwares\\Scripts\\xshell\\open_xshell.vbs\" \"%1\""
If WScript.Arguments.Count = 0 Then WScript.Quit

Dim url
url = WScript.Arguments(0)

' ===== 新增功能:记录URL到文件 =====
Dim scriptPath, logFile, fso, fileStream, currentTime
' 获取当前脚本的完整路径
scriptPath = WScript.ScriptFullName
' 获取脚本所在的目录
scriptPath = Left(scriptPath, InStrRev(scriptPath, "\") - 1)
' 日志文件路径(在脚本同级目录下)
logFile = scriptPath & "\access.log"
' 获取当前时间
currentTime = Now()
' 创建文件系统对象
Set fso = CreateObject("Scripting.FileSystemObject")
' 以追加方式打开文件(如果文件不存在则创建)
Set fileStream = fso.OpenTextFile(logFile, 8, True)
' 写入时间戳和URL
fileStream.WriteLine "[" & currentTime & "] " & url
' 关闭文件
fileStream.Close
' 释放对象
Set fileStream = Nothing
Set fso = Nothing
' ===== 记录功能结束 =====

' 处理URL格式转换:
' 支持格式1: xshell://ssh:admin:pwd@ip:port -> ssh://admin:pwd@ip:port
' 支持格式2: xshell://admin:pwd@ip:port -> ssh://admin:pwd@ip:port
If InStr(LCase(url), "xshell://ssh://") = 1 Then
    url = "ssh://" & Mid(url, 16)
ElseIf InStr(LCase(url), "xshell://ssh//") = 1 Then
    url = "ssh://" & Mid(url, 15)
ElseIf InStr(LCase(url), "xshell://ssh:") = 1 Then
    url = "ssh://" & Mid(url, 14)
ElseIf InStr(LCase(url), "xshell://") = 1 Then
    url = "ssh://" & Mid(url, 10)
End If

' 请根据你的实际安装路径修改 Xshell.exe 的路径!
' 以下是 Xshell 7 的默认路径示例
Dim xshellPath
xshellPath = "C:\Program Files (x86)\NetSarang\Xshell 8\Xshell.exe"

Set ws = CreateObject("WScript.Shell")
' 0 表示隐藏窗口运行,避免黑框一闪而过
ws.Run """" & xshellPath & """ -url " & url, 0, False