Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- #
- # Azelphur's quick and ugly Bitcoin-OTC Pidgin auto auth script
- # Usage: run the script, enter your GPG password, type ;;eauth YourNick, be happy.
- # License: GPL
- #
- VOICEME = True # You can change this if you like
- import dbus
- import gobject
- import re
- import urllib2
- import gnupg
- import sys
- from getpass import getpass
- from dbus.mainloop.glib import DBusGMainLoop
- class PidginOTC:
- def __init__(self):
- self.msg = re.compile('^Request successful for user .+?, hostmask .+. Get your encrypted OTP from (http:\/\/bitcoin-otc.com\/otps\/.+)$')
- self.gpg = gnupg.GPG()
- self.passphrase = getpass("Enter your GPG passphrase: ")
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- bus = dbus.SessionBus()
- obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
- self.purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
- bus.add_signal_receiver(self.ReceivedImMsg,
- dbus_interface="im.pidgin.purple.PurpleInterface",
- signal_name="ReceivedImMsg")
- loop = gobject.MainLoop()
- loop.run()
- def ReceivedImMsg(self, account, sender, message, conversation, flags):
- if sender == 'gribble':
- match = self.msg.match(message)
- if match:
- print 'recieved request from gribble, grabbing', match.group(1)
- data = urllib2.urlopen(match.group(1)).read()
- decrypted = str(self.gpg.decrypt(data, passphrase=self.passphrase))
- reply = ";;gpg everify "+decrypted
- print 'replying with', reply
- self.purple.PurpleConvImSend(self.purple.PurpleConvIm(conversation), reply)
- if VOICEME:
- self.purple.PurpleConvImSend(self.purple.PurpleConvIm(conversation), ";;voiceme")
- PidginOTC()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement