#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import auth def printpdf(): print "Content-Type: application/pdf" print f = open('howtostart2.pdf', "rb") for data in f: sys.stdout.write(data) f.close() if __name__ == '__main__': # check auth a = auth.check_auth() if a == None: auth.html("please login.") # set reading flag d = a.getdata() d.setdefault("howto", 1) d["howto"] = 1 a.setdata(d) # print PDF file printpdf() sys.exit(0)
#!/usr/bin/env python # -*- coding: utf-8 -*- import auth if __name__ == '__main__': # check auth a = auth.check_auth() if a == None: auth.html("login") # print cleard levels from database d = a.getdata() if "howto" in d.keys(): r = "clear?" else: r = "cleard" for k in d.keys(): if not k[0] == 'l': continue try: num = int(k[1:]) r += ("," + str(num)) except: continue auth.html(r)
# flag: clear flag (1=cleard, 0=uncleard) # addr: ip address of first correct player if database_keywd in d.keys(): d[database_keywd]["flag"] = 1 else: d.setdefault(database_keywd, {}) d[database_keywd].setdefault("flag", 1) d[database_keywd].setdefault("addr", get_ip_address()) return d if __name__ == '__main__': # passwd list pwlt = { # Reading "l0":"16011", "l1":"523776", "l2":"3628800", "l3":"strchr", "l4":"memset", "l5":"15485863", "l6":"2.38800", "l7":"WindowsProgram", "l8":"base64", "l9":"aAaA", # Writing "l10":"worldtrigger", "l11":"BabySteps", "l12":"MagicaMadoca", "l13":"Nyanpath", "l14":"PazzDra", "l15":"LAstEsCaPE", } # check auth a = auth.check_auth() if a == None: auth.html("login") # check answer if check_answer(pwlt, a) == 0: auth.html("err") auth.html("ok")
#!/usr/bin/env python # -*- coding: utf-8 -*- import auth import myCookie if __name__ == '__main__': # check auth a = auth.check_auth() if a == None: auth.html("login") # print cleard levels from database c = myCookie.myCookie() print c.deletecookie("session") auth.html("login")
return hashlib.sha1(magic + tmp + sid).hexdigest() def checkcode(idnt, code): if makecode(idnt) != code: return 1 return 0 if __name__ == "__main__": a = myAccount.myAccount() form = cgi.FieldStorage() # make code routine if "sid" in form: auth.html(makecode(form.getvalue("sid"))) # regist routine # check code and idnt if "idnt" not in form or "code" not in form: auth.html("err") idnt = form.getvalue("idnt") code = form.getvalue("code") if checkcode(idnt, code) == 1: auth.html("err") # check captcha if "capt" not in form: auth.html("err") capt = form.getvalue("capt") if checkcapt(idnt, capt) == 1:
return hashlib.sha1(magic + tmp + sid).hexdigest() def checkcode(idnt, code): if makecode(idnt) != code: return 1 return 0 if __name__ == '__main__': a = myAccount.myAccount() form = cgi.FieldStorage() # make code routine if "sid" in form: auth.html(makecode(form.getvalue("sid"))) # regist routine # check code and idnt if "idnt" not in form or "code" not in form: auth.html("err") idnt = form.getvalue("idnt") code = form.getvalue("code") if checkcode(idnt, code) == 1: auth.html("err") # check captcha if "capt" not in form: auth.html("err") capt = form.getvalue("capt") if checkcapt(idnt, capt) == 1: