mirror of https://github.com/dirtbags/moth.git
A couple ctfd and pollster fixes
This commit is contained in:
parent
fdf76ed847
commit
9fe367ff39
|
@ -96,10 +96,9 @@ def start_html(title, hdr='', cls='', links=[], links_title=None):
|
||||||
<h1>%(title)s</h1>
|
<h1>%(title)s</h1>
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="%(base)s">Home</a></li>
|
|
||||||
<li><a href="%(base)sintro.html">Intro/Rules</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)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)spuzzler.cgi">Puzzles</a></li>
|
||||||
<li><a href="%(base)sscoreboard.cgi">Scoreboard</a></li>
|
<li><a href="%(base)sscoreboard.cgi">Scoreboard</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -157,7 +157,7 @@ def main():
|
||||||
# Show available puzzles in category
|
# Show available puzzles in category
|
||||||
show_puzzles(cat, cat_dir)
|
show_puzzles(cat, cat_dir)
|
||||||
else:
|
else:
|
||||||
thekey = get_key(cat, points)
|
thekeys = get_key(cat, points)
|
||||||
if not teams.chkpasswd(team, passwd):
|
if not teams.chkpasswd(team, passwd):
|
||||||
start_html('Wrong password')
|
start_html('Wrong password')
|
||||||
end_html()
|
end_html()
|
||||||
|
|
4
ctfd.py
4
ctfd.py
|
@ -20,7 +20,9 @@ def chart(s):
|
||||||
def reap():
|
def reap():
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
os.waitpid(0, os.WNOHANG)
|
pid, ret = os.waitpid(0, os.WNOHANG)
|
||||||
|
if not pid:
|
||||||
|
break
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
exec logger -t pollster
|
|
@ -11,9 +11,9 @@ import traceback
|
||||||
from ctf import config
|
from ctf import config
|
||||||
from ctf import pointscli
|
from ctf import pointscli
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
POLL_INTERVAL = config.get('pollster', 'poll_interval')
|
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')
|
REPORT_PATH = config.get('pollster', 'results')
|
||||||
SOCK_TIMEOUT = config.get('pollster', 'poll_timeout')
|
SOCK_TIMEOUT = config.get('pollster', 'poll_timeout')
|
||||||
|
|
||||||
|
@ -147,9 +147,9 @@ while True:
|
||||||
t_start = time.time()
|
t_start = time.time()
|
||||||
|
|
||||||
# gather the list of IPs to poll
|
# 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'))
|
out.write(config.start_html('Team Service Availability'))
|
||||||
for ip in ips:
|
for ip in ips:
|
||||||
# check file name format is ip
|
# check file name format is ip
|
||||||
|
@ -199,9 +199,8 @@ while True:
|
||||||
|
|
||||||
if out is not None:
|
if out is not None:
|
||||||
out.write(config.end_html())
|
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
|
# sleep until its time to poll again
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
|
|
Loading…
Reference in New Issue