Re: Question about SSH ActiveX Control - WeOnlyDo Discussion board

Re: Question about SSH ActiveX Control (General questions)

by Josh, Monday, March 03, 2008, 17:33 (6108 days ago) @ woddrazen

Ok, finally got this working. Haven't spent a lot of time on it yet, but I haven't had a bunch of time either. I was able to make this work by modifying the sample script provided with the control and I've changed the exec section to look like this:

[code]
set ssh = CreateObject( WeOnlyDo.wodSSHCom.1 )
ssh.Login = Request.Form( login )
ssh.Password = Request.Form( password )
ssh.Hostname = Request.Form( hostname )
ssh.Blocking = 1
ssh.Protocol = Request.Form( protocol )
Dim p
p = Request.Form( port )
ssh.Port = p

ssh.Timeout = 10
ssh.Connect

ssh.WaitFor ( User: )
ssh.Send secondary_username + vbLf
ssh.WaitFor ( Password: )
ssh.Send secondary_password + vbLf
ssh.WaitFor ( > )
ssh.Send config paging disable + vbLf
ssh.WaitFor ( > )
ssh.Send show inv + vbLf

' now we read as long as there's something to read
On Error Resume next
ssh.Timeout = 2
Dim a
a = something
while a <> ' iow while connected
a =
a = ssh.Receive
if a <> then
resp = resp & a
end if
wend
[/code]

This works and gives me output in the textarea like this:

[code]
show inv

Burned-in MAC Address............................ xx:xx:xx:xx:xx:xx
Crypto Accelerator 1............................. Absent
Crypto Accelerator 2............................. Absent
Power Supply 1................................... Absent
Power Supply 2................................... Present, OK

NAME: Chassis , DESCR: Chassis

PID: AIR-WLC4404-100-K9, VID: V02, SN: xxxxxxxxxxx

(Cisco Controller) >
[/code]

However, if I send multiple commands, I only get the output from the last command and I can't seem to figure out how to capture the rest of the output. I've tried adding in some extra ssh.Receive's and when I do that, I get WeOnlyDo.wodSSHCom.1 (0x800A05B4) The current connection has timeout. messages. Ideally, I'd like to capture every drop of output from the initial login until I'm completely done. I would appreciate it if someone could point me in the right direction. Thanks!


Complete thread: