summaryrefslogtreecommitdiff
path: root/urnstart
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2020-06-01 04:15:28 -0500
committerepoch <epoch@hacking.allowed.org>2020-06-01 04:15:28 -0500
commitd1805d072adb5537f80ba07ac8d114be35a759a6 (patch)
tree34da4e64df384655148063a0620e70821431300c /urnstart
parent5aa8ec238c46f1961dbd9541d0067d60e2f18c28 (diff)
downloaduritools-d1805d072adb5537f80ba07ac8d114be35a759a6.tar.gz
uritools-d1805d072adb5537f80ba07ac8d114be35a759a6.zip
added a script I am using for resolving URNs into URLs to start. this script is very alpha. changes may happen everywhere or I might delete it.
Diffstat (limited to 'urnstart')
-rwxr-xr-xurnstart25
1 files changed, 25 insertions, 0 deletions
diff --git a/urnstart b/urnstart
new file mode 100755
index 0000000..4883b01
--- /dev/null
+++ b/urnstart
@@ -0,0 +1,25 @@
+#!/bin/sh
+echo "what we're working on:" "$1"
+urn="$(printf '%s\n' "$1" | cut -d: -f1)"
+if [ "$urn" != "urn" ];then
+ echo "this isn't a urn. wtf are you waking me up for? I'm going back to bed. fuck this shit."
+ exit 1
+fi
+
+nid="$(printf '%s\n' "$1" | cut -d: -f2)"
+nss="$(printf '%s\n' "$1" | cut -d: -f3)"
+nss2="$(printf '%s\n' "$1" | cut -d: -f4-)"
+
+if [ "$nid" = "anonet" ];then
+ if [ "$nss" = "asn" ];then
+ uristart "whois://whois.ano/AS${nss2}"
+ elif [ "$nss" = "ip4" -o "$nss" = "ip6" -o "$nss" = "dom" ];then
+ uristart "whois://whois.ano/${nss2}"
+ fi
+fi
+
+if [ "$nid" = "ietf" ];then
+ if [ "$nss" = "rfc" ];then
+ uristart "https://tools.ietf.org/html/rfc""${nss2}"
+ fi
+fi