summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen
diff options
context:
space:
mode:
Diffstat (limited to 'retiolum/scripts/adv_graphgen')
-rw-r--r--retiolum/scripts/adv_graphgen/DEPS2
-rwxr-xr-xretiolum/scripts/adv_graphgen/anonytize.sh3
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_anon.py2
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py6
-rwxr-xr-xretiolum/scripts/adv_graphgen/sanitize.sh2
5 files changed, 10 insertions, 5 deletions
diff --git a/retiolum/scripts/adv_graphgen/DEPS b/retiolum/scripts/adv_graphgen/DEPS
new file mode 100644
index 00000000..f14c0aa6
--- /dev/null
+++ b/retiolum/scripts/adv_graphgen/DEPS
@@ -0,0 +1,2 @@
+graphviz
+imagemagick
diff --git a/retiolum/scripts/adv_graphgen/anonytize.sh b/retiolum/scripts/adv_graphgen/anonytize.sh
index 2e2045e4..4aad6993 100755
--- a/retiolum/scripts/adv_graphgen/anonytize.sh
+++ b/retiolum/scripts/adv_graphgen/anonytize.sh
@@ -10,7 +10,7 @@ TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp --suffix=anon`
-trap 'rm $DOTFILE' INT TERM KILL
+trap 'rm $DOTFILE' INT TERM KILL EXIT
sudo -E python tinc_stats2json |\
python parse_tinc_anon.py> $DOTFILE
@@ -28,4 +28,3 @@ convert $1/retiolum_1.$TYPE $1/retiolum_1.$TYPE2
#convert -resize 20% $1/retiolum_2.$TYPE $1/retiolum_2.$TYPE2
#convert -resize 20% $1/retiolum_3.$TYPE $1/retiolum_3.$TYPE2
#convert -resize 20% $1/retiolum_4.$TYPE $1/retiolum_4.$TYPE2
-rm $DOTFILE
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
index 21c36e0f..82ee2f2e 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py
@@ -52,11 +52,13 @@ def write_stat_node(nodes):
''' Write a `stats` node in the corner
This node contains infos about the current number of active nodes and connections inside the network
'''
+ from time import localtime,strftime
num_conns = 0
num_nodes = len(nodes)
for k,v in nodes.iteritems():
num_conns+= len(v['to'])
node_text = " stats_node [shape=box,label=\"Statistics\\l"
+ node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime())
node_text += "Active Nodes: %s\\l" % num_nodes
node_text += "Connections : %s\\l" % num_conns
node_text += "\""
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index e5bd96a8..e6a67e2c 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -54,6 +54,7 @@ def write_stat_node(nodes):
''' Write a `stats` node in the corner
This node contains infos about the current number of active nodes and connections inside the network
'''
+ from time import localtime,strftime
num_conns = 0
num_nodes = len(nodes)
try:
@@ -64,6 +65,7 @@ def write_stat_node(nodes):
for k,v in nodes.iteritems():
num_conns+= len(v['to'])
node_text = " stats_node [label=\"Statistics\\l"
+ node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime())
node_text += "Active Nodes: %s\\l" % num_nodes
node_text += "Connections : %s\\l" % num_conns
node_text += "\""
@@ -172,8 +174,8 @@ def write_node(k,v):
if v.has_key('num_conns'):
node += "Num Connects:"+str(v['num_conns'])+"\\l"
node += "external:"+v['external-ip']+":"+v['external-port']+"\\l"
- for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']):
- node += "internal:"+addr+"\\l"
+ for addr in v.get('internal-ip',['dunno lol']): #['¯\\\\(°_o)/¯']):
+ node += "internal:%s\\l"%addr
node +="\""
# warning if node only has one connection
diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh
index 846cc549..c8071dc3 100755
--- a/retiolum/scripts/adv_graphgen/sanitize.sh
+++ b/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -10,7 +10,7 @@ TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp --suffix=san`
-trap 'rm $DOTFILE' INT TERM KILL
+trap 'rm $DOTFILE' INT TERM KILL EXIT
sudo -E python tinc_stats2json |\
python parse_tinc_stats.py > $DOTFILE