Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_onuid(ip, login, password, enpassword, ifolt):
- try:
- tn = telnetlib.Telnet(ip)
- tn.read_until('name:', timeout)
- tn.write(login + '\r')
- tn.read_until('assword:', timeout)
- tn.write(password + '\r')
- if tn.expect(['>'], 30)[0] == -1:
- print 'ERROR LOGIN'
- #logger.error('CAN NOT CONNECT TO DEVICE ' + ip + ' , STOP SCRIPT')
- tn.write('enable' + '\r')
- tn.read_until('assword:', timeout)
- tn.write(enpassword + '\r')
- tn.read_until('#', timeout)
- print 'LOGIN OK'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement