web

Very Safe Ninja

Punkty: 162
Rozwiązań: 27

Yet another very customizable page creator.

https://verysafeninja.ecsc19.hack.cert.pl


Source code:

import binascii
import os
import flask
import subprocess

from flask import Flask, render_template_string, request, abort, render_template

app = Flask(__name__)

basedir = os.path.abspath(os.path.dirname(__file__))

@app.route('/', methods=['GET', 'POST'])
def new_page():
    if request.method == 'POST':
        file = request.files.get('content', None)
        title = request.form.get('title', None)
        if file:
            content = file.read().decode('utf8')

            bad_characters = ''''"|.'''

            if title:
                content = '<title>{{ title }}</title>' + content

            for char in bad_characters:
                content = content.replace(char, "")

            return render_template_string(content, title=title)
    return render_template('form.html')

Format flagi: ecsc19{litery_cyfry_i_znaki_specjalne}.

Aby wysłać flagę, musisz się zalogować.