Advertisement
Guest User

Untitled

a guest
Apr 8th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 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. 7614 DC:9F:DB:01:C6:CB Gi0/0/1.10
  8.  
  9. import telnetlib
  10.  
  11. HOST = '192.168.1.1'
  12. password = "veryverysecure_password"
  13. user = "veryveryandroid"
  14.  
  15. tn = telnetlib.Telnet(HOST)
  16. tn.read_until(b"Username: ")
  17. tn.write(user.encode('ascii') + b"n")
  18. tn.read_until(b"Password: ")
  19. tn.write(password.encode('ascii') + b"n")
  20. tn.write(b"term len 0 n")
  21. tn.write(b"show pppoe session | exclude 7878.8787.6969 n")
  22.  
  23. tn.write(b"n exitn")
  24.  
  25. mystring = tn.read_all().decode('ascii').replace('rn', 'n')
  26. #print(mystring)
  27. temp_list = mystring.splitlines()
  28. #print(temp_list)
  29. sub = 'PTA'
  30. sub2 = 'Vi2'
  31. 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