Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import paramiko
  2.  
  3. servers = [
  4. '10.4.10.6',
  5. '10.4.20.6',
  6. '10.4.30.6',
  7. '10.4.40.6',
  8. '10.4.50.6',
  9. '10.4.60.6',
  10. '10.4.70.6',
  11. '10.4.80.6'
  12. ]
  13.  
  14. def run(user="username", password="ilehcwio43", ip=""):
  15. ssh = paramiko.SSHClient()
  16. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  17. try:
  18. ssh.connect(ip, username=user, password=password, timeout=10)
  19. print "Connected to : ", ip
  20. ssh.close()
  21. except Exception as e:
  22. print "Failed to : ", ip, "reason: ", e
  23.  
  24. for host in servers:
  25. run(ip=host)
  26.  
  27. print "Completed"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement