Does anyone know of an SSH/telnet/terminal plugin for Xojo? I want to write an application to automate logging in to network devices (routers, firewalls, etc.) and execute commands. There are several .NET ActiveX/COM controls from companies like WeOnlyDo, Dart and so on to accomplish this but none for Xojo. I do not want to use a shell program such as the OS SSH and telnet functions.
I’ve been a VB.Net programmer for years and have recently started using it again simply for lack of third-party controls for Xojo. I really do like programming with Xojo and I love the fact that it creates stand-alone applications but the lack of third-party support has stopped me more than once.
Any pointers in the right direction would be appreciated.
One very important issue. You should never use telnet if you can avoid it, as all communication is unencrypted. And these days all new firewalls supports SSH.
Chilkat Software has an active-x component for Windows OS. I use their .net component in a couple of projects. If I remember correctly a couple of years ago I was able to use it with RS.
Right now I don’t have much time to write a better example. But with the below code I manage to create an empty file on my server.
Dim sessionOptions As OLEObject
Dim Session As OLEObject
sessionOptions = New OLEObject("WinSCP.SessionOptions")
//sessionOptions.Protocol = Protocol.Sftp // Xojo OleObject don't support enum.
sessionOptions.Protocol = 0 // RS Oleobject don't support enum I tried with different numbers and this one works.
sessionOptions.HostName = "MyHostName"
sessionOptions.UserName = "MyUserName"
sessionOptions.Password = "MyPassword"
sessionOptions.SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" // See http://winscp.net/eng/docs/faq_script_hostkey
session = new OLEObject("WinSCP.Session")
session.Open(sessionOptions)
session.ExecuteCommand("/bin/touch /tmp/MyNewFile.txt")
exception err as oleexception
msgbox err.message
You can obtain the rsa finger print by invoke following command on your SSH server:
ssh-keygen -lf <file-path-to-rsa_key.pub>
[code]
Dim sessionOptions As OLEObject
Dim Session As OLEObject
sessionOptions = New OLEObject(“WinSCP.SessionOptions”)
//sessionOptions.Protocol = Protocol.Sftp // Xojo OleObject don’t support enum.
sessionOptions.Protocol = 0 // RS Oleobject don’t support enum I tried with different numbers and this one works.
// Copy files from windows to a Linux platform
session.PutFiles(“C:\\temp\\XOJO\\*”, “/tmp/XOJO/”, false) //When set to true, deletes source local file(s) after transfer.
But in the real world Telnet is dead. SSH is king.
On Mac OS X you can link into OpenSSH but on Windows you are out of luck.
Anyone has written a x-plat class/plugin for this?
Robert trust me I do know However I am writing apps to connect to devices that do not have SSH enabled. Many times people may still need a TELNET class for Xojo at some point
Unfortunately not yet. Kem Tekinay wrote an interactive shell for ssh, but everything I have seen so far people are using the shell for ssh. That is only good for Linux and Mac though.