Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Support for Xshell terminal #175

Open
alexdelprete opened this issue Jan 22, 2024 · 11 comments
Open

FR: Support for Xshell terminal #175

alexdelprete opened this issue Jan 22, 2024 · 11 comments
Labels
enhancement New feature or request windows

Comments

@alexdelprete
Copy link

alexdelprete commented Jan 22, 2024

Hi,

could you add support for NetSarang Xshell? https://netsarang.com/en/xshell/

I added it as a custom terminal, and used the test feature, it correctly opened a local session, so I guess it supports invoking it via CLI. It also supports opening new tabs vs new windows.

Thanks a lot. :)

@crschnick
Copy link
Contributor

So I looked at the documentation and it seems like the command-line support is limited: https://netsarang.atlassian.net/wiki/spaces/ENSUP/pages/31457646/Command+line+parameters+for+Xshell

It can't be used as an arbitrary terminal, only for certain SSH connections. What I can add is maybe a button for SSH connections to open the connection in Xshell.

@alexdelprete
Copy link
Author

That would be great. Could you give me an example of a proper/full CLI implementation? Because I was merely thinking about opening the SSH connection, but being an Xpipe beginner, I'm surely missing something here. .)

@crschnick
Copy link
Contributor

It's just that to properly open any arbitrary connection in a terminal or other program like xshell, xpipe needs to be able to call the program via its CLI and pass all relevant options. It usually does it by creating and passing a temporary script to be executed that will open the connection.

But since xshell does not support that, we kinda have to choose the second best option and call it differently, in this case by manually passing the connection information like username, host, etc. This is however not a very good solution as you have to enter any passwords, keys, etc. in xshell again when launched because we can't pass that information. It's better than nothing though.

If it would support the same level of CLI interaction as for example you can do with Windows Terminal, then I could add full support.

@alexdelprete
Copy link
Author

alexdelprete commented Jan 22, 2024

It's just that to properly open any arbitrary connection in a terminal or other program like xshell, xpipe needs to be able to call the program via its CLI and pass all relevant options. It usually does it by creating and passing a temporary script to be executed that will open the connection.

Well, Xshell supports session profiles (.xsh files, an ini format) in which it stores all the info needed to connect to a server. It can also open all sessions files contained in a path.

image

So the script you mentioned could actually be that session file, but it should be in .xsh format, I have to check if it is documented, or I can pass you an example so you can check if it contains all needed parameters used by Xpipe.

This is one of my .xsh files, I redacted pw and auth stuff, I guess you don't need everything but only a minimal subset of this to create a session and pass it to xshell cli to open:

