summaryrefslogtreecommitdiff
path: root/nocompile
diff options
context:
space:
mode:
Diffstat (limited to 'nocompile')
-rwxr-xr-xnocompile/bin/elapsedtime18
-rwxr-xr-xnocompile/bin/unescape7
-rwxr-xr-xnocompile/bin/what9
-rwxr-xr-xnocompile/libexec/gopherd.sh4
4 files changed, 36 insertions, 2 deletions
diff --git a/nocompile/bin/elapsedtime b/nocompile/bin/elapsedtime
new file mode 100755
index 0000000..3d26597
--- /dev/null
+++ b/nocompile/bin/elapsedtime
@@ -0,0 +1,18 @@
+#!/bin/sh
+if [ "_$1" != "_" ];then
+ time=$1
+else
+ read time
+fi
+
+partials=$(echo $time | cut -d. -f2)
+wholes=$(echo $time | cut -d. -f1)
+seconds=$(( wholes % 60 ))
+minutes=$(( wholes/60 % 60 ))
+hours=$(( wholes/60/60 % 24 ))
+days=$(( wholes/60/60/24 % 7 ))
+weeks=$(( wholes/60/60/24/7 ))
+echo $weeks weeks $days days $hours:$minutes:$seconds.$partials
+if read time;then
+ elapsedtime $time
+fi
diff --git a/nocompile/bin/unescape b/nocompile/bin/unescape
new file mode 100755
index 0000000..c3cac84
--- /dev/null
+++ b/nocompile/bin/unescape
@@ -0,0 +1,7 @@
+#!/bin/sh
+if [ "_$1" != "_" ];then
+ l="$1"
+else
+ read l
+fi
+printf "$(echo "$l" | sed "s/%/\\\\x/g")"
diff --git a/nocompile/bin/what b/nocompile/bin/what
new file mode 100755
index 0000000..154dcc7
--- /dev/null
+++ b/nocompile/bin/what
@@ -0,0 +1,9 @@
+#!/bin/bash
+cd /usr/local/share/answers/what
+cd $1
+while shift 2>/dev/null;do
+ if [ "$1" ];then
+ echo $1 | sed "s/[^a-zA-Z0-9]//g" | xargs echo
+ fi
+done
+cat _
diff --git a/nocompile/libexec/gopherd.sh b/nocompile/libexec/gopherd.sh
index e50b129..768d02b 100755
--- a/nocompile/libexec/gopherd.sh
+++ b/nocompile/libexec/gopherd.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-#I'm aware of the LFI. Have fun looking around my server.
+#set these two variables if you have your server behind DMZ
read -t 10 req
base="$1"
req=$(echo "$req" | tr -d '\r')
@@ -10,7 +10,7 @@ if grep -v "^${base}" <<< "${realpath}" > /dev/null;then
exit 1
fi
myIP=$(/usr/local/bin/hop0 $(/usr/local/libexec/peerip))
-hostname=$(dig -x ${myIP} +short | rev | tail -c+2 | rev )
+hostname=$(dig -x ${myIP} +short | head -n1 | rev | tail -c+2 | rev )
if [ ! "${hostname}" ]; then
hostname=${myIP}
else