mirror of
https://github.com/notherealmarco/SLAACsense.git
synced 2025-05-05 20:32:34 +02:00
Add flag to ignore link local addresses
This commit is contained in:
parent
e405fdac2b
commit
0c691f1f54
1 changed files with 3 additions and 0 deletions
3
main.py
3
main.py
|
@ -13,6 +13,7 @@ TECHNITIUM_URL = os.getenv("TECHNITIUM_URL", None)
|
||||||
TECHNITIUM_TOKEN = os.getenv("TECHNITIUM_TOKEN", None)
|
TECHNITIUM_TOKEN = os.getenv("TECHNITIUM_TOKEN", None)
|
||||||
DNS_ZONE_SUBNETS = os.getenv("DNS_ZONE_SUBNETS", None)
|
DNS_ZONE_SUBNETS = os.getenv("DNS_ZONE_SUBNETS", None)
|
||||||
DO_V4 = (os.getenv("DO_V4", "false").lower() == "true")
|
DO_V4 = (os.getenv("DO_V4", "false").lower() == "true")
|
||||||
|
IGNORE_LINK_LOCAL = (os.getenv("IGNORE_LINK_LOCAL", "true").lower() == "true")
|
||||||
VERIFY_HTTPS = (os.getenv("VERIFY_HTTPS", "true").lower() == "true")
|
VERIFY_HTTPS = (os.getenv("VERIFY_HTTPS", "true").lower() == "true")
|
||||||
CLOCK = int(os.getenv("CLOCK", "30"))
|
CLOCK = int(os.getenv("CLOCK", "30"))
|
||||||
|
|
||||||
|
@ -33,6 +34,8 @@ def build_matches(ndp, leases):
|
||||||
matches = set()
|
matches = set()
|
||||||
for e in leases["rows"]:
|
for e in leases["rows"]:
|
||||||
ip6s = tuple(x["ip"].split("%")[0] for x in ndp["rows"] if x["mac"] == e["mac"])
|
ip6s = tuple(x["ip"].split("%")[0] for x in ndp["rows"] if x["mac"] == e["mac"])
|
||||||
|
if IGNORE_LINK_LOCAL:
|
||||||
|
ip6s = tuple(ip for ip in ip6s if not ipaddress.ip_address(ip).is_link_local)
|
||||||
if len(ip6s) == 0 and not DO_V4:
|
if len(ip6s) == 0 and not DO_V4:
|
||||||
continue
|
continue
|
||||||
matches.add((e["address"], ip6s, e["hostname"]))
|
matches.add((e["address"], ip6s, e["hostname"]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue