From bf0cae0ec5b7c932ddf91ae6c98767e7f0e0c291 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 24 Jul 2011 20:15:22 +0200 Subject: rm kvutils and move anonbox.net to proper place --- anonbox/anonbox.sh | 57 ---------------------------------------------------- kvutils/kv2csv | 5 ----- kvutils/kv2sh | 3 --- util/bin/anonbox.net | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 65 deletions(-) delete mode 100755 anonbox/anonbox.sh delete mode 100755 kvutils/kv2csv delete mode 100755 kvutils/kv2sh create mode 100755 util/bin/anonbox.net diff --git a/anonbox/anonbox.sh b/anonbox/anonbox.sh deleted file mode 100755 index d038cd0a..00000000 --- a/anonbox/anonbox.sh +++ /dev/null @@ -1,57 +0,0 @@ -#! /bin/bash -#### anonbox.net [--check] -#### anonbox account creator -set -euf - -## -script_begin_date="`date --rfc-3339=ns`" - -## -GET() { - wget --quiet --no-check-certificate -O- https://anonbox.net/en/ -} - -## retrieve data -eval "$(${GET-GET} | - sed -rn ' -s^

([[:alnum:]@.]+)

$\ - email="\1" ; p -s^

.*

$\ - uri="\1/" ; p -s^

([0-9]+)/([0-9]+)/([0-9]+) ([0-9]+):([0-9]+) ([ap]).m.

$\ - Y=20\3 ; \ - m=\1 ; \ - d=\2 ; \ - H=\4 ; \ - M=\5 ; \ - p=\6 ; p')" - -## make best-before-date RFC-3339-(seconds)-conform -case "$p" in - p) H="`echo $H+12 | bc`" ;; -esac -s=00 -z=+02:00 -best_before="$Y-$m-$d $H:$M$z" - -## -script_end_date="`date --rfc-3339=ns`" - -## -for key in email uri best_before script_begin_date script_end_date ; do - eval "val=\"\$$key\"" - echo "$key=\"$val\"" -done - -## -if echo "$*" | tr "$IFS" ' ' | egrep -q "(^| )--check( |$)"; then - file="/tmp/save-$email" - echo "file=\"$file\"" - echo >&2 - echo "# downloading email..." >&2 - while ! curl -ksS "$uri" | tee "$file" | grep .; do - sleep 10 - done -fi - -#### end of file. diff --git a/kvutils/kv2csv b/kvutils/kv2csv deleted file mode 100755 index f075229c..00000000 --- a/kvutils/kv2csv +++ /dev/null @@ -1,5 +0,0 @@ -#! /bin/sh -set -euf -kv="`cat`" -echo "$kv" | cut -f 1 | tr '\n' , | sed 's/,$//' ; echo -echo "$kv" | cut -f 2 | tr '\n' , | sed 's/,$//' ; echo diff --git a/kvutils/kv2sh b/kvutils/kv2sh deleted file mode 100755 index be6fc85a..00000000 --- a/kvutils/kv2sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -# TODO escape and ensure correct sh syntax -sed -r 's/\t/="/;s/$/"/' diff --git a/util/bin/anonbox.net b/util/bin/anonbox.net new file mode 100755 index 00000000..d038cd0a --- /dev/null +++ b/util/bin/anonbox.net @@ -0,0 +1,57 @@ +#! /bin/bash +#### anonbox.net [--check] +#### anonbox account creator +set -euf + +## +script_begin_date="`date --rfc-3339=ns`" + +## +GET() { + wget --quiet --no-check-certificate -O- https://anonbox.net/en/ +} + +## retrieve data +eval "$(${GET-GET} | + sed -rn ' +s^

([[:alnum:]@.]+)

$\ + email="\1" ; p +s^

.*

$\ + uri="\1/" ; p +s^

([0-9]+)/([0-9]+)/([0-9]+) ([0-9]+):([0-9]+) ([ap]).m.

$\ + Y=20\3 ; \ + m=\1 ; \ + d=\2 ; \ + H=\4 ; \ + M=\5 ; \ + p=\6 ; p')" + +## make best-before-date RFC-3339-(seconds)-conform +case "$p" in + p) H="`echo $H+12 | bc`" ;; +esac +s=00 +z=+02:00 +best_before="$Y-$m-$d $H:$M$z" + +## +script_end_date="`date --rfc-3339=ns`" + +## +for key in email uri best_before script_begin_date script_end_date ; do + eval "val=\"\$$key\"" + echo "$key=\"$val\"" +done + +## +if echo "$*" | tr "$IFS" ' ' | egrep -q "(^| )--check( |$)"; then + file="/tmp/save-$email" + echo "file=\"$file\"" + echo >&2 + echo "# downloading email..." >&2 + while ! curl -ksS "$uri" | tee "$file" | grep .; do + sleep 10 + done +fi + +#### end of file. -- cgit v1.2.3