]> git.netwichtig.de Git - user/henk/code/shell/rif.git/commitdiff
Add script to listfriends and to import friends
authorNico Schottelius <nico@nico-notebook.schottelius.org>
Mon, 9 Sep 2019 17:03:49 +0000 (02:03 +0900)
committerNico Schottelius <nico@nico-notebook.schottelius.org>
Mon, 9 Sep 2019 17:03:49 +0000 (02:03 +0900)
README.md
rif-checkfriends.sh [changed mode: 0644->0755]
rif-importfriends.sh [new file with mode: 0755]
rif-listfriends.sh [new file with mode: 0755]

index 0cbcd485951f2d01dae3f53a01f6ace7f1075551..050f0bb523cc8e42e69273745f7b170275b86f1a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -28,7 +28,9 @@ To become a real IPv6 friend, you need to do the following things:
 - Setup a webserver on your computer
 - Export your key and all real IPv6 friend keys to your webserver as
   "rifkeys.txt
-- For each of your friends, check whether they are online!
+- For each of your friends, check whether they are online
+- Import the friends of your friends and check whether they are
+  online, too!
 
 ### Example: Generating a key with the right comment
 
@@ -122,21 +124,45 @@ gpg -a --export RIF > /var/www/html/rifkeys
 
 ### Example: List your friends
 
+You can use the included rif-listfriends.sh or directly gpg:
+
 ```
 [1:40] line:~% gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/'
 Nico Schottelius (RIF https://nico.ungleich.cloud) <ipv6@nico.ungleich.cloud>
 Nico Schottelius (myself) (RIF https://nico2.ungleich.cloud) <nico@nico.ungleich.cloud>
 ```
 
+
 ### Example: Checking which friends are online
 
 Use the included rif-checkfriends.sh script or iterate yourself over
 above output.
 
 ```
+[1:54] line:realipv6friend% sh rif-checkfriends.sh
+Checking Nico Schottelius  on https://nico.ungleich.cloud ...
+Nico Schottelius is online
+Checking Nico Schottelius (myself)  on https://nico2.ungleich.cloud ...
+Nico Schottelius (myself) is offline
+[1:54] line:realipv6friend%
+
+```
+
+### Example: Importing friends of my friend
 
+Importing friends of a friend is as simple as importing all the
+exported keys! We import friends directly from the URL of a friend:
 
 ```
+curl -6 -s https://nico.ungleich.cloud/rifkeys | gpg --import
+```
+
+You can also use
+
+### Example: Sending a message to a friend
+
+Simply use your mail program for that.
+And obviously enable signing & encrypting the email.
 
 
 ## To be added
old mode 100644 (file)
new mode 100755 (executable)
index af7e4d6..24bb12f
@@ -3,12 +3,13 @@
 
 gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/' | (
     while read line
-    do name=$(echo $line | sed 's/\(.*\)(.*/\1/')
-       # Assume by default offline
-       online=offline
-       url=$(echo $line | sed -e 's/.*(RIF //' -e 's/).*//')
-       echo "Checking $name on $url ..."
-       curl -s "$url" > /dev/null && online=online
-       echo $name is $online
+    do
+        name=$(echo $line | sed 's/\(.*\)(.*/\1/')
+        # Assume by default offline
+        online=offline
+        url=$(echo $line | sed -e 's/.*(RIF //' -e 's/).*//')
+        echo "Checking $name on $url ..."
+        curl -6 -s "$url" > /dev/null && online=online
+        echo $name is $online
     done
 )
diff --git a/rif-importfriends.sh b/rif-importfriends.sh
new file mode 100755 (executable)
index 0000000..887abc2
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# 2019-09-10, Nico Schottelius, Seoul
+
+if [ $# -lt 1 ]; then
+    echo "$0: <URL> [URL...]"
+    echo "URL: of your real IPv6 friend(s)"
+    exit 1
+fi
+
+while [ $# -ge 1 ]; do
+    url=$1; shift
+    fullurl=${url}/rifkeys
+
+    curl -6 -s "${fullurl}" | gpg --import
+done
diff --git a/rif-listfriends.sh b/rif-listfriends.sh
new file mode 100755 (executable)
index 0000000..f228be5
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+# 2019-09-10, Nico Schottelius, Seoul
+
+gpg --list-keys --with-colons | grep RIF | awk -F: '{ print $10 }' | sed 's/\\x3a/:/'