#!/usr/bin/python
import cgi, cgitb, os, sys
def toUnicode(n):
# 1110xxxx 10xxxxxx 10xxxxxx
if type(n) is str:
n = int(n)
p1 = n & 0x3f
p2 = (n >> 6) & 0x3f
p3 = (n >> 12) & 0xf
print p1, p3, p3
return chr(p3 + 0xe0) + chr(p2 + 0x80) + chr(0x80 + p1)
cgitb.enable(); # formats errors in HTML
sys.stderr = sys.stdout
print "Content-type: text/html"
print
print '''
Make swf
Color Chooser
'''
arguments = cgi.FieldStorage()
a = 0
b = 0
c = 0
for i in arguments.keys():
print arguments[i].name
print arguments[i].value
if (arguments[i].name == "a"):
print "found a"
a = arguments[i].value
if (arguments[i].name == "b"):
print "found b"
b = arguments[i].value
if (arguments[i].name == "c"):
print "found c"
c = arguments[i].value
print '''
'''
f = open("crasher73.swf", 'rb')
by = f.read();
head = by[:0x5e1]
tail = by[0x5e1+9:]
f.close()
f = open("new.swf", 'wb')
f.write(head)
f.write(toUnicode(c))
f.write(toUnicode(b))
f.write(toUnicode(a))
f.write(tail)
f.close()