Advertisement
Guest User

Untitled

a guest
Apr 8th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. 1461 7950 001f.ce5d.cb4d Gi0/0/1.10 1 Vi2.504 PTA
  2. 1441 36472 dc9f.db01.c6cb Gi0/0/1.10 1 Vi2.502 PTA
  3. 1370 7922 c83a.350d.f368 Gi0/0/1.10 1 Vi2.467 PTA
  4. 768 7910 c46e.1f7a.4763 Gi0/0/1.10 1 Vi2.451 PTA
  5. 1539 7614 dc9f.db01.c6e8 Gi0/0/1.10 1 Vi2.19 PTA
  6.  
  7. import telnetlib
  8.  
  9. HOST = '192.168.1.1'
  10. password = "veryverysecure_password"
  11. user = "veryveryandroid"
  12.  
  13. tn = telnetlib.Telnet(HOST)
  14. tn.read_until(b"Username: ")
  15. tn.write(user.encode('ascii') + b"n")
  16. tn.read_until(b"Password: ")
  17. tn.write(password.encode('ascii') + b"n")
  18. tn.write(b"term len 0 n")
  19. tn.write(b"show pppoe session | exclude 7878.8787.6969 n")
  20.  
  21. tn.write(b"n exitn")
  22.  
  23. mystring = tn.read_all().decode('ascii').replace('rn', 'n')
  24. #print(mystring)
  25. temp_list = mystring.splitlines()
  26. #print(temp_list)
  27. sub = 'PTA'
  28. sub2 = 'Vi2'
  29. print ("n".join(s for s in temp_list if sub in s and sub2 in s))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement