1
0
Fork 0
mirror of https://github.com/dirtbags/moth.git synced 2025-01-06 03:50:56 -07:00
moth/puzzles/survey/1000000/,submit.cgi
2009-10-07 15:45:02 -06:00

25 lines
649 B
Python
Executable file

#! /usr/bin/env python3
import cgi
import time
import os
f = cgi.FieldStorage()
if f.getfirst('submit'):
print('Content-type: text/plain')
print()
print('Thanks for filling in the survey.')
print()
try:
fn = '/var/lib/ctf/survey/%s.%d.%d.txt' % (time.strftime('%Y-%m-%d'), time.time(), os.getpid())
o = open(fn, 'w')
for k in f.keys():
o.write('%s: %r\n' % (k, f.getlist(k)))
except IOError:
pass
print('The key is:')
print(' quux blorb frotz')
else:
print('Content-type: text/plain')
print()
print('You need to actually fill in the form to get the key.')