Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def get_onuid(ip, login, password, enpassword, ifolt):
  2.     try:
  3.         tn = telnetlib.Telnet(ip)
  4.         tn.read_until('name:', timeout)
  5.         tn.write(login + '\r')
  6.         tn.read_until('assword:', timeout)
  7.         tn.write(password + '\r')
  8.         if tn.expect(['>'], 30)[0] == -1:
  9.             print 'ERROR LOGIN'
  10.             #logger.error('CAN NOT CONNECT TO DEVICE ' + ip + ' , STOP SCRIPT')
  11.         tn.write('enable' + '\r')
  12.         tn.read_until('assword:', timeout)
  13.         tn.write(enpassword + '\r')
  14.         tn.read_until('#', timeout)
  15.         print 'LOGIN OK'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement