summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/find-supernodes
diff options
context:
space:
mode:
authortv <tv@nomic.retiolum>2013-02-08 19:41:54 +0100
committertv <tv@nomic.retiolum>2013-02-08 19:41:54 +0100
commitc013d579e8fd73697eb52b8aafd269cdfef385a5 (patch)
treea1b8280851e77357c9b589927460dc1dd2162ed5 /retiolum/bin/find-supernodes
parent77ba7045aefd9231d8c7196fadd6cc4cf4dc3f81 (diff)
parent6228db160f3c2d710c87938c4ef2c5b819da764d (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'retiolum/bin/find-supernodes')
-rwxr-xr-xretiolum/bin/find-supernodes21
1 files changed, 21 insertions, 0 deletions
diff --git a/retiolum/bin/find-supernodes b/retiolum/bin/find-supernodes
new file mode 100755
index 00000000..2c316d0e
--- /dev/null
+++ b/retiolum/bin/find-supernodes
@@ -0,0 +1,21 @@
+#! /bin/dash
+set -eu
+cd /etc/tinc/retiolum/hosts
+for name in `
+ grep '^[[:space:]]*Address[[:space:]]*=' * |
+ cut -d: -f1 | sort | uniq
+`; do
+ if eval "`sed -n '
+ s/[[:space:]]\+//g
+ s/^\(Address\|Port\)=\(.*\)/\1="\${\1+\$\1\n}\2"/p
+ ' $name`"; then
+ port=${Port-655}
+ for host in $Address; do
+ if nc -zw 2 $host $port 2>/dev/null; then
+ echo "$name [('$host', $port)]"
+ fi &
+ done
+ wait
+ fi &
+done
+wait