Readme and junk. Open source yo

This commit is contained in:
Veno Server 2010-06-15 04:24:08 -05:00
commit f3fab159ca
5 changed files with 163 additions and 0 deletions

42
upload_lulz.py Normal file
View file

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
import numpy, sys, os, cgi
from PIL import Image
from cStringIO import StringIO
def application(environ, start_response):
if environ['REQUEST_METHOD'] == 'POST':
bert = environ.copy()
bert['QUERY_STRING'] = ''
post = cgi.FieldStorage(
fp = bert['wsgi.input'],
environ=bert,
keep_blank_values=True
)
map = {'000':'!','003':'#','006':'$','009':'%','00C':'&','00F':'*','030':'+','033':',','036':'-','039':'.','03C':'0','03F':'1','060':'2','063':'3','066':'4','069':'5','06C':'6','06F':'7','090':'8','093':'9','096':':','099':';','09C':'<','09F':'=','0C0':'>','0C3':'?','0C6':'@','0C9':'A','0CC':'B','0CF':'C','0F0':'D','0F3':'E','0F6':'F','0F9':'G','0FC':'H','0FF':'I','300':'J','303':'K','306':'L','309':'M','30C':'N','30F':'O','330':'P','333':'Q','336':'R','339':'S','33C':'T','33F':'U','360':'V','363':'W','366':'X','369':'Y','36C':'Z','36F':'^','390':'_','393':'`','396':'a','399':'b','39C':'c','39F':'d','3C0':'e','3C3':'f','3C6':'g','3C9':'h','3CC':'i','3CF':'j','3F0':'k','3F3':'l','3F6':'m','3F9':'n','3FC':'o','3FF':'p','600':'q','603':'r','606':'s','609':'t','60C':'u','60F':'v','630':'w','633':'x','636':'y','639':'z','63C':'{','63F':'|','660':'}','663':'~','666':'','669':'','66C':'','66F':'','690':'','693':'','696':'','699':'','69C':'','69F':'','6C0':'','6C3':'','6C6':'','6C9':'','6CC':'','6CF':'','6F0':'','6F3':'','6F6':'','6F9':'','6FC':'','6FF':'','900':'','903':'','906':'','909':'','90C':'','90F':'','930':'','933':'','936':'','939':'','93C':'','93F':'','960':'','963':'','966':'','969':'','96C':'','96F':'','990':'','993':'','996':'','999':'','99C':'','99F':'','9C0':'','9C3':'','9C6':'','9C9':'','9CC':'','9CF':'','9F0':'','9F3':'','9F6':'','9F9':'','9FC':'','9FF':'','C00':'','C03':'','C06':'','C09':'','C0C':'','C0F':'','C30':'','C33':'','C36':'','C39':'','C3C':'','C3F':'','C60':'','C63':'','C66':'','C69':'','C6C':'','C6F':'','C90':'','C93':'','C96':'','C99':'','C9C':'','C9F':'','CC0':'','CC3':'','CC6':'','CC9':'','CCC':'','CCF':'','CF0':'','CF3':'','CF6':'','CF9':'','CFC':'','CFF':'','F00':'','F03':'','F06':'','F09':'','F0C':'','F0F':'','F30':'','F33':'','F36':'','F39':'','F3C':'','F3F':'','F60':'','F63':'','F66':'','F69':'','F6C':'','F6F':'','F90':'','F93':'','F96':'','F99':'','F9C':'','F9F':'','FC0':'','FC3':'','FC6':'','FC9':'','FCC':'','FCF':'','FF0':'','FF3':'','FF6':'','FF9':'','FFC':'','FFF':'',}
#print post['derimagen'].value
im = Image.open( StringIO(post['derimagen'].value) )
im = im.convert('P', palette = Image.WEB)
im = im.convert('RGB')
pixels = numpy.asarray(im)
output= ""
for line in pixels:
for pixel in line:
color = ""
for value in pixel:
hex = "%X" % value
color += hex[0]
link = "[](/%s)" % map[color]
output += link
output += " blol"
else:
output = "N/A"
te = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'
te += '<body>'
te += '<script type="text/javascript">if(parent && typeof parent.lulz === "function") parent.lulz("' + output + '");</script>'
te += '</body></html>'
response_headers = [
('Content-Length', str(len(te))),
('Content-Type', 'text/html'),
]
start_response('200 OK', response_headers)
return [te]