[CONNECTION:PROXY]
Proxy=
StartUp=0
[CONNECTION:SERIAL]
BaudRate=6
StopBits=0
FlowCtrl=0
Parity=0
DataBits=3
ComPort=0
[SessionInfo]
Version=7.1
Description=Xshell session file
[Information]
MinorVersion=0
MajorVersion=3
Description=
[TRACE]
SockConn=1
SshLogin=0
SshTunneling=0
SshPacket=0
TelnetOptNego=0
[CONNECTION:SSH]
LaunchAuthAgent=1
KeyExchange=
SSHCiphers=aes128-ctr:1,aes192-ctr:1,aes256-ctr:1,[email protected]:1,[email protected]:1,aes128-cbc:1,aes192-cbc:1,aes256-cbc:1,3des-cbc:1,blowfish-cbc:1,cast128-cbc:1,arcfour:1,rijndael128-cbc:1,rijndael192-cbc:1,rijndael256-cbc:1,[email protected]:1,arcfour128:1,arcfour256:1,[email protected]:1
ForwardToXmanager=1
AgentForwarding=1
Compression=0
KeyExchangeList=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
NoTerminal=0
CipherList=aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael128-cbc,rijndael192-cbc,rijndael256-cbc,aes256-ctr,aes192-ctr,aes128-ctr,[email protected]
UseAuthAgent=1
MAC=
SSHMACs[email protected]:1,[email protected]:1,[email protected]:1,hmac-sha2-256:1,hmac-sha2-512:1,hmac-sha1:1,hmac-sha1-96:1,hmac-md5:1,hmac-md5-96:1,hmac-ripemd160:1,[email protected]:1,[email protected]:1,[email protected]:1,[email protected]:1,[email protected]:1,[email protected]:1,[email protected]:1,[email protected]:1
ForwardX11=0
InitRemoteDirectory=
VexMode=2
Cipher=
Display=localhost:0.0
FwdReqCount=0
InitLocalDirectory=
MACList=hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96,hmac-ripemd160,[email protected],hmac-sha2-256
SSHKeyExchanges[email protected]:1,ecdh-sha2-nistp256:1,ecdh-sha2-nistp384:1,ecdh-sha2-nistp521:1,diffie-hellman-group-exchange-sha256:1,diffie-hellman-group-exchange-sha1:1,diffie-hellman-group14-sha1:1,diffie-hellman-group1-sha1:1,diffie-hellman-group18-sha512:1,diffie-hellman-group16-sha512:1,diffie-hellman-group14-sha256:1
NoConnFileManager=0
SaveHostKey=0
RemoteCommand=
[BELL]
FilePath=
RepeatTime=3
FlashWindow=0
BellMode=1
IgnoreTime=3
[USERINTERFACE]
NoQuickButton=0
ShowOnLinkBar=0
QuickCommand=Weewx
[CONNECTION:FTP]
Passive=1
InitRemoteDirectory=
InitLocalDirectory=
[TRANSFER]
FolderMethod=0
DropXferHandler=2
XmodemUploadCmd=rx
ZmodemUploadCmd=rz -E
FolderPath=
YmodemUploadCmd=rb -E
AutoZmodem=1
SendFolderPath=
DuplMethod=0
XYMODEM_1K=0
[CONNECTION]
PasteDelay=0
Port=22
Host=emqx.axel.dom
Protocol=SSH
AutoReconnect=0
AutoReconnectLimit=0
Description=
AutoReconnectInterval=30
FtpPort=21
UseNaglesAlgorithm=0
IPV=0
[CONNECTION:HWCERTIFICATES]
Count=0
[TERMINAL]
Rows=45
CtrlAltIsAltGr=1
InitOriginMode=0
CodePage=65001
InitReverseMode=0
DisableBlinkingText=0
InitAutoWrapMode=1
Cols=200
InitEchoMode=0
Type=xterm-256color
DisableAlternateScreen=0
CJKAmbiAsWide=0
ScrollBottomOnKeyPress=0
PauseScrollBottom=0
DisableTitleChange=0
ForceEraseOnDEL=0
InitInsertMode=0
ShiftForcesLocalUseOfMouse=1
FontLineCharacter=0
ScrollbackSize=10000
InitCursorMode=0
BackspaceSends=2
FixedCols=0
UseAltAsMeta=1
UseInitSize=1
UseLAltAsMeta=1
UseRAltAsMeta=1
AltKeyMapPath=
DeleteSends=0
DisableTermPrinting=0
IgnoreResizeRequest=0
ScrollBottomOnTermOutput=1
FontPowerLine=0
UseAppMouse=1
ScrollErasedText=1
KeyMap=0
RecvLLAsCRLF=0
MoveToWorkFolder=1
EraseWithBackgroundColor=1
InitNewlineMode=0
InitKeypadMode=0
TerminalNameForEcho=
[TERMINAL:WINDOW]
ColorScheme=New Black
FontQuality=6
CursorColor=65280
CursorBlinkInterval=500
LineSpace=0
TabColorType=0
FontStyle=0
CursorAppearance=0
TabColorOther=0
FontSize=10
CursorBlink=1
AsianFontSize=10
BoldMethod=2
BGImageFile=
CursorTextColor=0
BGImagePos=0
AsianFont=FiraCode Nerd Font Mono
FontFace=CaskaydiaCove NFM
CharSpace=0
AsianFontStyle=0
MarginBottom=2
MarginLeft=2
MarginTop=2
MarginRight=2
[CONNECTION:TELNET]
XdispLoc=1
NegoMode=0
CharMode=0
Display=$PCADDR:0.0
[HIGHLIGHT]
HighlightSet=None
[CONNECTION:AUTHENTICATION]
Pkcs11Pin=
ExpectSend_Expect_0=
ExpectSend_Send_0=
Library=0
Passphrase=**redacted**
UseInitScript=0
Delegation=0
Pkcs11Middleware=
TelnetLoginPrompt=ogin:
CapiPin=
Password=**redacted**
RloginPasswordPrompt=assword:
UseExpectSend=1
TelnetPasswordPrompt=assword:
ExpectSend_Count=1
CapiKey=
Method=0
AuthMethodList=11,00,20,30,40,50
ExpectSend_Hide_0=1
ScriptPath=
UserKey=alexdelprete_ed25519_256
UserName=root
[LOGGING]
FilePath=%n_%Y-%m-%d_%t.log
Overwrite=1
WriteFileTimestamp=0
Type=0
FileMethod=0
TimestampFormat=[%a] 
Encoding=2
TermCode=0
AutoStart=1
Timestamp=0
Prompt=0
WriteTermTimestamp=0
[ADVANCED]
WaitPrompt=
PromptMax=0
SendLineDelayType=0
ApplyAllChanges=1
SendLineDelayInterval=0
SendCharDelayInterval=0
[CONNECTION:RLOGIN]
TermSpeed=38400
[CONNECTION:KEEPALIVE]
SendKeepAliveInterval=60
KeepAliveInterval=60
TCPKeepAlive=0
KeepAliveString=
SendKeepAlive=0
KeepAlive=1
[CONNECTION:HWCAKEYS]
Count=0

@alexdelprete
Copy link
Author

@crschnick
Copy link
Contributor

So I think there are two options here:

  • Generate a xsh by ourselves to dynamically launch any connection
  • Find an already existing xsh file in the sessions dir that matches the hostname/port/user and then launch that

I think option two would make more sense

@alexdelprete
Copy link
Author

alexdelprete commented Jan 23, 2024

I think option two would make more sense

I initially discarded the second because it would mean maintaining a link in case they are renamed or deleted, etc.

How would xpipe link the right .xsh? by name of the server? the requirement could be that the server name in xpipe is part of the filename of one (and only one) .xsh file in the Sessions folder, so xpipe could make an automatic association, without parsing the content of the xsh.

@crschnick
Copy link
Contributor

I can just scan all the .xsh for a certain hostname that is used in the xpipe connection and then call xshell with the found .xsh.

I.e. we would scan all .xsh files to find one that contains Host=<hostname>

@alexdelprete
Copy link
Author

Wouldn't that be slow? It's cool though, dynamic and tight integration. :)

@crschnick
Copy link
Contributor

Not really in terms of other standards. Searching the files for a fixed string should be quick

@alexdelprete
Copy link
Author

alexdelprete commented Jan 23, 2024

That's the best solution then.

Be aware that in the Sessions folder there could be subfolders.

This is my sessions folder in the filesystem:

image

And this is how I navigate it in Xshell (simple and efficient way):

image

@ghost ghost added enhancement New feature or request windows labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request windows
Development

No branches or pull requests

2 participants