forked from calmh/unifi-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unifi-disconnect-client
executable file
·25 lines (19 loc) · 1.13 KB
/
unifi-disconnect-client
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
import argparse
from unifi.controller import Controller
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--controller', default='unifi', help='the controller address (default "unifi")')
parser.add_argument('-u', '--username', default='admin', help='the controller username (default("admin")')
parser.add_argument('-p', '--password', default='', help='the controller password')
parser.add_argument('-b', '--port', default='8443', help='the controller port (default "8443")')
parser.add_argument('-v', '--version', default='v2', help='the controller base version (default "v2")')
parser.add_argument('-s', '--siteid', default='default', help='the site ID, UniFi >=3.x only (default "default")')
parser.add_argument('-d', '--debug', help='enable debug output', action='store_true')
parser.add_argument('macs', metavar='MAC', nargs='+', help='Client MAC address(es)')
args = parser.parse_args()
if args.debug:
import logging
logging.basicConfig(level=logging.DEBUG)
c = Controller(args.controller, args.username, args.password, args.port, args.version, args.siteid)
for mac in args.macs:
c.disconnect_client(mac)