EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SSH simple .net console application example

Posted: 12/13/2009 13:45:15
by sridhar bethamsetty (Priority Standard support level)
Joined: 12/13/2009
Posts: 3

We bought secureblackbox recently and most of the times we use SSH in .net console applicaiton to issue some simple commands..like "cat /opt/a.txt | grep HELLO > /opt/myfile.txt' and later we use SFTP to download file

SFTP some how i figured out from .Net application what is available in samples.. but for SSH i don't see simple console example...

Can I get one simple example

initialize SSH client
pass ServerIPAddress
pass username
pass password
Key authenticate
issue commands what i explained above

Posted: 12/13/2009 23:25:32
by Ken Ivanov (Team)

Please take a look at the SimpleSSHDemo sample (SBB\Samples\C#\SSHBlackbox\Client\SimpleSSHClient). Though it is GUI-based, the code would be similar for the console application.
Posted: 12/14/2009 09:16:02
by sridhar bethamsetty (Priority Standard support level)
Joined: 12/13/2009
Posts: 3

Mr.Innokentiy Ivanov,
Please do not expect everyone is .Net professional and can easily figure out things...

Come to the sample application, I have already seen that example and it was basically pointing to Form interface where user can issue command in that interface.

But i need sample code where it "connect to the server with authuntication" and issue commands(i don't see ExecuteCommand..example in that code)..

Posted: 12/14/2009 09:30:51
by Eugene Mayevski (Team)

Please read our support policy. We don't teach programming, neither we do others' programming-related job.

Sincerely yours
Eugene Mayevski
Posted: 12/14/2009 09:32:31
by Eugene Mayevski (Team)

Yet we will implement such sample. Please wait until tomorrow.

Sincerely yours
Eugene Mayevski
Posted: 12/14/2009 10:41:17
by sridhar bethamsetty (Priority Standard support level)
Joined: 12/13/2009
Posts: 3

Thanks Eugene,

Any way i figured this out

Only thing is it took some time.
SBSimpleSSH.TElSimpleSSHClient client = new SBSimpleSSH.TElSimpleSSHClient();
TElSSHMemoryKeyStorage KeyStorage = new TElSSHMemoryKeyStorage();
client.KeyStorage = KeyStorage;
client.Address = "SERVERADDRESS";
client.Port = 22;
client.Username = "username";
client.Password = "password";
client.OnKeyValidate += new SBSSHCommon.TSSHKeyValidateEvent(Client_OnKeyValidate);
client.AuthenticationTypes = client.AuthenticationTypes & (~SBSSHConstants.Unit.SSH_AUTH_TYPE_PUBLICKEY);
byte[] vByte=client.ExecuteCommand("ls -la /opt/cems/log/streamlog/streaminglogs.csl.*.2009121410*");
string s = System.Text.Encoding.ASCII.GetString(vByte);

Posted: 12/15/2009 04:43:34
by Ken Ivanov (Team)

Just in case if the sample is still needed, it is attached.

[ Download ]



Topic viewed 3777 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!