F-Secure SSH servers with EmulationType of color (General questions)
I am experiencing an issue connecting wodSSH.NET to F-Secure SSH servers (on Windows Server 2003) that use an EmulationType of color. When using color I receive a timeout on the WaitFor call to get a prompt after login:
[code]Trace.WriteLine(_sshClient.WaitFor(_sshPrompt, 15));[/code]
When I change that to stream my code works fine, but I need it to work with color also to conform to our standards
I am using a prompt of [code]regex:[$ #>]s?$[/code]
Any help is appreciated
[code]
public void Run()
{
_sshClient = new SSH();
_sshClient.AllocatePty = false;
_sshClient.LicenseKey = WOD_SSH_LicenseKey;
_sshClient.Hostname = _targetServer;
_sshClient.Login = _login;
_sshClient.Password = _password;
_sshClient.Protocol = SSH.SupportedProtocols.SSHAuto;
_sshClient.Blocking = true;
_sshClient.Timeout = 60;
_sshClient.DataReceivedEvent += new WeOnlyDo.Client.SSH.DataReceivedDelegate(_sshClient_DataReceivedEvent);
_sshClient.StateChangedEvent += new WeOnlyDo.Client.SSH.StateChangedDelegate(_sshClient_StateChangedEvent);
_sshClient.ShowStdErrorMessages = true;
Trace.WriteLine( Establishing connection );
_sshClient.Connect();
Trace.WriteLine( Waiting for connection extablished prompt );
Trace.WriteLine(_sshClient.WaitFor(_sshPrompt, 15));
Trace.WriteLine(_sshClient.Receive());
Trace.WriteLine( Starting commands );
string result = _sshClient.Execute( dir *.*
, _sshPrompt);
// Trace.WriteLine(result);
// result = _sshClient.Execute( cd ..
, _sshPrompt);
// Trace.WriteLine(result);
// Trace.WriteLine( Command 2 );
// result = _sshClient.Execute( dir *.*
, _sshPrompt);
// Trace.WriteLine(result);
// //Trace.WriteLine(ExecuteSSHCommand( CD \
, _sshPrompt));
// Trace.WriteLine(ExecuteSSHCommand( dir *.*
, _sshPrompt));
//Trace.WriteLine(ExecuteSSHCommand( RMDIR /S /Q + _executeLocation +
, _sshPrompt));
Trace.WriteLine( Completed );
_sshClient.Disconnect();
_sshClient.Dispose();
}
private void _sshClient_DataReceivedEvent(object Sender, WeOnlyDo.Client.SSH.DataReceivedArgs args)
{
Trace.WriteLine(DateTime.Now.ToString() + : + String.Format( Data Received Event: {0} bytes , args.BytesCount));
}
private void _sshClient_StateChangedEvent(object Sender, WeOnlyDo.Client.SSH.StateChangedArgs args)
{
Trace.WriteLine(String.Format( {0} : {1} , DateTime.Now, State Changed From:' + args.OldState + ' To: ' + args.NewState + ' ));
}
[/code]