mirror of https://github.com/dirtbags/moth.git
Merge branch 'master' of cfl:/var/projects/gctf
Conflicts: puzzles/webapp/1/1.cgi
This commit is contained in:
commit
90da0baaa1
4
ctf.css
4
ctf.css
|
@ -73,7 +73,3 @@ p {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #f4f4f4;
|
color: #f4f4f4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
There are two kinds of categories: <em>flags</em>,
|
There are two kinds of categories: <em>flags</em>
|
||||||
and <em>puzzles</em>.
|
and <em>puzzles</em>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
20
kevin/irc.py
20
kevin/irc.py
|
@ -256,7 +256,7 @@ class User(Recipient):
|
||||||
return 'User(%s, %s, %s)' % (self.name(), self.user, self.host)
|
return 'User(%s, %s, %s)' % (self.name(), self.user, self.host)
|
||||||
|
|
||||||
def recipient(interface, name):
|
def recipient(interface, name):
|
||||||
if name[0] in ["&", "#"]:
|
if name[0] in ['&', '#', '+']:
|
||||||
return Channel(interface, name)
|
return Channel(interface, name)
|
||||||
else:
|
else:
|
||||||
return User(interface, name, None, None)
|
return User(interface, name, None, None)
|
||||||
|
@ -384,7 +384,7 @@ class SmartIRCHandler(IRCHandler):
|
||||||
int(op)
|
int(op)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self.dbg("WARNING: unknown server code: %s" % op)
|
self.dbg("WARNING: unknown server code: %s" % op)
|
||||||
addl = tuple(args[3:]) + (text,)
|
addl = tuple(args[2:]) + (text,)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.handle_cooked(op, sender, forum, addl)
|
self.handle_cooked(op, sender, forum, addl)
|
||||||
|
@ -395,13 +395,13 @@ class SmartIRCHandler(IRCHandler):
|
||||||
|
|
||||||
def handle_cooked(self, op, sender, forum, addl):
|
def handle_cooked(self, op, sender, forum, addl):
|
||||||
try:
|
try:
|
||||||
func = getattr(self, 'cmd_' + op.lower())
|
func = getattr(self, 'cmd_' + op.upper())
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.unhandled(op, sender, forum, addl)
|
self.unhandled(op, sender, forum, addl)
|
||||||
return
|
return
|
||||||
func(sender, forum, addl)
|
func(sender, forum, addl)
|
||||||
|
|
||||||
def cmd_ping(self, sender, forum, addl):
|
def cmd_PING(self, sender, forum, addl):
|
||||||
self.write(['PONG'], addl[0])
|
self.write(['PONG'], addl[0])
|
||||||
|
|
||||||
def unhandled(self, op, sender, forum, addl):
|
def unhandled(self, op, sender, forum, addl):
|
||||||
|
@ -469,9 +469,21 @@ class Bot(SmartIRCHandler):
|
||||||
self.announce('*bzert*')
|
self.announce('*bzert*')
|
||||||
|
|
||||||
def cmd_001(self, sender, forum, addl):
|
def cmd_001(self, sender, forum, addl):
|
||||||
|
# Welcome to IRC
|
||||||
|
self.nick = addl[0]
|
||||||
for c in self.channels:
|
for c in self.channels:
|
||||||
self.write(['JOIN'], c)
|
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):
|
def writable(self):
|
||||||
if not self.waiting:
|
if not self.waiting:
|
||||||
return asynchat.async_chat.writable(self)
|
return asynchat.async_chat.writable(self)
|
||||||
|
|
|
@ -41,16 +41,29 @@ class Flagger(asynchat.async_chat):
|
||||||
|
|
||||||
class Kevin(irc.Bot):
|
class Kevin(irc.Bot):
|
||||||
def __init__(self, host, flagger, tokens, victims):
|
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.flagger = flagger
|
||||||
self.tokens = tokens
|
self.tokens = tokens
|
||||||
self.victims = victims
|
self.victims = victims
|
||||||
self.affiliation = {}
|
self.affiliation = {}
|
||||||
|
|
||||||
def cmd_join(self, sender, forum, addl):
|
def cmd_001(self, sender, forum, addl):
|
||||||
if sender.name() in self.nicks:
|
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)
|
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):
|
def err(self, exception):
|
||||||
"""Save the traceback for later inspection"""
|
"""Save the traceback for later inspection"""
|
||||||
irc.Bot.err(self, exception)
|
irc.Bot.err(self, exception)
|
||||||
|
@ -71,7 +84,7 @@ class Kevin(irc.Bot):
|
||||||
def tell_flag(self, forum):
|
def tell_flag(self, forum):
|
||||||
forum.msg('%s has the flag.' % (self.flagger.flag or nobody))
|
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]
|
text = addl[0]
|
||||||
if text.startswith('!'):
|
if text.startswith('!'):
|
||||||
parts = text[1:].lower().split(' ', 1)
|
parts = text[1:].lower().split(' ', 1)
|
||||||
|
|
|
@ -62,7 +62,8 @@ for cat in os.listdir(opts.puzzles):
|
||||||
f.write('<ul>\n')
|
f.write('<ul>\n')
|
||||||
for fn, path in files:
|
for fn, path in files:
|
||||||
shutil.copy(path, outdir)
|
shutil.copy(path, outdir)
|
||||||
f.write('<li><a href="%s">%s</a></li>\n' % (fn, fn))
|
if not fn.startswith(','):
|
||||||
|
f.write('<li><a href="%s">%s</a></li>\n' % (fn, fn))
|
||||||
f.write('</ul>\n')
|
f.write('</ul>\n')
|
||||||
f.write('''
|
f.write('''
|
||||||
<form action="%(cgi)s" method="post">
|
<form action="%(cgi)s" method="post">
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 626 B |
|
@ -0,0 +1,54 @@
|
||||||
|
html,body {
|
||||||
|
height: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
background-color: #000000;
|
||||||
|
background-image: url(",binary.png");
|
||||||
|
background-repeat: repeat-x repeat-y;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wrapper {
|
||||||
|
min-height: 100%;
|
||||||
|
height: 100%;
|
||||||
|
width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-left: 2px solid #009900;
|
||||||
|
border-right: 2px solid #009900;
|
||||||
|
font: .9em monospace;
|
||||||
|
color: #009900;
|
||||||
|
padding: 0;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content {
|
||||||
|
padding: 2em 1.5em 2em 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
height: 2em;
|
||||||
|
line-height: 2em;
|
||||||
|
width: 800px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
background-color: #222;
|
||||||
|
color: #fff;
|
||||||
|
border: 1px solid #009900;
|
||||||
|
padding: 1px 2px 1px 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h2,h3,h4 {
|
||||||
|
padding-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vertsep {
|
||||||
|
width: 100%;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: 2em auto 2em auto;
|
||||||
|
border-bottom: 1px dotted #222;
|
||||||
|
}
|
|
@ -10,7 +10,11 @@ print '''
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>1</title>
|
<title>1</title>
|
||||||
|
<<<<<<< HEAD:puzzles/webapp/1/1.cgi
|
||||||
<link rel="stylesheet" type="text/css" href="ctf.css" media="all" />
|
<link rel="stylesheet" type="text/css" href="ctf.css" media="all" />
|
||||||
|
=======
|
||||||
|
<link rel="stylesheet" type="text/css" href=",ctf.css" media="all" />
|
||||||
|
>>>>>>> 3c3c03775e5ac9a11abf581fbf8656e31d99ef42:puzzles/webapp/1/1.cgi
|
||||||
<!-- key = ktFfb8R1Bw -->
|
<!-- key = ktFfb8R1Bw -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import os
|
||||||
import config
|
import config
|
||||||
import teams
|
import teams
|
||||||
import points
|
import points
|
||||||
|
import sys
|
||||||
|
|
||||||
flags_dir = config.get('global', 'flags_dir')
|
flags_dir = config.get('global', 'flags_dir')
|
||||||
house_team = config.get('global', 'house_team')
|
house_team = config.get('global', 'house_team')
|
||||||
|
@ -38,7 +39,7 @@ def main():
|
||||||
fn = os.path.join(flags_dir, cat)
|
fn = os.path.join(flags_dir, cat)
|
||||||
team = open(fn).read() or house_team
|
team = open(fn).read() or house_team
|
||||||
print(' <br/>')
|
print(' <br/>')
|
||||||
print(' <!-- flag: %s --> flag: <span style="color: #%s">%s</span>'
|
print(' <!-- flag: %s --> <span style="color: #%s" title="flag holder">%s</span>'
|
||||||
% (cat, teams.color(team), team))
|
% (cat, teams.color(team), team))
|
||||||
except IOError:
|
except IOError:
|
||||||
pass
|
pass
|
||||||
|
@ -67,7 +68,7 @@ def main():
|
||||||
print('</tr>')
|
print('</tr>')
|
||||||
print('''</table>
|
print('''</table>
|
||||||
|
|
||||||
<p class="center">
|
<p class="histogram">
|
||||||
<img src="histogram.png" alt="scores over time" />
|
<img src="histogram.png" alt="scores over time" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue