From: Harvie Date: Mon, 14 Nov 2011 19:58:35 +0000 (+0100) Subject: HostsViz (script for converting multiple traceroutes to GraphViz format) X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=8462ced4f6de0a6a524a8adf8ce96cb62c070723;p=mirrors%2FPrograms.git HostsViz (script for converting multiple traceroutes to GraphViz format) --- diff --git a/bash/hostsviz/.gitignore b/bash/hostsviz/.gitignore new file mode 100644 index 0000000..298ed1a --- /dev/null +++ b/bash/hostsviz/.gitignore @@ -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 index 0000000..bc9ad6c --- /dev/null +++ b/bash/hostsviz/hostsviz.sh @@ -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 '}'