Question about connection and sending with wodSSH. - WeOnlyDo Discussion board

Question about connection and sending with wodSSH. (General questions)

by Michael Helsel, Friday, May 25, 2007, 19:45 (6392 days ago)

Hello,

I am testing the SSH2 protocol when connecting to our network switches. Telnet works fine, but when I use SSH2 I receive the following error: Server Signature does not match.

I know the error is because its the first time I am connecting to the switch, and the key needs to be trusted. Is there a way to fix this?

On another topic when I send data, I would like to use delegates. I know the receive property allows a fired event, is there a way to fire an event when a send is completed? I want to use delgates.

Thanks,
Mike Helsel

Re: Question about connection and sending with wod

by woddrazen, Friday, May 25, 2007, 20:10 (6392 days ago) @ Michael Helsel

Hi Mike,


Can we somehow duplicated error Server Signature does not match. ?
This is probably something that we will need to duplicate in order to fix it. What is your server type/vendor/name?

You ca check his out if you go in command prompt and type:

telnet your.hostname 22

and send us first line returned.

Is it maybe possible for you to make us some test account on your server so we can duplicate it on our side? At least please if you can give us just hostname and maybe it will be enough to duplicate it.

You can send you private information to techsupport@weonlydo.com

About Delegate and Send Method. Did you try our samples which you can find in wodSSH.NET Samples folder?
I think they will be useful for start about how to use Delegate function and wodSSH.NET Send Method. If you find any problem please let us know.

Hope i helped.


Regards,
Drazen

Re: Question about connection and sending with wod

by woddrazen, Friday, May 25, 2007, 20:19 (6392 days ago) @ woddrazen

Mike


... one more note, please make sure that you have installed latest 2.2.4.66 wodSSH.NET component version.

You can check this out in Version Property

Here is example how:
-----------------------------
MsgBox(ssh1.Version)
-----------------------------


Drazen

Re: Question about connection and sending with wod

by Michael Helsel, Friday, May 25, 2007, 20:40 (6391 days ago) @ woddrazen

Hello again,

I just wanted to clarify on my problems earlier:

1. The samples provide both connection and receive delegate events, but I did not see a specific event for sent data. What I would like to do is send data asynchronously and let it complete and use a ManualResetEvent variable to set/wait for it to complete.

2. When I connect to a switch via SSH2 protocol for the first time using putty or any other, I receive a message about the host public key and it asks me if I want to accept it and the application gives off the error that says server signature does not match . If I say yes, everything works. And the next time I use my application to connect via SSH2 protocol it works.

A lot of users will be using my application, and when they try to connect for the first time they will get that error, I was hoping there was a way around that.

Thanks,
Mike Helsel

Re: Question about connection and sending with wod

by wodSupport, Friday, May 25, 2007, 23:10 (6391 days ago) @ Michael Helsel

Michael,

let me hop in. Regarding 'server signature doesn't match' error, I think this is server-side issue of some kind, and needs to be workarounded by the client. I assume this is older switch, is that correct? Can we connect there to duplicate the problem?

As for BeginSend/EndSend, we don't have that. If you set Ssh1.Blocking=False then all sends are async anyway. If you set Ssh1.Blocking=True then all sends are sync - so just pick one of those.

Hope this helps!

Kreso

Re: Question about connection and sending with wod

by Michael Helsel, Saturday, May 26, 2007, 14:33 (6391 days ago) @ wodSupport

Unfortunately I can't allow you to connect to our network switches due to our corporate policy and security measures to duplicate the error, Sorry. :(

As far as the async sends, I just use the PromptReceivedEvent right?

As of right now it works using sync and blocking = True, however when sending more than one command back to back I have to use the following command after each sent command:

system.threading.thread.sleep(x) x= amount of miliseconds, so usually its 150.

I really do not want to do that if I don't need to, but my other problem is my application threads can't move on until those sends and those receives are finished. So I am not sure how to use the async correctly for my scenario.

I was reading up the prompt event and I have a question, I have the initial prompt when I log in and start sending commands, but how does the prompt event work if you have the --More-- displayed because there is more data. i.e., I login into a switch issue the command sh port x/x then it displays the data, but there is more so instead of displaying the normal prompt it displays --More-- and you can either hit enter or space .

How do I adjust the prompt property to realize this, so I can issue a send command with enter or space.

Thanks!
Mike Helsel

Re: Question about connection and sending with wod

by wodDamir, Saturday, May 26, 2007, 15:05 (6391 days ago) @ Michael Helsel

Hi Michael,

Instead of using Sleep, why don't you try with WaitFor Method?

You can insert WaitFor between sending commands. That way you would be certain that the specified prompt is received (and thus command was executed), and you can send the next command.

That way you could also wait for --More-- and decide what to do when you receive it.

As for the prompt property, did you try using regex expressions? Maybe you could customize it so that the PromptReceived Event is triggered in both cases. If not, you could check the received data for --More-- string.

Hope I helped.

Regards,
Damba

Re: Question about connection and sending with wod

by mhelsel, Tuesday, June 05, 2007, 18:34 (6381 days ago) @ wodDamir

Hi Mike,


Can we somehow duplicated error Server Signature does not match. ?
This is probably something that we will need to duplicate in order to fix it. What is your server type/vendor/name?

You ca check his out if you go in command prompt and type:

telnet your.hostname 22

and send us first line returned.

Is it maybe possible for you to make us some test account on your server so we can duplicate it on our side? At least please if you can give us just hostname and maybe it will be enough to duplicate it.

You can send you private information to techsupport@weonlydo.com

About Delegate and Send Method. Did you try our samples which you can find in wodSSH.NET Samples folder?
I think they will be useful for start about how to use Delegate function and wodSSH.NET Send Method. If you find any problem please let us know.

Hope i helped.


Regards,
Drazen

I just wanted to let you know I am working on setting up a new switch to allow you to try to duplicate the error. I will email you when I get everything ready.

Thanks,
Mike Helsel