Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- try:
- # I figured out the range of IPs seeing the first and the last ones in my lab
- for i in range(***,***):
- ip=str(i)
- # This was my PC itself, hence the check :D
- if(ip!="***"):
- try:
- print '********'+ip
- ssh.connect('********'+ip, username='user',password='******')
- stdin, stdout, stderr = ssh.exec_command("reboot")
- except:
- print "ip not there"
- except:
- # The IP might not be available
- error=1
Add Comment
Please, Sign In to add comment