EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SSH simple .net console application example

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#11921
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

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


Regards
Sri
#11924
Posted: 12/13/2009 23:25:32
by Ken Ivanov (EldoS Corp.)

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.
#11944
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)..


-Sri
#11945
Posted: 12/14/2009 09:30:51
by Eugene Mayevski (EldoS Corp.)

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


Sincerely yours
Eugene Mayevski
#11946
Posted: 12/14/2009 09:32:31
by Eugene Mayevski (EldoS Corp.)

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


Sincerely yours
Eugene Mayevski
#11949
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.
-----------------------------------------------------------------------------
try
{
SBUtils.Unit.SetLicenseKey("fdsfdsfds");
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);
MessageBox.Show(s);
client.Close(false);
}
-----------------------------------------------------------

Regards
-Sri
#11952
Posted: 12/15/2009 04:43:34
by Ken Ivanov (EldoS Corp.)

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


[ Download ]
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 3547 times

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




|

Back to top

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

Got it!