AutoIt kết nối SSH với ChilkatActiveX DLL

wormiit

Senior
Joined
Apr 1, 2014
Messages
587
Reactions
521
MR
3.128
Chat with me via Yahoo Messenger Follow me on Facebook
Demo tạo kết nối SSH với ChilkatSsh, chắc mọi người nghe tới Chilkat không lạ, nhưng trước giờ chỉ dùng được với C#
Nay mình hướng dẫn sử dụng Chilkat với AutoIt :)
Code:
;~ https://www.chilkatsoft.com/refdoc/xChilkatSshTunnelRef.html
;~ https://www.youtube.com/watch?v=5_iSdS05CKA
 
Global $SshHostname = "64.132.38.245"
Global $SshPort = 22, $SshListenPort = 1080
Global $SshUsername = "admin", $SshPassword = "default"
 
Global $oChilkat = ObjCreate("Chilkat_9_5_0.SshTunnel")
If Not IsObj($oChilkat) Then
    Run("regsvr32 /s ChilkatAx-9.5.0-win32.dll")
    Exit
EndIf
 
With $oChilkat
    .TcpNoDelay = 1
    .VerboseLogging = True
    ConsoleWrite(".UnlockComponent" & @CRLF)
    If Not .UnlockComponent('*** CÓ KEY') Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
 
    ConsoleWrite(".Connect" & @CRLF)
    If Not .Connect($SshHostname, $SshPort) Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
 
    ConsoleWrite(".AuthenticatePw" & @CRLF)
    If Not .AuthenticatePw($SshUsername, $SshPassword) Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
 
    ConsoleWrite(".DynamicPortForwarding" & @CRLF)
    .DynamicPortForwarding = 1
    If Not .LastMethodSuccess Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
 
    .InboundSocksVersion = 5
 
    ConsoleWrite(".IsSshConnected" & @CRLF)
    If Not .IsSshConnected Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
 
    ConsoleWrite(".BeginAccepting" & @CRLF)
    If Not .BeginAccepting($SshListenPort) Then
        ConsoleWrite(.LastErrorText & @CRLF)
        Exit
    EndIf
EndWith
 
While True
    Sleep(50)
WEnd




 

kegiaumat

Junior
Joined
Aug 4, 2013
Messages
271
Reactions
60
MR
0.009
Bác ơi em đang hoc C# qua project này nhưng làm mãi vẫn ko kết nối SSH được. Bác cho em đoạn code chạy phát nó kết nối được trong file fox cái. Em cảm ơn
 

Announcements

Today's birthdays

Forum statistics

Threads
425,070
Messages
7,151,268
Members
177,618
Latest member
movie4kone

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom