import telnetlib
for i in range(1,256):
host = 'xyz.xyz.xyz.' + str(i)
user = 'user'.encode('ascii')
password = 'pass'.encode('ascii')
try:
tn = telnetlib.Telnet(host, port=23)
tn.read_until(b'Username: ')
tn.write(user + b'\n')
tn.read_until(b'Password: ')
tn.write(password + b'\n')
tn.write(b'conf t' + b'\n')
tn.write(b'access-list zz permit xyz.xyz.xyz.xyz' + b'\n')
tn.write(b'exit' + b'\n')
tn.write(b'write memory' +b'\n')
tn.write(b'exit' + b'\n')
tn.read_all()
print('Done for ' + host)
except:
print('Not exists ' + host)

مشخصات

آخرین ارسال ها

آخرین جستجو ها