Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Get SSH Server Authentication MethodsDemonstrates how to get the authentication methods of an SSH server. This example requires Chilkat v9.5.0.78 or greater.
integer li_rc oleobject loo_Ssh integer li_Success string ls_AuthMethods integer li_Success // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Ssh = create oleobject // Use "Chilkat_9_5_0.Ssh" for versions of Chilkat < 10.0.0 li_rc = loo_Ssh.ConnectToNewObject("Chilkat.Ssh") if li_rc < 0 then destroy loo_Ssh MessageBox("Error","Connecting to COM object failed") return end if // To get the authentication methods offered by an SSH server, we first connect. li_Success = loo_Ssh.Connect("example.com",22) if li_Success <> 1 then Write-Debug loo_Ssh.LastErrorText destroy loo_Ssh return end if // Next, we call GetAuthMethods to receive a comma separated list of authentication methods ls_AuthMethods = loo_Ssh.GetAuthMethods() if loo_Ssh.LastMethodSuccess <> 1 then Write-Debug loo_Ssh.LastErrorText destroy loo_Ssh return end if // For example: publickey,password,keyboard-interactive Write-Debug "Authentication methods suported by this serve: " + ls_AuthMethods // IMPORTANT: // Getting the authentication methods will intentionally disconnect from the server. // We'll need to re-connect, etc. to continue.. // For example.. li_Success = loo_Ssh.Connect("example.com",22) if li_Success <> 1 then Write-Debug loo_Ssh.LastErrorText destroy loo_Ssh return end if li_Success = loo_Ssh.AuthenticatePw("myLogin","myPassword") if li_Success <> 1 then Write-Debug loo_Ssh.LastErrorText destroy loo_Ssh return end if Write-Debug "SSH Authentication successful." // ... loo_Ssh.Disconnect() destroy loo_Ssh |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.