Xshell for JumpServer

JumpServer自动打开Xshell

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

Advertisement:

Autor
gdisk
Instalări zilnice
0
Total instalări
1
Rating-uri
0 0 0
Versiune
1.0.0
Creat
25-06-2026
Actualizat
25-06-2026
Size
5,89 KB
Licență
MIT
Se aplică pe
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