Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- import sys
- import time
- def send_string_and_wait(command, wait_time, should_print):
- shell.send(command)
- time.sleep(wait_time)
- receive_buffer = shell.recv(1024)
- if should_print:
- return receive_buffer
- dbname='test'
- cl='testdb'
- host='testhost'
- owner='maknoorn'
- passwd='p'
- client = paramiko.SSHClient()
- client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- client.connect(str(host), username=str(owner), password=str(passwd), port=22)
- shell = client.invoke_shell()
- send_string_and_wait("sudo su - oraclen", 1, True)
- send_string_and_wait(str(passwd) + "n", 1, True)
- a=send_string_and_wait("sh /orashare/ettool/Validation_Final.sh" + str(' ') + str(dbname) + str(' ') + str(cl) + "n", 0, True)
- print a
- client.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement