刷题笔记-[观安杯]ezweb


前言

[flask|文件覆盖]

from flask import Flask, request, Response
from requests import  get
app = Flask(__name__)


@app.route('/')
def index():
    return Response(open(__file__).read(), mimetype='text/plain')


@app.route('/upload', methods=["POST"])
def upload_post():
    if "file" not in request.files:
        return "File format error"
    file = request.files['file']
    if file.filename == '':
        return "File format error"
    file.save("./uploads/" + file.filename)
    return f"Upload success! Saved {file.filename}"


@app.route('/flag')
def check():
    flag = open("/flag").read()
    get(f"http://localhost/{flag}")
    return "Flag is already sent"

if __name__ == '__main__':
    app.run("0.0.0.0","80")

题解

上传requests.py,修改get()函数即可。

如果出网直接请求https://beeceptor.com/

不出网就写文件到upload。


文章作者: 巡璃
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 巡璃 !
评论
  目录