Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with open('servers') as myfile:
- filas = sum(1 for line in myfile)
- print filas
- f=open('servers','r')
- for contenido in f:
- mySSHK = '/home/jose/.ssh/id_rsa.pub'
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- i=1
- while i < filas:
- servidores= '"' + contenido + '"'
- print servidores
- #ssh.connect(servidores,username='root',key_filename=mySSHK)
- #NO WORKssh.connect('127.0.0.1',username='jose',password='Hola.1234')
- #stdin,stdout,stderr=ssh.exec_command('cat /etc/issue')
- #valorissue = stdout.read()
- #print "\033[95m" + valorissue
- #stdin,stdout,stderr=ssh.exec_command('chage -l root | grep -i expire | head -1')
- #valoruname = stdout.read()
- #print "\033[92m" + valoruname
- #print bcolors.ENDC
- i=i+1
- ssh.close()
- ~
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement