diff --git a/Makefile b/Makefile index a8d6ca0..96254d0 100644 --- a/Makefile +++ b/Makefile @@ -11,8 +11,7 @@ PYC = __init__.pyc PYC += config.pyc points.pyc teams.pyc PYC += register.pyc scoreboard.pyc puzzler.pyc PYC += flagd.pyc pointsd.pyc pointscli.pyc -PYC += histogram.pyc -#PYC += roshambo.pyc game.pyc +PYC += histogram.pyc irc.pyc all: ctf.tce diff --git a/ctf/irc.py b/ctf/irc.py index dac79e0..0587d4a 100755 --- a/ctf/irc.py +++ b/ctf/irc.py @@ -7,6 +7,8 @@ import sys import traceback import time +channel_prefixes = '+#&' + class IRCHandler(asynchat.async_chat): """IRC Server connection. @@ -256,7 +258,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 channel_prefixes: return Channel(interface, name) else: return User(interface, name, None, None) @@ -327,9 +329,8 @@ class SmartIRCHandler(IRCHandler): # PRIVMSG ['neale!~user@127.0.0.1', 'PRIVMSG', '#hydra'] firebot, foo # PRIVMSG ['neale!~user@127.0.0.1', 'PRIVMSG', 'firebot'] firebot, foo try: - if args[2][0] in '#&': - forum = self.recipient(args[2]) - else: + forum = self.recipient(args[2]) + if not forum.is_channel(): forum = sender addl = (text,) except IndexError: diff --git a/kevin/Makefile b/kevin/Makefile index 5ced261..bd3b0ef 100644 --- a/kevin/Makefile +++ b/kevin/Makefile @@ -7,9 +7,8 @@ kevin.tce: target $(FAKE) sh -c 'cd target && tar -czf - --exclude=placeholder --exclude=*~ .' > $@ -target: kevin.py irc.pyc run log.run - $(INSTALL) -d target/usr/lib/ctf/kevin - $(INSTALL) kevin.py irc.py target/usr/lib/ctf/kevin +target: kevin.py run log.run + $(INSTALL) -D kevin.py target/usr/bin/kevin.py $(INSTALL) --owner=100 -d target/var/lib/ctf/kevin/tokens diff --git a/kevin/kevin.py b/kevin/kevin.py index d0ba26b..a00236d 100755 --- a/kevin/kevin.py +++ b/kevin/kevin.py @@ -13,6 +13,8 @@ from ctf.flagd import Flagger nobody = '\002[nobody]\002' class Kevin(irc.Bot): + debug = True + def __init__(self, host, flagger, tokens, victims): irc.Bot.__init__(self, host, ['kevin', 'kev', 'kevin_', 'kev_', 'kevinm', 'kevinm_'], diff --git a/kevin/run b/kevin/run index b596d3c..16e3a92 100755 --- a/kevin/run +++ b/kevin/run @@ -2,4 +2,4 @@ [ -f /var/lib/ctf/disabled/kevin ] && exit 0 -exec envuidgid ctf /usr/lib/ctf/kevin/kevin.py --victims=/var/lib/ctf/kevin/victims.txt --tokens=/var/lib/ctf/kevin/tokens +exec envuidgid ctf /usr/bin/kevin.py --victims=/var/lib/ctf/kevin/victims.txt --tokens=/var/lib/ctf/kevin/tokens