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 09-22-2018, 03:18 AM
jeyro jeyro is offline
Registered User
 
Join Date: Sep 2018
Posts: 2
Run multiple scripts to SecureCRT

Hello,

I have a concept in my mind but I don't know if is it possible or if I think wrong.

I want to execute a python script from my computer. Theses steps :
- Choice (OK)
- Check connectivity (OK)
- Open a new session from secureCRT + send commands to the CLI (OK)
- Execute another independent script to send commands to the CLI (!)

I call my first script with subprocess.popen... but how can I run another script to this active session from my main script ?

Thanks for your reply
Reply With Quote
  #2  
Old 09-22-2018, 11:19 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi jeyro,

To the best of my knowledge, there presently is not a way to run one script from another in SecureCRT.

I have added this thread to a feature request in our product enhancement database to add the ability to run multiple scripts in succession (call one script from another). Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, send an email to support@vandyke.com and include "Feature Request - Forum Thread #13256" in the subject line or use this form from the support page of our website.

Quote:
  1. Choice (OK)
  2. Check connectivity (OK)
  3. Open a new session from secureCRT + send commands to the CLI (OK)
  4. Execute another independent script to send commands to the CLI (!)
The way you wrote the requirements though, to me at least makes it sound like one script handles bullet points 1, 2 and 3. And then another script will accomplish step 4. So if it's a completely independent script, you could just run it from SecureCRT's Script menu, right? It does not need called from another script necessarily ...

Or does it depend on the CLI operations from step 3?

You may find this post/example scripts useful.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 09-24-2018, 06:21 AM
jeyro jeyro is offline
Registered User
 
Join Date: Sep 2018
Posts: 2
I will try to explain me. I have a main script called DDI_ALL.py. In this one, there is :

Step 2 :
Code:
#Connexion test
ping_serveur = -1
ping_serveur = os.system("ping " + serveur_selected)
Step 3 (DDI_ALL.py calls DDI_connection_cli.py) :
Code:
#Launch SecureCRT
username1=os.getenv('username')
SecureCRTpath = 'C:\\Users\\'+str(username1)+'\\AppData\\Local\\VanDyke Software\\SecureCRT\\SecureCRT.exe'
Scriptpath = 'C:\\Users\\'+str(username1)+'\\Documents\\PROJET\\SCRIPT\\PREPROD\\DDI_connection_cli.py'
print(Scriptpath)

#Connexion CLI
subprocess.Popen(['C:\\Users\\XXXXXX\\AppData\\Local\\VanDyke Software\\SecureCRT\\SecureCRT.exe', '/SCRIPT', 'C:\\Users\\XXXXXX\\Documents\\PROJET\\SCRIPT\\PREPROD\\DDI_connection_cli.py'])
- DDI_connection_cli.py contains :
Code:
cmd = "/SSH2 /L %s /PASSWORD %s /C AES-128-CTR /M SHA2-256 /AUTH password,keyboard-interactive,gssapi %s" % (user, passwd, host)
Step 4 (ex: DDI_ALL.py calls DDI_cmd_check.py): I want to call another script (from DDI_ALL.py) to execute in the active session from SecrueCRT to run others commands like (date, hostname, top, etc...), then log them. I try with the subprocess.Popen but it open a new process :/

Step 5 (ex: DDI_ALL.py calls DDI_parsing_check.py): It will be a parsing from the log file to conclude.

I hope I'm clear (:
Reply With Quote
  #4  
Old 09-24-2018, 08:12 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi jeyro,

That scenario falls under the "not possible now, feature request" response.
__________________
Thanks,
--Brenda

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

Tags
python , run , script , securecrt , session

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 02:54 AM.