Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def runBlockingCommands(*someCommands):
- global testid, const_sshhost, const_sshuser, const_sshpass, const_prompt
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(const_sshhost, username= const_sshuser, password= const_sshpass)
- chan = ssh.invoke_shell()
- for i in someCommands:
- buff = ''
- chan.send(i)
- chan.send('\n')
- logCustom('SSH WAIT COMMAND SENT', i)
- while not buff.endswith(const_prompt):
- resp = chan.recv(9999)
- buff += resp
- logCustom('SSH WAIT RESPONSE RECEIVED', i)
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement