Xshell for JumpServer

JumpServer自动打开Xshell

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Advertisement:

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Advertisement:

Autore
gdisk
Installazioni giornaliere
0
Installazioni totali
1
Valutazione
0 0 0
Versione
1.0.0
Creato il
25/06/2026
Aggiornato il
25/06/2026
Dimensione
5,89 KB
Licenza
MIT
Applica a
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