INNER CODE UNIT · Python

make_template

l4wio/CTF-challenges-by-me · 0x3004/250-XYZTemplate/app.py:83

def make_template():
	html = request.form['html']
	param = request.form['param']
	from os import urandom
	md5_id = md5(urandom(24)).hexdigest()
	insert_update_db('INSERT INTO data_templates VALUES(?,?,?,?)'
		,(md5_id,request.remote_addr,html,param))
	return redirect('/template/{0}'.format(md5_id))

@app.route('/template/<id_tmp>')
def template(id_tmp):
	row = fetch_one_db('SELECT html,param FROM data_templates WHERE id = ?',(id_tmp,))
	if row:
		return render_template('template.html',html=row[0],param=row[1],tmpid=id_tmp)
	else:
		return '?'

@app.route('/debug/<id_tmp>')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…