XSS_Payload_Detector / test_server.py
kd7979148's picture
Update test_server.py
636d073 verified
# -*- coding: utf-8 -*-
from flask import (
Flask,
request,
render_template
)
app = Flask(__name__)
@app.route("/", methods=["GET", "POST"])
def home():
#################################################
# save logs
#################################################
with open("access.log", "a", encoding="utf-8") as f:
log = (
f'{request.remote_addr} - '
f'"{request.method} {request.full_path} HTTP/1.1"\n'
)
f.write(log)
f.flush()
#################################################
# q param
#################################################
q = request.args.get("q", "")
#################################################
# html render
#################################################
return render_template(
"index.html",
q=q
)
if __name__ == "__main__":
app.run(
host="0.0.0.0",
port=8080,
debug=False
)