src.py 文件源码

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

项目:inshack-2017 作者: HugoDelval 项目源码 文件源码
def create_dishwasher(name: str, brand: str, cost: int, cve: str) -> str:
    try:
        query = "INSERT INTO dishwashers VALUES ('{inserted_by}', '{id}', '{object}')"
        id = get_new_id()
        new_dishwasher = DishWasher(id, name, brand, cost, cve)
        if "user" in request.cookies:
            inserted_by = base64.b64decode(request.cookies["user"]).decode('utf-8')
        else:
            inserted_by = "no one :("
        if len(inserted_by) > 255:
            return ""
        for c in inserted_by:
            if c not in string.printable[:-2]:
                return ""
        if re.search(r"sleep", inserted_by, flags=re.IGNORECASE):
            return ""
        if re.search(r"benchmark", inserted_by, flags=re.IGNORECASE):
            return ""
        if re.search(r"wait", inserted_by, flags=re.IGNORECASE):
            return ""
        if insert(query.format(id=id, object=yaml.dump(new_dishwasher), inserted_by=inserted_by)):
            return id
    except Exception as e:
        print(e, file=sys.stderr)
    return ""
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号