Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-11-2020, 08:33 PM
GODWIN1989 GODWIN1989 is offline
Registered User
 
Join Date: Feb 2020
Posts: 2
Python Loop failed for device login in Secure CRT

Hi,
I have below code to read list devices name from text file and list of password(RSA keys) from another text file. However the code gets executed only for first time and not looping through. Not sure if I am missing something in 'WaitFor' function.

Code:
# $language = "python"
# $interface = "1.0"

x=open(r"C:\Users\god\Desktop\device.txt","r")
y=open(r"C:\Users\god\Desktop\pass.txt","r+").readlines()
z=''
a=0
for i in x:
    z=y[a]
    crt.Screen.Send("ssh %s" %(i))
    crt.Screen.WaitForString("word:")
    crt.Screen.Send(z)
    crt.Screen.WaitForString("#")
    crt.Screen.Send("sh clock\n")
    crt.Screen.Send("exit\n")
    a+=1

Last edited by jdev; 02-12-2020 at 09:25 AM. Reason: wrap code in [code][/code] blocks for easier viewing
Reply With Quote
 

Tags
login , loop , python , secure crt


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 12:29 PM.