Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- import getpass
- import sys
- import telnetlib
- if len(sys.argv) < 2:
- print "Example: macfilter.py 00:00:00:00:00:00 [option]"
- print "--add (default option)"
- print "--remove"
- sys.exit(0)
- HOST = "IP DEL ROUTER"
- user = "USUARIO DEL ROUTER"
- password = "CONTRASEÑA DEL ROUTER"
- MAC = sys.argv[1]
- ORDER = "--add"
- if len(sys.argv) > 2:
- if sys.argv[2] == '--remove':
- ORDER = '--remove'
- tn = telnetlib.Telnet(HOST)
- tn.read_until("Login: ")
- tn.write(user + "\n")
- if password:
- tn.read_until("Password: ")
- tn.write(password + "\n")
- tn.write("wlan macfilter --mode deny\n")
- if len(ORDER)>2:
- tn.write("wlan macfilter " + ORDER + " " + MAC.lower() +"\n")
- else:
- tn.write("wlan macfilter --add " + MAC.lower() +"\n")
- print "wlan macfilter --add " + MAC.lower() +"\n"
- tn.write("exit\n")
- print tn.read_all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement