diff --git a/puzzles/webapp/40/,binary.png b/puzzles/webapp/40/,binary.png deleted file mode 120000 index 36053bd..0000000 --- a/puzzles/webapp/40/,binary.png +++ /dev/null @@ -1 +0,0 @@ -../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/40/,ctf.css b/puzzles/webapp/40/,ctf.css deleted file mode 120000 index 19b2533..0000000 --- a/puzzles/webapp/40/,ctf.css +++ /dev/null @@ -1 +0,0 @@ -../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/40/4.cgi b/puzzles/webapp/40/4.cgi deleted file mode 100755 index 55d66fe..0000000 --- a/puzzles/webapp/40/4.cgi +++ /dev/null @@ -1,76 +0,0 @@ -#!/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() - -print 'Content-Type: text/html' -print '' - -print ''' - - - 4 - - - -
-
-

Web Application Challenge 4

-

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!

- -
-''' - -PRODUCT_NAME = "Unidentifiable garbage" - -def purchase_success(quantity): - print ''' -

Congratulations, your order for %d "%s" has been placed.

- ''' % (quantity, PRODUCT_NAME) - -# key = 765JBo4B54 -if fields.has_key('quantity') and fields.has_key('product') and fields['product'].value == PRODUCT_NAME: - product = fields['product'].value - quantity = int(fields['quantity'].value) - - purchase_success(quantity) -else: - print ''' - -

SALE: %s

-

Use the order form below to place an order.

- -
- How many would you like? - -

- - -
- ''' % (PRODUCT_NAME, PRODUCT_NAME) - -print ''' - -
- -
- - -''' - diff --git a/puzzles/webapp/40/key b/puzzles/webapp/40/key deleted file mode 100644 index 606cf1d..0000000 --- a/puzzles/webapp/40/key +++ /dev/null @@ -1 +0,0 @@ -765JBo4B54 diff --git a/puzzles/webapp/50/,binary,png b/puzzles/webapp/50/,binary,png deleted file mode 120000 index 36053bd..0000000 --- a/puzzles/webapp/50/,binary,png +++ /dev/null @@ -1 +0,0 @@ -../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/50/,ctf.css b/puzzles/webapp/50/,ctf.css deleted file mode 120000 index 19b2533..0000000 --- a/puzzles/webapp/50/,ctf.css +++ /dev/null @@ -1 +0,0 @@ -../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/50/5.cgi b/puzzles/webapp/50/5.cgi deleted file mode 100755 index 23cc4e7..0000000 --- a/puzzles/webapp/50/5.cgi +++ /dev/null @@ -1,89 +0,0 @@ -#!/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() - -print 'Content-Type: text/html' -print '' - -print ''' - - - 5 - - - -
-
-

Web Application Challenge 5

-

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!

- -
-''' - -PRODUCT_NAME = "Alex Brugh" -QUANT_LIMIT = 1 - -def purchase_success(quantity): - print ''' -

Congratulations, your order for %d "%s" has been placed.

- ''' % (quantity, PRODUCT_NAME) - -class InvalidQuantityError(Exception): - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) - -quantity = None -if fields.has_key('quantity') and fields.has_key('product') and fields['product'].value == PRODUCT_NAME: - product = fields['product'].value - try: - quantity = int(fields['quantity'].value) - if quantity > QUANT_LIMIT: - # key = eVkIwHzOok - raise InvalidQuantityError("%d is not a valid quantity (limit %d)" % (quantity, QUANT_LIMIT)) - except ValueError: - print ''' -

There was an error with your order request. Sorry.

- ''' - quantity = None - -if quantity is not None: - purchase_success(quantity) -else: - print ''' - -

SALE: %s

-

Use the order form below to place an order.

- -
- Orders for "%s" are limited to 1 per customer. -

- - - -
- ''' % (PRODUCT_NAME, PRODUCT_NAME, PRODUCT_NAME) - -print ''' - -
- -
- - -''' - diff --git a/puzzles/webapp/50/key b/puzzles/webapp/50/key deleted file mode 100644 index 042dd52..0000000 --- a/puzzles/webapp/50/key +++ /dev/null @@ -1 +0,0 @@ -eVkIwHzOok diff --git a/puzzles/webapp/60/,binary.png b/puzzles/webapp/60/,binary.png deleted file mode 120000 index 36053bd..0000000 --- a/puzzles/webapp/60/,binary.png +++ /dev/null @@ -1 +0,0 @@ -../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/60/,ctf.css b/puzzles/webapp/60/,ctf.css deleted file mode 120000 index 19b2533..0000000 --- a/puzzles/webapp/60/,ctf.css +++ /dev/null @@ -1 +0,0 @@ -../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/60/6.cgi b/puzzles/webapp/60/6.cgi deleted file mode 100755 index 75e192b..0000000 --- a/puzzles/webapp/60/6.cgi +++ /dev/null @@ -1,72 +0,0 @@ -#!/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() -c['key'] = 'QJebByJaKX' -c['content'] = '

Maybe I should have used sessions...

' - -print 'Content-Type: text/html\n%s\n\n\n' % c -print '' - -print ''' - - - 6 - - - - -
-
-

