Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. with open('servers') as myfile:
  2. filas = sum(1 for line in myfile)
  3.  
  4.  
  5. print filas
  6. f=open('servers','r')
  7. for contenido in f:
  8. mySSHK = '/home/jose/.ssh/id_rsa.pub'
  9. ssh = paramiko.SSHClient()
  10. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  11. i=1
  12. while i < filas:
  13. servidores= '"' + contenido + '"'
  14. print servidores
  15. #ssh.connect(servidores,username='root',key_filename=mySSHK)
  16. #NO WORKssh.connect('127.0.0.1',username='jose',password='Hola.1234')
  17. #stdin,stdout,stderr=ssh.exec_command('cat /etc/issue')
  18. #valorissue = stdout.read()
  19. #print "\033[95m" + valorissue
  20. #stdin,stdout,stderr=ssh.exec_command('chage -l root | grep -i expire | head -1')
  21. #valoruname = stdout.read()
  22. #print "\033[92m" + valoruname
  23. #print bcolors.ENDC
  24. i=i+1
  25. ssh.close()
  26. ~
  27. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement