Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-13-2015, 05:46 AM
Packet-Runner Packet-Runner is offline
Registered User
 
Join Date: Aug 2015
Posts: 1
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:

Reply With Quote
 

Tags
authentication , interactive , keyboard , python , script

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:58 AM.