Web Application Challenge 6

-

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 ''' -
- -
- - -''' - diff --git a/puzzles/webapp/60/key b/puzzles/webapp/60/key deleted file mode 100644 index f235990..0000000 --- a/puzzles/webapp/60/key +++ /dev/null @@ -1 +0,0 @@ -QJebByJaKX diff --git a/puzzles/webapp/70/,binary.png b/puzzles/webapp/70/,binary.png deleted file mode 120000 index 36053bd..0000000 --- a/puzzles/webapp/70/,binary.png +++ /dev/null @@ -1 +0,0 @@ -../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/70/,ctf.css b/puzzles/webapp/70/,ctf.css deleted file mode 120000 index 19b2533..0000000 --- a/puzzles/webapp/70/,ctf.css +++ /dev/null @@ -1 +0,0 @@ -../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/70/7.cgi b/puzzles/webapp/70/7.cgi deleted file mode 100755 index 1bfdf64..0000000 --- a/puzzles/webapp/70/7.cgi +++ /dev/null @@ -1,86 +0,0 @@ -#!/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 ''' -
- -
- - -''' - diff --git a/puzzles/webapp/70/key b/puzzles/webapp/70/key deleted file mode 100644 index 16f48e0..0000000 --- a/puzzles/webapp/70/key +++ /dev/null @@ -1 +0,0 @@ -s4nNlaMScV diff --git a/puzzles/webapp/80/,binary.png b/puzzles/webapp/80/,binary.png deleted file mode 120000 index 36053bd..0000000 --- a/puzzles/webapp/80/,binary.png +++ /dev/null @@ -1 +0,0 @@ -../10/,binary.png \ No newline at end of file diff --git a/puzzles/webapp/80/,ctf.css b/puzzles/webapp/80/,ctf.css deleted file mode 120000 index 19b2533..0000000 --- a/puzzles/webapp/80/,ctf.css +++ /dev/null @@ -1 +0,0 @@ -../10/,ctf.css \ No newline at end of file diff --git a/puzzles/webapp/80/,jokes/bar b/puzzles/webapp/80/,jokes/bar deleted file mode 100644 index 9e0dfe3..0000000 --- a/puzzles/webapp/80/,jokes/bar +++ /dev/null @@ -1,4 +0,0 @@ -

An unsigned integer walks into a bar and orders a drink.
-The bartender delivers it and says, "Is something wrong?"
-The int looks up and replies, "Parity error."
-"Ah," the bartender replies, "I thought you looked a bit off."

diff --git a/puzzles/webapp/80/,jokes/binary b/puzzles/webapp/80/,jokes/binary deleted file mode 100644 index 58ddc26..0000000 --- a/puzzles/webapp/80/,jokes/binary +++ /dev/null @@ -1,2 +0,0 @@ -

There are 10 types of people in the world: those who understand binary and those who don't.

- diff --git a/puzzles/webapp/80/,jokes/christmas b/puzzles/webapp/80/,jokes/christmas deleted file mode 100644 index 3bade53..0000000 --- a/puzzles/webapp/80/,jokes/christmas +++ /dev/null @@ -1,2 +0,0 @@ -

Why do programmers confuse Halloween and Christmas?

-Because OCT 31 == DEC 25!

diff --git a/puzzles/webapp/80/,jokes/help b/puzzles/webapp/80/,jokes/help deleted file mode 100644 index e79c54b..0000000 --- a/puzzles/webapp/80/,jokes/help +++ /dev/null @@ -1,2 +0,0 @@ -

Once a programmer drowned in the sea. Many people were at the beach at the time, -but the programmer was shouting "F1! F1!" and nobody understood it.

diff --git a/puzzles/webapp/80/,jokes/java b/puzzles/webapp/80/,jokes/java deleted file mode 100644 index 9c5e84d..0000000 --- a/puzzles/webapp/80/,jokes/java +++ /dev/null @@ -1,6 +0,0 @@ -

"Knock, Knock."
-"Who's there?"
-
-... long pause ...
-
-"Java."

diff --git a/puzzles/webapp/80/,makedb.py b/puzzles/webapp/80/,makedb.py deleted file mode 100755 index d6c886f..0000000 --- a/puzzles/webapp/80/,makedb.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python2.6 - -import os -import sys -import sqlite3 -import base64 -import stat - -# new db -if os.path.exists(',zomg.sqlite3'): - os.remove(',zomg.sqlite3') -db = sqlite3.connect(',zomg.sqlite3') -cur = db.cursor() - -# pics table -cur.execute('create table pics(id integer primary key, data blob)') -paths = os.listdir(',pics/') -for path in paths: - f = open(os.path.join(',pics/', path), 'rb') - data = f.read() - f.close() - encoded = base64.encodestring(data) - html = '' % encoded - cur.execute('insert into pics(data) values(?)', (html,)) - -# jokes table -cur.execute('create table jokes(id integer primary key, data text)') -paths = os.listdir(',jokes/') -for path in paths: - f = open(os.path.join(',jokes/', path), 'r') - html = f.read() - f.close() - cur.execute('insert into jokes(data) values(?)', (html,)) - -# key -cur.execute('create table key(id integer primary key, data text)') -for k in [None, None, None, None, None, 'dmW5f9P54e']: - cur.execute('insert into key(data) values(?)', (k,)) - -# clean up -db.commit() -cur.close() -db.close() - -os.chmod(',zomg.sqlite3', stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH) diff --git a/puzzles/webapp/80/,pics/90s.jpg b/puzzles/webapp/80/,pics/90s.jpg deleted file mode 100644 index 5e31456..0000000 Binary files a/puzzles/webapp/80/,pics/90s.jpg and /dev/null differ diff --git a/puzzles/webapp/80/,pics/melon.jpg b/puzzles/webapp/80/,pics/melon.jpg deleted file mode 100644 index 4ed92f5..0000000 Binary files a/puzzles/webapp/80/,pics/melon.jpg and /dev/null differ diff --git a/puzzles/webapp/80/,pics/pumpkin.jpg b/puzzles/webapp/80/,pics/pumpkin.jpg deleted file mode 100644 index cca7efc..0000000 Binary files a/puzzles/webapp/80/,pics/pumpkin.jpg and /dev/null differ diff --git a/puzzles/webapp/80/,pics/ruth.jpg b/puzzles/webapp/80/,pics/ruth.jpg deleted file mode 100644 index 46ea699..0000000 Binary files a/puzzles/webapp/80/,pics/ruth.jpg and /dev/null differ diff --git a/puzzles/webapp/80/,pics/soccer.jpg b/puzzles/webapp/80/,pics/soccer.jpg deleted file mode 100644 index b2f1ba7..0000000 Binary files a/puzzles/webapp/80/,pics/soccer.jpg and /dev/null differ diff --git a/puzzles/webapp/80/,zomg.sqlite3 b/puzzles/webapp/80/,zomg.sqlite3 deleted file mode 100644 index 4b5bf1f..0000000 Binary files a/puzzles/webapp/80/,zomg.sqlite3 and /dev/null differ diff --git a/puzzles/webapp/80/8.cgi b/puzzles/webapp/80/8.cgi deleted file mode 100755 index 280b5d3..0000000 --- a/puzzles/webapp/80/8.cgi +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/python - -import os -import cgi -import cgitb -import sqlite3 -cgitb.enable(context=10) - -if os.environ.has_key('QUERY_STRING'): - os.environ['QUERY_STRING'] = '' - -fields = cgi.FieldStorage() - -q = None -if fields.has_key('q'): - q = fields['q'].value - -if q is not None: - print 'Content-Type: text/html\n' - try: - db = sqlite3.connect(',zomg.sqlite3') - cur = db.cursor() - cur.execute(q) - results = cur.fetchall() - - print '' - for r in results: - print '' - for thing in r: - print '' % thing - print '' - print '
%s
' - - except Exception: - print '

Invalid query: %s

' % q - -else: - print 'Content-Type: text/html\n' - print '' - - print ''' - - - 8 - - - - -
-
-

