#!/usr/bin/python import cgi import cgitb; cgitb.enable() import sys import os from urllib import quote from ctf import teams, html basedir = '/var/lib/ctf/tanks' links = '''

Tanks

  • Docs
  • Results
  • Submit
  • My Errors
  • ''' body = [] fields = cgi.FieldStorage() team = fields.getfirst('team', '').strip() passwd = fields.getfirst('passwd', '').strip() if not team: pass elif teams.chkpasswd(team, passwd): path = os.path.join(basedir, 'errors', quote(team)) if os.path.isfile(path): body.append('

    Your latest errors:

    ') errors = open(path).readlines() if errors: body.append('') else: body.append('

    There were no errors.

    ') else: body.append('

    No error file found.

    ') else: body.append('Authentication failed.') body.append('''
    Error report request: Team:
    Password:
    ''') html.serve('Tanks Errors', '\n'.join(body), links=links)