From 8462ced4f6de0a6a524a8adf8ce96cb62c070723 Mon Sep 17 00:00:00 2001 From: Harvie Date: Mon, 14 Nov 2011 20:58:35 +0100 Subject: [PATCH] HostsViz (script for converting multiple traceroutes to GraphViz format) --- bash/hostsviz/.gitignore | 7 +++++++ bash/hostsviz/hostsviz.sh | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 bash/hostsviz/.gitignore create mode 100755 bash/hostsviz/hostsviz.sh 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 '}' -- 2.30.2