C# Library for SSH and Telnet [closed]
Asked Answered
P

4

22

I'm looking for a C# library that provides access to both SSH and Telnet under the same interface. What would be a good choice?

Persaud answered 3/2, 2011 at 0:36 Comment(8)
How could they possibly use the same interface? SSH needs things like username, private key files, and so on, which have no meaning to Telnet. I guess after the connection is established you could have a common interface which is just a bidirectional byte stream, but connection setup is very different.Luella
what did you find when you searched, and why didn't they meet your needs?Prussian
Wait, search? I thought posting here was searching?Donetsk
Hang on isn't SO "Search Outsourcing"?Bodleian
@Ben: Sure, there must be different config parameters depending on which kind of connection is needed, but being forced to use different libs with different API for the rest of the communication seems stupid.Hatbox
Any particular reason to not call Cygwin's telnet or ssh in pipeline via Process.Start()?Kirkland
@Kirkland - Can you provide an answer with some code demonstrating what you're suggesting? That would help. :)Premonish
It's kind of an architecture question based on what you are trying to do with it.Kirkland
F
9

I recommend Granados for SSH stack. It has been used in many products.

I recommend this code project page for telnet stack.

You can also download Poderosa terminal emulator. It's using Granados as the SSH stack and it has its own implementation of telnet stack.

Poderosa is very pluggable. It provides a good abstraction layer on the network stacks. If you don't have time to write your own unified interface, you should really check out their work. It provides access to both SSH and Telnet under the same interface like what you want. Unfortunately, it's written by Japanese engineers. All the inline comments are written in Japanese. It may take you some time to understand the codes.

You may also like to check out the terminal emulation library as well. Since you are going to process the data returning from the remote terminals, most terminals return escape character sequence for device control commands, font color/style or cursor movement commands.

You may not notice that even in a simple command "ls -al", the returned content may also involve some escape character sequences. Those escape sequences are to make the directory name and file name shown in different colors.

Again, for terminal emulation, the best C# library I can find is Poderosa. If you don't have to use C# library, PuTTY has the best terminal emulation support. It can recognize almost all escape character sequences I have seen so far.

Although I highly recommend you to look at Poderosa and Granados, please be aware that these projects seem to be no longer active. Well.. even so, it's still the best I have seen.

Firkin answered 3/2, 2011 at 1:48 Comment(0)
A
3

Making the SSH work with C# is indeed very tricky and most of the implementations are either buggy or too slow. When we were making SmarTTY, we struggled with SharpSSH and SSH.Net a lot, and then finally decided to make our own C# wrapper around libssh2.

Although SmarTTY is not open-source, if you want to use its SSH library in your project, feel free to drop me an email. If there's a great demand for a library like that, we might release it as a separate product.

Aixlachapelle answered 3/2, 2013 at 18:29 Comment(2)
I'd love to see your ssh wrapper.Carport
Hello Ivan. How I see, you still don't released your wrapper? Can I get it for use in my project?Krasnoyarsk
M
2

This link might help you C# Telnet Library

  • Minimalistic Telnet
  • telnetcsharp.codeplex.com
  • xpresslearn
  • thoughtproject.com
  • dotnettelnet
Markusmarl answered 3/2, 2011 at 0:55 Comment(0)
D
1

I couldn't find anything that provides identical (or even similar APIs) for both telnet and ssh, sharpSSH is a little library that nicely abstracts SSH.

Dorsiventral answered 3/2, 2011 at 1:2 Comment(2)
SharpSSH has not been maintained for years...Aegisthus
Seems like someone took over SharpSSH here SSH.Net and is available via NuGet +1Readjustment

© 2022 - 2024 — McMap. All rights reserved.