Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- servers = [
- '10.4.10.6',
- '10.4.20.6',
- '10.4.30.6',
- '10.4.40.6',
- '10.4.50.6',
- '10.4.60.6',
- '10.4.70.6',
- '10.4.80.6'
- ]
- def run(user="username", password="ilehcwio43", ip=""):
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- ssh.connect(ip, username=user, password=password, timeout=10)
- print "Connected to : ", ip
- ssh.close()
- except Exception as e:
- print "Failed to : ", ip, "reason: ", e
- for host in servers:
- run(ip=host)
- print "Completed"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement