From 6d452fc1495120e7767572535c387fc6223b4e53 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Sat, 6 Sep 2014 13:48:03 +0200 Subject: [PATCH] d3json: obscure client MACs --- ffmap/outputs/d3json.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ffmap/outputs/d3json.py b/ffmap/outputs/d3json.py index 06e82fb..31f03a6 100644 --- a/ffmap/outputs/d3json.py +++ b/ffmap/outputs/d3json.py @@ -50,26 +50,27 @@ class Output: "type": "vpn" if neighbor["neighbor"]["vpn"] or node["vpn"] else None, "id": "-".join((node.id, neighbor["neighbor"].id)), } + clientcount = 0 for client in node.get("clients", []): - if not client in indexes: - nodes.append({ - "id": client, - "flags": { - "client": True, - "online": True, - "gateway": False - } - }) - indexes[client] = count - count += 1 + nodes.append({ + "id": "%s-%s" % (node.id, clientcount), + "flags": { + "client": True, + "online": True, + "gateway": False + } + }) + indexes[client] = count links[(node.id, client)] = { "source": indexes[node.id], "target": indexes[client], "quality": "TT", "type": "client", - "id": "-".join((node.id, client)), + "id": "%s-%i" % (node.id, clientcount), } + count += 1 + clientcount += 1 return { "nodes": nodes,