HostsViz (script for converting multiple traceroutes to GraphViz format)
authorHarvie <tomas@mudrunka.cz>
Mon, 14 Nov 2011 19:58:35 +0000 (20:58 +0100)
committerHarvie <tomas@mudrunka.cz>
Mon, 14 Nov 2011 19:58:35 +0000 (20:58 +0100)
bash/hostsviz/.gitignore [new file with mode: 0644]
bash/hostsviz/hostsviz.sh [new file with mode: 0755]

diff --git a/bash/hostsviz/.gitignore b/bash/hostsviz/.gitignore
new file mode 100644 (file)
index 0000000..298ed1a
--- /dev/null
@@ -0,0 +1,7 @@
+*.dot
+*.jpg
+*.png
+*.pdf
+*.ps
+*.jpeg
+*.svg
diff --git a/bash/hostsviz/hostsviz.sh b/bash/hostsviz/hostsviz.sh
new file mode 100755 (executable)
index 0000000..bc9ad6c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+gen_line() {
+       echo -e '\t"'$(traceroute -q1 -w2 -z500 "$1" 2>/dev/null | cut -d ' ' -f-4 | grep -C 1 -o '[0-9a-zA-Z\.-\_]*' | grep -v '^[0-9]*$' | sed -e ':a;N;$!ba;s/\n/" -> "/g')'"' |
+               #grep -v '*' |
+                grep '\->' | grep -v '""'
+}
+export -f gen_line;
+
+echo 'strict digraph G {'
+time cat ~/Temp/hosts/hostsbrevnov/hosts | sort -u | grep ^[0-9] | cut -f 1 |
+       xargs -n 1 -P 200 bash -c 'gen_line "$@"' --
+echo '}'
This page took 0.093748 seconds and 4 git commands to generate.