Skip to content

Instantly share code, notes, and snippets.

@joetde
Created April 2, 2015 08:34
Show Gist options
  • Save joetde/0973e1927f7c1ec879fb to your computer and use it in GitHub Desktop.
Save joetde/0973e1927f7c1ec879fb to your computer and use it in GitHub Desktop.
import irc.client
import math
import base64
import zlib
first = True
def on_connect(connection, event):
connection.join('#root-me_challenge')
def on_join(connection, event):
connection.privmsg('Candy', '!ep4')
def on_privmsg(connection, event):
process_msg(event.arguments[0], connection)
def process_msg(msg, connection):
global first
print 'Recv %s' % msg
print first
if first:
zmsg = base64.b64decode(msg)
res = zlib.decompress(zmsg)
first = False
connection.privmsg('Candy', '!ep4 -rep %s' % res)
else:
connection.close()
def on_disconnect(connection, event):
raise SystemExit()
reactor = irc.client.Reactor()
c = reactor.server().connect('irc.root-me.org', 6667, 'joep')
c.add_global_handler("welcome", on_connect)
c.add_global_handler("join", on_join)
c.add_global_handler("disconnect", on_disconnect)
c.add_global_handler("privmsg", on_privmsg)
reactor.process_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment