View Single Post
  #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