Anyone ever written code in vb to ssh to a server(an ssh client)
If so would be great to talk I have got as far as getting the diffie-hellman response from the ssh server but cant seem to find out what to send back to it
Normally one uses an existing SSH client to establish a tunnel to an SSH server. Then your "Winsock" program talks through the tunnel to some server at the SSH host (or behind it), without any special knowledge of SSH.
PuTTY or PLink are the usual clients.
So I assume you plan to implement tunnelling and port forwarding? Or are you just trying to make an SSH Shell connection?
I haven't seen any free or cheap SSH client components, and I can't believe it is worth the trouble to create this functionality from scratch.
Considering your low volume of use I'm not sure it was worth writing Telnet logic to do this sort of thing. There are a few Telnet components out there (though not many free ones), however once again since your needs are modest I'd offer the same solution I'll propose now - it handles both Telnet and SSH.
The native "glue" and automation technology in VB is COM of course. A secondary "glue" or IPC mechanism VBers often default to is TCP/IP, mostly because of the nice Winsock control we got from Microsoft. A much better "glue" for use within one computer though (if you can't use COM) is explicit tasking and Anonymous Pipes.
Tasking and Pipes puts us into the realm of the hackish Unix world of course. It's about all they have to work with in a normal Unix installation. While it works slightly differently in Windows the idea is the same though:
Fire off a utility as a secondary process and "automate" it (remotely control it) via standard I/O redirection through pipes.
Since Microsoft didn't expect us to be doing this in VB they never provided a handy tool like the Winsock control. All we got was the marginally useful Shell() function.
From here we all take a different approach. Some moan that Microsoft, VB, etc. are "no good bums" while others of us roll up our sleeves and deal with it. The result is that many of us have our own pet code for handling this. I haven't seen any standard emerge, and I have a couple of code fragments for this myself.
So where am I going with this?
I believe that PLink is your friend here. It was designed to be automated via scripts anyway, and handles Telnet and SSH shell sessions. All you need is a way to do this from a VB program. I have two solutions, one a bit clunkier than the other.
The first one is older, and uses a class called CExec to do the work. CExec is slightly more tailored toward automating PLink, but is based on blocking calls and is generally a less finished product.
The second one is newer and a little more polished, using a user control called ShellPipe. This is of more general use in automating a "command line utility" and uses an async approach with events. It is a lot more like the Winsock control, and if you've used the Winsock control properly in the past (no goofy looping with DoEvents() calls) you should be comfortable with it pretty quickly.
I won't do your homework for you, but I can attach sample projects that contain each of these options. The PLClient example was purpose-built to show how to use PLink as a path to a data server on a remote machine. It expects PLink.exe to be in the program's current directory when run, and while it uses Telnet it could be changed to use SSH with a tiny command line parameter change.
The ShellPipe Demos examples show how ShellPipe might be used for general automation tasks. It would be easy to use ShellPipe to create a program that automates PLink, and I suspect this is the better way to go. I never use CExec any more myself.