#!/usr/bin/python import os import cgi import cgitb cgitb.enable(context=10) #if os.environ.has_key('QUERY_STRING'): # os.environ['QUERY_STRING'] = '' fields = cgi.FieldStorage() import Cookie c = Cookie.SimpleCookie(os.environ.get('HTTP_COOKIE', '')) content = { 'joke1' : '

An infinite number of mathematicians walk into a bar. The first one orders a beer. The second orders half a beer. The third, a quarter of a beer. The bartender says You are all idiots! and pours two beers.

', 'joke2' : '

Two atoms are talking. One of them says I think I lost an electron! and the other says Are you sure? The first replies Yeah, I am positive!

', } if c.has_key('content_name') and c.has_key('content'): k = c['content_name'].value try: c['content'] = content[k] except KeyError: c['content'] = '

key = s4nNlaMScV

' else: c['content_name'] = 'joke1'; c['content'] = content['joke1'] print 'Content-Type: text/html\n%s\n\n\n' % c print '' print ''' 7

Web Application Challenge 7

Through some manipulation or interpretation of this CGI script and the HTML page(s) that it generates, a 10 character key can be found.

Find the key!

''' print '''
'''