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: