Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #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
  #2  
Old 08-13-2015, 08:07 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
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?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
Reply

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 06:07 PM.