Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-07-2019, 06:46 AM
vikram1840 vikram1840 is offline
Registered User
 
Join Date: May 2019
Posts: 13
Authentication Window reflecting during Autologin through Python Scripting

Hi Experts,
I tried to auto login secureCRT through python script because I have to schedule some task using this in which required no manual intervention.
But while I am trying to connect it after the connection one window pop-up which required manual intervention to close that window.
and This causing issue to auto login procedure.
So please suggest any solution for this.
I am unable to paste that window image which occurs after login secureCRT and that need manual intervention to close that window.
That pop window having -information like-ATTENTION:AUTHORIZED PERSON ONLY.

So can we ignore this window

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

def main():
 host = "x.x.x.x:xx"
 user_name = "xxx"
 password = "xxxx"
 session_name = "xxxx"
 cmd = "/SSH2 /L " + session_name + " /PASSWORD " + password + " " + host
 crt.Session.Connect(cmd)
  if crt.Session.Connected:
    crt.Screen.Synchronous = True
  row = crt.Screen.CurrentRow
  prompt = crt.Screen.Get(row, 0, row, crt.Screen.CurrentColumn - 1)
  prompt = prompt.strip()
  crt.Screen.Send("cd EM/EM_Vik\n")
  crt.Screen.WaitForString(prompt)
  crt.Screen.Send("./em.sh\n")
  crt.Screen.WaitForString(prompt)
  crt.Screen.Send("1\n")

main()
Reply With Quote
  #2  
Old 06-07-2019, 12:12 PM
jpellegrini jpellegrini is offline
Registered User
 
Join Date: Mar 2019
Posts: 20
Hi vikram1840,

I think it would be useful for you to enable the Session Option for "Display logon prompts in terminal window".

This options displays logon prompts in the terminal window, rather than as a dialog. This makes scripting easier as you can then just wait for the string of the prompt and then send a response.

To enable this option, launch the right click on the session in the Session Manager and select "Properties". Navigate to "Connection" > Logon Actions, and the last checkbox on this page is "Display logon prompts in terminal window".

You would then just need to do something like:

Code:
  crt.Screen.WaitForString("Prompt from dialog that is now in terminal window")
  crt.Screen.Send("Response")
Using this information, are you able to get things working as desired?
__________________
Thanks,
--Jon

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 06-07-2019, 07:09 PM
vikram1840 vikram1840 is offline
Registered User
 
Join Date: May 2019
Posts: 13
Authentication Window reflecting during Autologin through Python Scripting

Hello jpellegrini,

The Solution you provided worked.
Thank you so much.
Now I can auto schedule my task without any manual intervention.


Thanks for support.

Regards
Vikram
Reply With Quote
  #4  
Old 06-10-2019, 09:37 AM
jpellegrini jpellegrini is offline
Registered User
 
Join Date: Mar 2019
Posts: 20
Great! Glad to hear it.

Have a great week!
__________________
Thanks,
--Jon

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 03:15 AM.