From aabaabc67a6705dbc388084f0d98fd3bc29dcd5d Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Apr 2012 23:05:50 +0200 Subject: [PATCH 1/2] Update aliases --- aliases.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aliases.json b/aliases.json index 033f0c0..001b359 100644 --- a/aliases.json +++ b/aliases.json @@ -2,7 +2,7 @@ "04:11:6b:98:08:21" : { "name" : "sellars" }, - "da:7b:6f:c1:63:d2" : { + "00:25:86:e6:f1:bf" : { "name" : "krtek" }, "b0:48:7a:e7:d3:64" : { @@ -12,8 +12,7 @@ "name" : "holstentor" }, "56:47:05:ab:00:2b" : { - "name" : "aftermath", - "group" : 1 + "name" : "aftermath" }, "ca:96:05:3c:54:f9" : { "name" : "prometheus" @@ -35,5 +34,8 @@ }, "ca:a8:ca:2d:c8:b2" : { "name" : "prometheus" + }, + "fa:d1:11:80:41:d4" : { + "name" : "confusion" } } From cd7b9cf2350254ffb38c56014108a63f3b42ae3a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 28 Apr 2012 23:06:34 +0200 Subject: [PATCH 2/2] Make script Python3 compatible --- bat2nodes.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/bat2nodes.py b/bat2nodes.py index 6627f2d..5a607de 100644 --- a/bat2nodes.py +++ b/bat2nodes.py @@ -4,7 +4,7 @@ # Gatewayliste # aliases.json -import simplejson as json +import json import fileinput import argparse @@ -128,12 +128,13 @@ if options['aliases']: if 'group' in alias: node.group = alias['group'] -for gateway in options['gateway']: - try: - node = maybe_node_by_mac(nodes, (gateway, )) - node.group = 2 - except: - continue +if options['gateway']: + for gateway in options['gateway']: + try: + node = maybe_node_by_mac(nodes, (gateway, )) + node.group = 2 + except: + continue def map_link(nodes, pair): distance = 80 @@ -149,16 +150,16 @@ def map_link(nodes, pair): return link -links = map(lambda x: map_link(nodes, x), links) +links = [map_link(nodes, x) for x in links] output = dict() -output['nodes'] = map(lambda x: {'group': x.group, 'name': x.name, - 'macs': ', '.join(x.macs) - }, nodes) -output['links'] = map(lambda x: {'source': x.pair[0], 'target': x.pair[1], - 'distance': x.distance, - 'strength': x.strength - }, links) +output['nodes'] = [{'group': x.group, 'name': x.name, + 'macs': ', '.join(x.macs) + } for x in nodes] +output['links'] = [{'source': x.pair[0], 'target': x.pair[1], + 'distance': x.distance, + 'strength': x.strength + } for x in links] -print json.dumps(output) +print(json.dumps(output))