VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Python: Keyboard Interactive Authentication prompt when password already provided. (https://forums.vandyke.com/showthread.php?t=12069)

Packet-Runner 08-13-2015 05:46 AM

Python: Keyboard Interactive Authentication prompt when password already provided.
 
Hi All,

I'm trying to connect to multiple hosts via SSH loaded from a text file after specifying a password. The SSH connection string is built successfully with the password I eneter, but I still seem to be getting a Keyboard Interactive Authentication prompt for each device. How can I alter the code below so it just connects with the password I provide to every device?

Script:

Code:

import os

def main():
    # Obtain currently logged on ID from the OS.
    uID = os.getenv('USERNAME')
   
    # Prompt for password.
    passWd = crt.Dialog.Prompt("Please enter your password:", "Login", "", True)
   
    # Obtain source hosts text file.
    fileName = crt.Dialog.FileOpenDialog(title="Please select a text file.", filter="Text Files (*.txt)|*.txt||")
    f=open(fileName, 'r')
   
    # Validation: Check password isn't empty.
    if passWd == "":
      youShallNotPass = crt.Dialog.MessageBox("Enter a valid password" ["Please try again."])
    else:
      # Build a command-line string to pass to the Connect method.
      for line in f:
        host = line
        cmd = "/SSH2 /L %s /PASSWORD %s /C 3DES /M MD5 %s" % (uID, passWd, str(host.strip()))
        myTab = crt.Session.ConnectInTab(cmd)
      return

main()

Input text file contents:

192.168.1.10
192.168.1.11
192.168.1.12

Prompt:

http://tinypic.com?ref=w0543p" targe..." alt="Image">

rtb 08-13-2015 08:07 AM

Hi Packet-Runner,

Thanks for the post.

What version of SecureCRT are you using?

If the remote requires keyboard-interactive authentication, you may be able to solve the issue by adding "/AUTH keyboard-interactive" to the command that you build.

Does this help?


All times are GMT -6. The time now is 09:36 AM.