EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ExecuteCommand vs SendText

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
#27158
Posted: 11/05/2013 11:45:26
by Keith Huster (Standard support level)
Joined: 11/05/2013
Posts: 5

I am attempting to execute commands on a remote Linux server via the Secure Blackbox SSH client. I really like the functionality of the "ExecuteCommand" method as it seems to parse the response messages nicely. However, the drawback to the "ExecuteCommand" method is that it creates and tears down a new connection to the remote server each time it is called. My application needs to maintain the SSH connection (for performance reasons) between command executions. Is there any way to do this with this method?

As a workaround I have resorted to using the "SendText" method in conjunction with the "ReceiveData" method to simulate the inner workings of the "ExecuteCommand" method. This works fine and the commands are executed properly but unfortunately the response has become difficult to parse as I am receiving the request string along with unexpected characters at the beginning and end of the response string. I can easily filter out the request string but the unexpected characters are not always the same. Is there a better way to filter out the response string such that it matches the functionality of the "ExecuteCommand" method?
#27159
Posted: 11/05/2013 11:55:34
by Eugene Mayevski (EldoS Corp.)

ExecuteCommand is a high-level method which uses Command property. So all you need to do is not use SendText but set Command property before opening connection. You can use Commands property to execute commands one by one. If you need to send commands dynamically, the task becomes more complicated.


Sincerely yours
Eugene Mayevski
#27160
Posted: 11/05/2013 12:01:12
by Keith Huster (Standard support level)
Joined: 11/05/2013
Posts: 5

Thanks... that's helpful. However, we do need to send commands dynamically. We are controlling some remote hardware via the SSH connection so we need to send commands via SSH as needed by the end user.
#27161
Posted: 11/05/2013 12:39:10
by Eugene Mayevski (EldoS Corp.)

In this case you will have to switch from TElSimpleSSHClient to TElSSHClient and supplementary components. We have SophisticatedSSHClient sample that makes use of TElSSHClient . There you will need to dynamically create Command tunnels for each command being sent.


Sincerely yours
Eugene Mayevski
#27198
Posted: 11/07/2013 16:37:41
by Paul Power (Standard support level)
Joined: 04/20/2006
Posts: 14

Hi Eugene,

I too would be interested in the SophisticatedSSHClient sample - where can we obtain a copy of this? I downloaded SecureBlackbox - version 11.0.241 - Released October 25, 2013 and didn't notice it among the Delphi samples.

Thanks,

Paul Power
#27199
Posted: 11/08/2013 01:10:46
by Vsevolod Ievgiienko (EldoS Corp.)

The sample is located in \EldoS\SecureBlackbox.VCL\Samples\Delphi\SSHBlackbox\Client\ClientDemo folder for VCL.
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 2511 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!