Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.exec_command('/apps./tempo.sh' 2016 10 01 02 03))
- import sys
- client.exec_command('/apps./tempo.sh', str(sys.argv))
- client.exec_command('/apps./tempo.sh %s' % str(sys.argv))
- import paramiko
- ssh_client = paramiko.SSHClient()
- ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh_client.connect(server, username=user,password=password)
- ...
- ssh_client.close()
- chan=ssh_client.invoke_shell()
- chan.send('PS1="python-ssh:"n')
- def exec_command(cmd):
- """Gets ssh command(s), execute them, and returns the output"""
- prompt='python-ssh:' # the command line prompt in the ssh terminal
- buff=''
- chan.send(str(cmd)+'n')
- while not chan.recv_ready():
- time.sleep(1)
- while not buff.endswith(prompt):
- buff+=ssh_client.chan.recv(1024)
- return buff[:len(prompt)]
- import sys
- command = '/apps./tempo.sh'
- args = ' '.join(sys.argv[1:]) # all args except the script's name!
- client.exec_command('{} {}'.format(command, args))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement