blob: 4da867167514d3a6451c1da0f302b79b3808ae09 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
export PREFIX="${PREFIX:-/usr/local}"
echo "urnstart: working on:" "$1" >&2
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." >&2
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
echo "whois://whois.ano/AS${nss2}"
elif [ "$nss" = "ip4" -o "$nss" = "ip6" -o "$nss" = "dom" ];then
echo "whois://whois.ano/${nss2}"
fi
fi
if [ "$nid" = "ietf" ];then
if [ "$nss" = "rfc" ];then
echo gopher://thebackupbox.net:70/0/rfc/rfc${nss2}.txt
fi
fi
if [ "$nid" = "phrack" ];then
if [ "$nss" ];then
if [ "$nss2" ];then
echo "gopher://thebackupbox.net:70/0/phrack/issues/${nss}/${nss2}.txt"
else
echo "gopher://thebackupbox.net:70/1/phrack/issues/${nss}/"
fi
fi
fi
if [ "$nid" = "xkcd" ];then
echo "https://xkcd.com/${nss}/"
fi
if [ "$nid" = "mitre" ];then
if [ "$nss" = "cve" ];then
echo "https://www.cvedetails.com/cve/CVE-${nss2}/"
fi
fi
if [ "$nid" = "btih" ];then
btih2magnet "$nss"
fi
file="/usr/local/share/urn/$nid:$nss"
if [ -e "$file" ];then
grep "^${nss2}\s" "$file" | cut -f2-
fi
|