diff --git a/ctf.css b/ctf.css index 533401c..22d08d4 100644 --- a/ctf.css +++ b/ctf.css @@ -73,7 +73,3 @@ p { margin-bottom: 20px; color: #f4f4f4; } - -.center { - text-align: center; -} diff --git a/intro.html b/intro.html index f1220cb..4d60344 100644 --- a/intro.html +++ b/intro.html @@ -71,7 +71,7 @@

- There are two kinds of categories: flags, + There are two kinds of categories: flags and puzzles.

diff --git a/kevin/irc.py b/kevin/irc.py index e57338b..dac79e0 100755 --- a/kevin/irc.py +++ b/kevin/irc.py @@ -256,7 +256,7 @@ class User(Recipient): return 'User(%s, %s, %s)' % (self.name(), self.user, self.host) def recipient(interface, name): - if name[0] in ["&", "#"]: + if name[0] in ['&', '#', '+']: return Channel(interface, name) else: return User(interface, name, None, None) @@ -384,7 +384,7 @@ class SmartIRCHandler(IRCHandler): int(op) except ValueError: self.dbg("WARNING: unknown server code: %s" % op) - addl = tuple(args[3:]) + (text,) + addl = tuple(args[2:]) + (text,) try: self.handle_cooked(op, sender, forum, addl) @@ -395,13 +395,13 @@ class SmartIRCHandler(IRCHandler): def handle_cooked(self, op, sender, forum, addl): try: - func = getattr(self, 'cmd_' + op.lower()) + func = getattr(self, 'cmd_' + op.upper()) except AttributeError: self.unhandled(op, sender, forum, addl) return func(sender, forum, addl) - def cmd_ping(self, sender, forum, addl): + def cmd_PING(self, sender, forum, addl): self.write(['PONG'], addl[0]) def unhandled(self, op, sender, forum, addl): @@ -469,9 +469,21 @@ class Bot(SmartIRCHandler): self.announce('*bzert*') def cmd_001(self, sender, forum, addl): + # Welcome to IRC + self.nick = addl[0] for c in self.channels: self.write(['JOIN'], c) + def cmd_433(self, sender, forum, addl): + # Nickname already in use + self.nicks.append(self.nicks.pop(0)) + self.write(['NICK', self.nicks[0]]) + + def cmd_NICK(self, sender, forum, addl): + if addl[0] == self.nick: + self.nick = sender.name() + print(self.nick) + def writable(self): if not self.waiting: return asynchat.async_chat.writable(self) diff --git a/kevin/kevin.py b/kevin/kevin.py index cba0525..be33038 100755 --- a/kevin/kevin.py +++ b/kevin/kevin.py @@ -41,16 +41,29 @@ class Flagger(asynchat.async_chat): class Kevin(irc.Bot): def __init__(self, host, flagger, tokens, victims): - irc.Bot.__init__(self, host, ['kevin'], 'Kevin', ['#kevin']) + irc.Bot.__init__(self, host, + ['kevin', 'kev', 'kevin_', 'kev_', 'kevinm', 'kevinm_'], + 'Kevin', + ['+kevin']) self.flagger = flagger self.tokens = tokens self.victims = victims self.affiliation = {} - def cmd_join(self, sender, forum, addl): - if sender.name() in self.nicks: + def cmd_001(self, sender, forum, addl): + self.write(['OPER', 'bot', 'BottyMcBotpants']) + irc.Bot.cmd_001(self, sender, forum, addl) + + def cmd_JOIN(self, sender, forum, addl): + if sender.name == self.nick: self.tell_flag(forum) + def cmd_381(self, sender, forum, addl): + # You are now an IRC Operator + if self.nick != 'kevin': + self.write(['KILL', 'kevin'], 'You are not kevin. I am kevin.') + self.write(['NICK', 'kevin']) + def err(self, exception): """Save the traceback for later inspection""" irc.Bot.err(self, exception) @@ -71,7 +84,7 @@ class Kevin(irc.Bot): def tell_flag(self, forum): forum.msg('%s has the flag.' % (self.flagger.flag or nobody)) - def cmd_privmsg(self, sender, forum, addl): + def cmd_PRIVMSG(self, sender, forum, addl): text = addl[0] if text.startswith('!'): parts = text[1:].lower().split(' ', 1) diff --git a/puzzles/webapp/1/1.cgi b/puzzles/webapp/1/1.cgi index c2a405d..b5cbd75 100755 --- a/puzzles/webapp/1/1.cgi +++ b/puzzles/webapp/1/1.cgi @@ -10,7 +10,7 @@ print ''' 1 - + diff --git a/puzzles/webapp/binary.png b/puzzles/webapp/1/binary.png similarity index 100% rename from puzzles/webapp/binary.png rename to puzzles/webapp/1/binary.png diff --git a/puzzles/webapp/ctf.css b/puzzles/webapp/1/ctf.css similarity index 100% rename from puzzles/webapp/ctf.css rename to puzzles/webapp/1/ctf.css diff --git a/scoreboard.py b/scoreboard.py index e7a1f91..1b80eb6 100755 --- a/scoreboard.py +++ b/scoreboard.py @@ -5,6 +5,7 @@ import os import config import teams import points +import sys flags_dir = config.get('global', 'flags_dir') house_team = config.get('global', 'house_team') @@ -38,7 +39,7 @@ def main(): fn = os.path.join(flags_dir, cat) team = open(fn).read() or house_team print('
') - print(' flag: %s' + print(' %s' % (cat, teams.color(team), team)) except IOError: pass @@ -67,7 +68,7 @@ def main(): print('') print(''' -

+

scores over time