diff --git a/dnsleases b/dnsleases index f4301a8..502dc01 100755 --- a/dnsleases +++ b/dnsleases @@ -1,6 +1,7 @@ #!/bin/python3 # import subprocess +import sys import time class host(object): @@ -87,7 +88,22 @@ with open('/var/lib/misc/dnsmasq.leases', 'r') as fh: if h.mac not in hl: hl.append(h) -for vlan in [20, 30, 40, 50, 60, 90]: - print("Hosts in VLAN %d" % vlan) + + +VLANs = { + 20: "Network Devices - Switch, AP, ...", + 30: "Private VLAN", + 40: "Smarthome with Internet", + 50: "Smarthome no Internet", + 60: "Guest VLAN", +} + +try: + PRINT_LIST = [int(sys.argv[1]), ] +except (IndexError, ValueError) as e: + PRINT_LIST = VLANs.keys() + +for vlan in PRINT_LIST: + print(f"Hosts in VLAN {vlan} - {VLANs.get(vlan, 'Unknown')}") print(hl.vlan_list(vlan)) print()