Advertisement
Guest User

Untitled

a guest
Mar 12th, 2017
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #! /usr/bin/python
  2.  
  3. import getpass
  4. import sys
  5. import telnetlib
  6.  
  7. if len(sys.argv) < 2:
  8. print "Example: macfilter.py 00:00:00:00:00:00 [option]"
  9. print "--add (default option)"
  10. print "--remove"
  11. sys.exit(0)
  12.  
  13. HOST = "IP DEL ROUTER"
  14. user = "USUARIO DEL ROUTER"
  15. password = "CONTRASEÑA DEL ROUTER"
  16.  
  17. MAC = sys.argv[1]
  18. ORDER = "--add"
  19. if len(sys.argv) > 2:
  20. if sys.argv[2] == '--remove':
  21. ORDER = '--remove'
  22.  
  23. tn = telnetlib.Telnet(HOST)
  24.  
  25. tn.read_until("Login: ")
  26. tn.write(user + "\n")
  27. if password:
  28. tn.read_until("Password: ")
  29. tn.write(password + "\n")
  30.  
  31. tn.write("wlan macfilter --mode deny\n")
  32. if len(ORDER)>2:
  33. tn.write("wlan macfilter " + ORDER + " " + MAC.lower() +"\n")
  34. else:
  35. tn.write("wlan macfilter --add " + MAC.lower() +"\n")
  36. print "wlan macfilter --add " + MAC.lower() +"\n"
  37. tn.write("exit\n")
  38.  
  39. print tn.read_all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement