Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- import getpass
- import re
- IP = 'xx.xx.xx.xx'
- USER = 'xxx'
- PASSWORD = 'xxx.
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- def initiatessh():
- ssh.connect( IP, username=USER, password=PASSWORD)
- def grabsshdata():
- stdin, stdout, stderr = ssh.exec_command('pwd', timeout=60)
- print('command executed')
- data = re.sub(r'\s+', '\n', str(stdout.read(), 'UTF-8')).splitlines()
- list = [line for line in data if line != '\n']
- print('printing')
- print(list)
- print('connection')
- initiatessh()
- print('established')
- print('grabbing data')
- grabsshdata()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement