SSH using ASP (wodSSH / wodSSH.NET)

by Sandeep @, (6866 days ago)

I am able to execute commands on a unix machine which allows telnet.Below is the code I use.

set cmchk = Server.CreateObject( WeOnlyDo.wodSSHCom.1 )
cmchk.blocking = true
cmchk.login = login
cmchk.password = password
cmchk.hostname = 222
cmchk.LicenseKey = d-f-g-r
cmchk.port = 23
cmchk.connect
On Error Resume Next

Debug.Print(cmchk.waitfor( # ))
scm = (cmchk.Execute( comm & vblf, # ))
cmchk.Disconnect
response.write(scm)

The problem is that I am not able to do SSH to another unix machine. Below is the code I use.

set cmchk = Server.CreateObject( WeOnlyDo.wodSSHCom.1 )
cmchk.blocking = true
cmchk.login = login
cmchk.password = password
cmchk.hostname = 22.33.33.33
cmchk.LicenseKey = d-g-w-e
cmchk.port = 22
cmchk.protocol =SSHAuto
cmchk.connect

On Error Resume Next

Debug.Print(cmchk.waitfor( # ))
scm = (cmchk.Execute( ls & vblf))

cmchk.Disconnect
Response.Write( hello &scm)

Any help would be appreciated.


Thanks,
Sandeep

locked

Re: SSH using ASP

by Jasmine, (6866 days ago) @ Sandeep

Sandeep,

from my previous experience, I would say problem is in Windows Firewall that doesn't allow users with IUSR_COMPUTER privileges to access outside world.

Can you lower your shields on the server by disabling Windows Firewall and try if it works?

Kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

Thanks for the Reply,

I did try by allowing all traffic from the windows server to the linux server but still no Luck. As I mentioned earlier I am able to get to another unix server. I am also able to use Putty and login( BOth telnet and SSH) to the unix server from the same windows server. Any other suggestions please?

Thanks,
Sandeep

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ Sandeep

And if you try to connect to that UNIX server from within regular desktop application, does it work?

Kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

Yes, I am able to SSH from my desktop using Putty.

Thanks,
Sandeep

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ Sandeep

What error did you say you get? Timeout or something else?

Kreso

locked

Re: SSH using ASP

by sandeep, (6865 days ago) @ Jasmine

Yes Timeout

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ sandeep

Are you sure you disabled firewall? Disable it completely and try again.

Kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

Well I just changed the code and found that I am able to connect. The error I receive now is

Last login: Thu Sep 14 04:26:04 2006 from nocmon.iw.net
Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Print'

/scm/sshtest.asp, line 38

Code I use is

Debug.Print cmchk.waitfor( # )
scm = cmchk.Execute( ls & vblf)

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ Sandeep

Well, this is ASP error, not wodSSH anymore.

Perhaps you should try to use

Response.Write

instead? But please consult ASP help for that.

Regards,
Kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

I almost agree with you but your manual says the syntax for
Wait for is

Debug.Print Ssh1.WaitFor( joe@debian )


I f I USE RESPONSE.WRITE I GET THE BELOW ERROR.

WeOnlyDo.wodSSHCom.1 error '800a754a'

You should set pattern to wait for.

/scm/sshtest.asp, line 39

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ Sandeep

Yes, pattern for Waitfor is as explained there. But language where we described is VB, not ASP. That's why you get the error.

As for new error - WaitFor needs more arguments, unless Prompt property was set - and is not in your case.

Kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

I used prompt and response.write. This works. I receive the correct output. The only thing left is I receive few special charecters at the beginning of each line and the entire output is in one line any options to eliminate these.

Thanks for all the Help

Sandeep.

locked

Re: SSH using ASP

by Jasmine, (6865 days ago) @ Sandeep

I think StripANSI could help. You're probably receiving ANSI sequences.

You can also try to change TerminalType property to, for example, 'tty' or 'dumb' - that sometimes help.

Regards,
kreso

locked

Re: SSH using ASP

by Sandeep, (6865 days ago) @ Jasmine

StripANSI is sometimes getting rid of the first line of the output. tty and dumb did not help either but Thanks for all the Help.

Thanks,
Sandeep

locked