Web Application Challenge 8

-

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!

- -
-

Database Query Wizard

-

Use the form below to retrieve data from the database. Select the - type of data that you would like to view and the number of database - entries to retrieve and then click on the "Query" button.

- -
-
- Topic: -

- # Results: -

- -
- -
-
- -
- - - ''' - diff --git a/puzzles/webapp/80/key b/puzzles/webapp/80/key deleted file mode 100644 index f77d1bd..0000000 --- a/puzzles/webapp/80/key +++ /dev/null @@ -1 +0,0 @@ -dmW5f9P54e diff --git a/tanks/GameMath.py b/tanks/GameMath.py index b842b80..4af140c 100644 --- a/tanks/GameMath.py +++ b/tanks/GameMath.py @@ -139,7 +139,10 @@ to be in radians, and must be in the range 0 <= angle < 2*pi. is negative if angle2 leads angle1 (clockwise).. """ - return (angle2 - angle1) % pi2 + ret = (angle2 - angle1) % pi2 + if ret > math.pi: + ret -= pi2 + return ret def getDist(point1, point2): """Returns the distance between point1 and point2.""" diff --git a/tanks/Pflanzarr.py b/tanks/Pflanzarr.py index 18a54fe..d13b983 100644 --- a/tanks/Pflanzarr.py +++ b/tanks/Pflanzarr.py @@ -196,11 +196,21 @@ class Pflanzarr: cgi.escape(tank.deathReason))) body.write(' \n') + links='''

Tanks

+ +''' + # Write everything out html.write(self.gameFilename, 'Tanks round %d' % self.gameNum, body.getvalue(), hdr=hdr.getvalue(), + links=links, onload='start(turns);')