A couple ctfd and pollster fixes

This commit is contained in:
Neale Pickett 2009-10-09 10:15:24 -06:00
parent fdf76ed847
commit 9fe367ff39
5 changed files with 13 additions and 10 deletions

View File

@ -96,10 +96,9 @@ def start_html(title, hdr='', cls='', links=[], links_title=None):
<h1>%(title)s</h1>
<div id="navigation">
<ul>
<li><a href="%(base)s">Home</a></li>
<li><a href="%(base)sintro.html">Intro/Rules</a></li>
<li><a href="%(base)sservices.html">Svc flags</a></li>
<li><a href="%(base)s/tanks/results.cgi">Tanks</a></li>
<li><a href="%(base)stanks/results.cgi">Tanks</a></li>
<li><a href="%(base)spuzzler.cgi">Puzzles</a></li>
<li><a href="%(base)sscoreboard.cgi">Scoreboard</a></li>
</ul>

View File

@ -157,7 +157,7 @@ def main():
# Show available puzzles in category
show_puzzles(cat, cat_dir)
else:
thekey = get_key(cat, points)
thekeys = get_key(cat, points)
if not teams.chkpasswd(team, passwd):
start_html('Wrong password')
end_html()

View File

@ -20,7 +20,9 @@ def chart(s):
def reap():
try:
while True:
os.waitpid(0, os.WNOHANG)
pid, ret = os.waitpid(0, os.WNOHANG)
if not pid:
break
except OSError:
pass

3
pollster/log.run.pollster Executable file
View File

@ -0,0 +1,3 @@
#! /bin/sh
exec logger -t pollster

View File

@ -11,9 +11,9 @@ import traceback
from ctf import config
from ctf import pointscli
DEBUG = False
DEBUG = False
POLL_INTERVAL = config.get('pollster', 'poll_interval')
IP_DIR = config.get('pollster', 'heartbeat_dir')
IP_DIR = config.get('pollster', 'heartbeat_dir')
REPORT_PATH = config.get('pollster', 'results')
SOCK_TIMEOUT = config.get('pollster', 'poll_timeout')
@ -147,9 +147,9 @@ while True:
t_start = time.time()
# gather the list of IPs to poll
ips = os.listdir(IP_DIR)
ips = os.listdir(IP_DIR)
out = io.StringIO()
out = io.StringIO()
out.write(config.start_html('Team Service Availability'))
for ip in ips:
# check file name format is ip
@ -199,9 +199,8 @@ while True:
if out is not None:
out.write(config.end_html())
out.close()
open(REPORT_PATH, 'w').write(out.getvalue())
open(REPORT_PATH, 'w').write(out.getvalue())
# sleep until its time to poll again
time.sleep(sleep_time)