I've had an SSH Tunnel Script working for a long time now as a 32-bit Chilkat app and it works well, but once I registered the 64-bit DLL for 22.214.171.124, it started throwing exceptions like this... (p.s. this looks like a bug in 126.96.36.199 x86 and x64)
C:scripts>cscript sshtunnel.vbs 192.168.0.133-rdp 192.168.0.107-rdp Microsoft (R) Windows Script Host Version 5.812 Copyright (C) Microsoft Corporation. All rights reserved.And then unregistering the x64 DLL and reregistering the x86 DLL worked like a charm (script worked as expected)... although the working 32-bit DLL is version 188.8.131.52.
P.S. trying to make 184.108.40.206 32-bit DLL work, fails at same place.
ERROR WHILE TRYING TO START ACCEPTING: ChilkatLog: BeginAccepting: DllDate: Jun 13 2016 ChilkatVersion: 220.127.116.11 UnlockPrefix: CHANGEDFORPRIVACY Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 0 listenPort: 3333 dynamicPortForwarding: 0 StaticPortForwarding: destPort: 3389 destHostname: 192.168.0.107 --StaticPortForwarding Not yet connected to the SSH tunnel. Failed. --BeginAccepting --ChilkatLog
For the time being, I'll just keep using the 32-bit 18.104.22.168 as I don't know where to download the x64 version from (only the current one [22.214.171.124] seems available). I am guessing this is a bug introduced after ".48".
Please let me know what you find, Steven
Here's my code... which was adapted from your samples
Function chillkat_establish_ssh_tunnel (sshTunnel,desthost,destport,throughhost,throughport,throughuser,throughpass,locallistenport) On Error Resume Next ' The DestHostname may be the domain name or ' IP address (in dotted decimal notation) of the database ' server. ''we need to test that our tunnel will work first... Set ssh = CreateObject("Chilkat_9_5_0.Ssh") if Err.Number <> 0 Then WScript.Echo " Error creating Object: " & Err.Description chillkat_establish_ssh_tunnel = 0 Exit Function End If ' Any string automatically begins a fully-functional 30-day trial. success = ssh.UnlockComponent(ssh_unlock_code) If (success <> 1) Then WScript.Echo "error unlocking SSH with unlock code!" chillkat_establish_ssh_tunnel = 0 Exit Function End If WScript.Echo "Connecting through: " & throughhost & ":" & throughport success = ssh.Connect(throughhost,throughport) If (success <> 1) Then WScript.Echo " Error connecting to SSH through host in test: " & ssh.LastErrorText chillkat_establish_ssh_tunnel = 0 Exit Function End If ' Wait a max of 5 seconds when reading responses.. ssh.IdleTimeoutMs = 5000 success = ssh.AuthenticatePw(throughuser,throughpass) If (success <> 1) Then WScript.Echo " Error authenticating to SSH for ""through host"" in test: " & ssh.LastErrorText chillkat_establish_ssh_tunnel = 0 Exit Function End If ssh.Disconnect Err.Clear WScript.Echo " Tested Tunnel parameters!" sshTunnel.DestHostname = desthost sshTunnel.DestPort = destport sshTunnel.SshHostname = throughhost sshTunnel.SshPort = throughport sshTunnel.SshLogin = throughuser sshTunnel.SshPassword = throughpass success = sshTunnel.BeginAccepting(locallistenport) If (success <> 1) Then WScript.Echo " ERROR WHILE TRYING TO START ACCEPTING: " WScript.Echo sshTunnel.LastErrorText chillkat_establish_ssh_tunnel = 0 Exit Function End If chillkat_establish_ssh_tunnel = 1 End Function
With the flaw you are suggesting, the tunneling wouldn't work using 126.96.36.199.
While I do use SSH at the start (to test the credentials), you should notice that I switch over to the sshTunnel object which is a fully qualified 9.50 sshTunnel object. I'll be happy to give you the script in it's entirety, if you wish.. I just didn't want to overload the forum with the whole thing...
Here's the appropriate part of the function that creates the ssh object then closes it.. and moves on to the ssh tunnel object.
WScript.Echo " Tested Tunnel parameters!"
sshTunnel.DestHostname = desthost
sshTunnel.DestPort = destport
sshTunnel.SshHostname = throughhost
sshTunnel.SshPort = throughport
sshTunnel.SshLogin = throughuser
sshTunnel.SshPassword = throughpass
success = sshTunnel.BeginAccepting(locallistenport)
Again.. This script totally works in 188.8.131.52... Did you change the functionality to require a Connect?
If you are suggesting I now NEED to use the connect function, I can.
HMMM... Score one for not looking at the newer release documentation. :(
Apologies for thinking there was a bug..
“Connect was Introduced in 184.108.40.206”
I'll just quietly slink back to my corner of the Internet, and fix my code. :)
answered Sep 03 '16 at 23:44
You're connecting using an Ssh object, which is not associated with the SshTunnel object in any way -- and therefore the connection is meaningless.
See this example: https://www.example-code.com/vbscript/sshTunnel_database.asp
The "Connect" call is on the SshTunnel object.
answered Sep 02 '16 at 10:46