Advertisement
Guest User

ChilkatAu3 - Connect Ssh with AutoIt via Chilkat ActiveX COM

a guest
Nov 5th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.39 KB | None | 0 0
  1. ;~ https://www.chilkatsoft.com/refdoc/xChilkatSshTunnelRef.html
  2. ;~ https://www.youtube.com/watch?v=5_iSdS05CKA
  3.  
  4. Global $SshHostname = "64.132.38.245"
  5. Global $SshPort = 22, $SshListenPort = 1080
  6. Global $SshUsername = "admin", $SshPassword = "default"
  7.  
  8. Global $oChilkat = ObjCreate("Chilkat_9_5_0.SshTunnel")
  9. If Not IsObj($oChilkat) Then
  10.     Run("regsvr32 /s ChilkatAx-9.5.0-win32.dll")
  11.     Exit
  12. EndIf
  13.  
  14. With $oChilkat
  15.     .TcpNoDelay = 1
  16.     .VerboseLogging = True
  17.     ConsoleWrite(".UnlockComponent" & @CRLF)
  18.     If Not .UnlockComponent('ĐÉO CÓ KEY') Then
  19.         ConsoleWrite(.LastErrorText & @CRLF)
  20.         Exit
  21.     EndIf
  22.  
  23.     ConsoleWrite(".Connect" & @CRLF)
  24.     If Not .Connect($SshHostname, $SshPort) Then
  25.         ConsoleWrite(.LastErrorText & @CRLF)
  26.         Exit
  27.     EndIf
  28.  
  29.     ConsoleWrite(".AuthenticatePw" & @CRLF)
  30.     If Not .AuthenticatePw($SshUsername, $SshPassword) Then
  31.         ConsoleWrite(.LastErrorText & @CRLF)
  32.         Exit
  33.     EndIf
  34.  
  35.     ConsoleWrite(".DynamicPortForwarding" & @CRLF)
  36.     .DynamicPortForwarding = 1
  37.     If Not .LastMethodSuccess Then
  38.         ConsoleWrite(.LastErrorText & @CRLF)
  39.         Exit
  40.     EndIf
  41.  
  42.     .InboundSocksVersion = 5
  43.  
  44.     ConsoleWrite(".IsSshConnected" & @CRLF)
  45.     If Not .IsSshConnected Then
  46.         ConsoleWrite(.LastErrorText & @CRLF)
  47.         Exit
  48.     EndIf
  49.  
  50.     ConsoleWrite(".BeginAccepting" & @CRLF)
  51.     If Not .BeginAccepting($SshListenPort) Then
  52.         ConsoleWrite(.LastErrorText & @CRLF)
  53.         Exit
  54.     EndIf
  55. EndWith
  56.  
  57. While True
  58.     Sleep(50)
  59. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement