Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import getpass
  3. import telnetlib
  4.  
  5. HOST = "your Ip-addr"
  6. #user = input("Enter your remote account: ")
  7. password = getpass.getpass()
  8.  
  9. tn = telnetlib.Telnet(HOST)
  10.  
  11. #tn.read_until(b'Username: ')
  12. #tn.write(user.encode('ascii') + b"\n")
  13. #if password:
  14. #    tn.read_until(b"Password: ")
  15. #    tn.write(password.encode('ascii') + b"\n")
  16.  
  17. tn.set_debuglevel(1000)
  18.  
  19. tn.write(b"disp ver\n")
  20.  
  21. file = open ('versionlog.txt', 'w')
  22. file.write(str(tn.read_all().decode('ascii')))
  23. file.close()
  24.  
  25.  
  26. tn.write ('logout\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement