aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2023-09-24 00:24:55 +0300
committerkaotisk <kaotisk@arching-kaos.org>2023-09-24 00:24:55 +0300
commit4c67050673223d4ff714a3bae68e1528fefcc84e (patch)
tree13c3a82dd9f6a6cbc1949eec9a95dc79660f669a /bin
parent47fa6d523d7503d657225413887c6f5c1f48d1ba (diff)
downloadarching-kaos-tools-4c67050673223d4ff714a3bae68e1528fefcc84e.tar.gz
arching-kaos-tools-4c67050673223d4ff714a3bae68e1528fefcc84e.tar.bz2
arching-kaos-tools-4c67050673223d4ff714a3bae68e1528fefcc84e.zip
cjdns network scanner prototype
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ak-cjdns-scanner22
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/ak-cjdns-scanner b/bin/ak-cjdns-scanner
new file mode 100755
index 0000000..b7dd53c
--- /dev/null
+++ b/bin/ak-cjdns-scanner
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# Needs CJDNS tools in your PATH
+#
+# Ref: https://github.com/cjdelisle/cjdns
+#
+counter=0
+printf '[' > walk.aknet
+dumpLinks | cut -d ' ' -f 2,4 | sed 's/ /\n/g' | sort | uniq | while read -r ip || [ -n "$ip" ]
+do
+ akid="`curl --connect-timeout 3 "http://[$(publictoip6 $ip)]:8610/v0/akid" 2>/dev/null`"
+ if [ "$?" == "0" ]
+ then
+ if [ "$counter" -ne "0" ]
+ then
+ printf ',' >> walk.aknet
+ fi
+ printf '{"cjdnsPublicKey":"%s","cjdnsIp":"%s","akid":%s}' "$ip" "`publictoip6 $ip`" "$akid" >> walk.aknet
+ counter="`expr $counter + 1`"
+ fi
+done
+printf ']' >> walk.aknet