#!/usr/bin/python #coding: utf-8
import paramiko #iphosts=["192.168.10.70","192.168.10.71","192.168.10.72","192.168.10.73","192.168.10.74","192.168.10.75","192.168.10.76","192.168.11.50","192.168.11.40","192.168.11.41","192.168.11.42","192.168.11.43","192.168.11.44","192.168.11.45","192.168.11.48","192.168.11.49"] #usernames=["hsap","w4rfi","root"] #ports=["22","1083"] #passwords=["rteferw","wfwrgrvsf","teet4g","eegteert","fvdgbbdfdt","bbdgbgfg"] ip = ['192.168.221.206','192.168.221.205'] port = [22,21] username = ['root','username'] password = ['rete','werwt','520157000'] def connection(ip,port,username,password): ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(i,o,p,q) stdin, stdout, stderr = ssh.exec_command('hostname') print stdout.read() ssh.close()
if name == 'main':
connection(ip,port,username,password)
count = 0
for i in ip:
for o in port:
for p in username:
for q in password:
print i
print o
print p
print q
try:
connection(i,o,p,q)
count += 1
print "wwwwwwwwwwwwwwww %s"%count
except Exception as a:
print a
count += 1
print count