From 591080c395c85354e3b12e8a0511dbe128eeea96 Mon Sep 17 00:00:00 2001 From: Andy Teijelo Date: Tue, 5 Jul 2016 12:23:34 -0400 Subject: [PATCH] Accept either : or - as mac separator --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9dc664c..fe73ba1 100755 --- a/main.py +++ b/main.py @@ -219,7 +219,7 @@ def list_users(): lines = render_users_tree(tree) return render_template("users.html", users=lines) -mac_re = re.compile("(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}") +mac_re = re.compile("(?:[0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}") ip_re_str = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" ip_re = re.compile(ip_re_str) DhcpHostLine = namedtuple("DhcpHostLine","macs ip tag") @@ -324,7 +324,7 @@ def parse_macs(macs): p = p.strip() m = mac_re.match(p) if m: - r.append(m.group(0)) + r.append(m.group(0).replace("-",":")) return r def rename(src, dst):