ufdirty.blogg.se

Xojo instr
Xojo instr





xojo instr

Tunnel.RemotePort = 3306 // avoid timeing out in Socket and SSH layers Print "No supported authentication methods found!" Return 3 end if // here we are authorized //* Open tunnel */ dim tunnel as new SSH2TunnelMBS(session) Print "Authentication by public key succeeded." end if else Print "Authentication by public key failed!" Return 4 else Session.UserAuthPublicKeyFromFile(username, keyfile1, keyfile2, password) Print "Authentication by keyboard-interactive succeeded." end if //* Or by public key */ elseif authPublickey then Print "Authentication by keyboard-interactive failed!" return 10 else Session.UserAuthKeyboardInteractive username Print "Authentication by password failed!" Return 1 end if elseif authKeyboardInteractive then //* Or via keyboard-interactive */ Print "Authentication by password succeeded." else // failed Session.UserAuthPassword(username, password) If instr(userauthlist, "password")> 0 thenĪuthPassword = true end if if instr(userauthlist, "keyboard-interactive")> 0 thenĪuthKeyboardInteractive = true end if if instr(userauthlist, "publickey")> 0 thenĪuthPublickey = true end if if authPassword then //* We could authenticate via password */ Print "Authentication methods: "+ userauthlist * check what authentication methods are available */ dim userauthlist as string = session.UserAuthList(username)ĭim authPassword as Boolean = false dim authKeyboardInteractive as Boolean = false dim authPublickey as Boolean = false Print "Fingerprint: "+EncodeHex(fingerprint) The first thing to do is check //* the hostkey's fingerprint against our known hosts Your app may have it //* hard coded, may go to a file, may present it to the user, that's your //* call dim fingerprint as string = session.HostKeyHash(session.kHostKeyHashSHA1) Print "Failure establishing SSH session" Return 9 end if //* At this point we havn't authenticated. Print "Failed to connect socket!" Return 1 end if This will trade welcome //* banners, exchange keys, and setup crypto, compression, and MAC layers dim session as new MySSH2SessionMBS(hostAddr, 22) * Create a session instance and start it up. EventHandler Function Run(args() as String) As Integer const Address = "1.2.3.4" const username = "xxx" const password = "xxx" const keyfile1 = "" const keyfile2 = "" dim hostAddr as string = (Address)







Xojo instr