web.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:CAPE 作者: ctxis 项目源码 文件源码
def download_report(task_id):
    if not task_id.isdigit():
        return HTTPError(code=404, output="The specified ID is invalid")

    report_path = os.path.join(CUCKOO_ROOT, "storage", "analyses", task_id, "reports", "report.html")

    if not os.path.exists(report_path):
        return HTTPError(code=404, output="Report not found")

    response.content_type = "text/html"
    response.set_header("Content-Disposition", "attachment; filename=cuckoo_task_{0}.html".format(task_id))

    return open(report_path, "rb").read()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号