#!/usr/bin/python from bottle import route, run, post, get, request, response, redirect import os, os.path, base64, commands TEMPLATE = """

idk man ofb is crap

a poorly encrypted image hosting service

upload images, acquire openssl enc -des-ofb -S 0 -K 0 -iv 0

sores code donut hack

""" def randomshit(length=8): return base64.b32encode(os.urandom(50)).lower()[:length] @get('/') def index(): return TEMPLATE @post('/') def index(): file = request.files.get('file') name, ext = os.path.splitext(file.filename) if ext not in ('.png','.jpg','.jpeg', '.gif', '.bmp', '.tga'): return 'File extension not allowed.' path = "./tmp/" + randomshit(16) + ext file.save(path) hash = commands.getoutput("md5sum " + path).split()[0] outpath = "./out/" + hash + ".jpg" if not os.path.exists(outpath): size = commands.getoutput("identify " + path).split()[2] data = commands.getoutput("convert %s rgb:- | " "openssl enc -des-ofb -S 0 -K 0 -iv 0 | " "convert -size %s -depth 8 rgb:- %s 2>/dev/null" % (path, size, outpath)) os.unlink(path) return TEMPLATE + "" % outpath run(server='cgi', debug=True)