Quantcast
Channel: Chilkat Forum - latest questions
Viewing all articles
Browse latest Browse all 1061

SSH Tunnels (v9.5.0.58 v 9.5.0.48) & StartAccepting

$
0
0

Howdy,

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 9.5.0.58, it started throwing exceptions like this... (p.s. this looks like a bug in 9.5.0.58 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.

--->Tunnel will listen indefinitely <--- ---> Press Ctrl-C to shutdown the tunnel listener<---

192.168.0.133-rdp Found: 192.168.0.133-rdp 192.168.0.133:3389 on 22 Connecting through: xxx.xxx.xxx.xxx:22 Tested Tunnel parameters! ERROR WHILE TRYING TO START ACCEPTING: ChilkatLog: BeginAccepting: DllDate: Jun 13 2016 ChilkatVersion: 9.5.0.58 UnlockPrefix: CHANGEDFORPRIVACY Architecture: Little Endian; 64-bit Language: ActiveX / x64 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

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 9.5.0.48.

P.S. trying to make 9.5.0.58 32-bit DLL work, fails at same place.

  ERROR WHILE TRYING TO START ACCEPTING:
ChilkatLog:
  BeginAccepting:
    DllDate: Jun 13 2016
    ChilkatVersion: 9.5.0.58
    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 9.5.0.48 as I don't know where to download the x64 version from (only the current one [9.5.0.58] 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

Viewing all articles
Browse latest Browse all 1061

Trending Articles