def check_logged_in(): rval = [] try: wrapdb.connect() cookie = Cookie.SimpleCookie(os.environ["HTTP_COOKIE"]) if ('user' in cookie) and ('pass' in cookie): user = cookie['user'].value password = cookie['pass'].value if user and password: doublecheck_user(user) doublecheck_pass(password) if wrapdb.user_check_creds(user, hashlib.sha1(password).hexdigest()): rval = [user, password] except (Cookie.CookieError, KeyError): rval = [] wrapdb.disconnect() return rval
def footer(self): try: wrapdb.connect() print ' <hr>' print ' <div style="text-align: right; font-size: small">' mods = ', '.join(wrapdb.stat_get_moderators()) print ' Moderators: %s<br>' % mods print ' Crackmes.us is devoid of adverts and JS<br>' print ' © 2011 whatever' except Exception, e: print '<p>ERROR accessing moderators</p>'
import random import wrapdb import common import Cookie import cgi if ('HTTP_HOST' in os.environ) and (os.environ['HTTP_HOST'] == 'localhost'): import cgitb cgitb.enable() page = common.PageLayout('index.py') page.startPage() wrapdb.connect() data = wrapdb.posts_get_latest() print '<br>' fields = {'display_title':'Latest Crackmes', \ 'title':1, \ 'author':1, \ 'date_posted':1, \ 'date_activity':1, \ 'num_replies':1, \ 'score':1, \ 'num_votes':1, \ 'downloads':1, \ 'solver':1 }