Skip to content

Instantly share code, notes, and snippets.

Created December 18, 2012 07:34
Show Gist options
  • Save anonymous/4325860 to your computer and use it in GitHub Desktop.
Save anonymous/4325860 to your computer and use it in GitHub Desktop.
Small Konversation script to perform GPG EAUTH authentication against the Bitcoin-OTC market bot Gribble.
#!/bin/bash
# install in ~/.kde/share/apps/konversation/scripts as otcauth
# chmod +x that file
# enable logging such that gribble from freenode ends up in
# ~/.kde/share/apps/konversation/logs/freenode_gribble.log
# restart konversation
# and then enjoy automatic auth script
# by going /otcauth NICKNAME
# directly from konversation
set -e
unset CDPATH
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
tty -s || exec konsole -e bash "$DIR"/`basename "$0"` "$@"
NICK=Rudd-O
test -z "$1" || NICK="$1"
function error() {
echo "The script cannot find or resolve the one time pad"
sleep 5
exit "${CODE}"
}
trap error ERR
qdbus org.kde.konversation /irc say Freenode gribble "gpg eauth $NICK"
echo "Waiting for reply from bot..." >> /dev/stderr
sleep 3
urltodecrypt=`tail "$DIR"/../logs/freenode_gribble.log | grep 'Get your encrypted OTP' | python -c 'import sys ; print sys.stdin.readlines()[-1].split()[-1].strip()'`
texttodecrypt=`wget -qO /dev/stdout "$urltodecrypt"`
decryptedtext=`echo "$texttodecrypt" | gpg --decrypt || true`
qdbus org.kde.konversation /irc say Freenode gribble "gpg everify $decryptedtext"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment