CoolFace
Apppublic

vishalbhat07/ctfd

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
export.py29 linesDownload Raw Back to root
1from CTFd import create_app2from CTFd.utils import config3from CTFd.utils.exports import export_ctf4 5import datetime6import sys7import shutil8 9 10app = create_app()11with app.app_context():12    print(13        "This file will be deleted in CTFd v4.0. Switch to using `python manage.py export_ctf`"14    )15    backup = export_ctf()16 17    if len(sys.argv) > 1:18        with open(sys.argv[1], "wb") as target:19            shutil.copyfileobj(backup, target)20    else:21        ctf_name = config.ctf_name()22        day = datetime.datetime.now().strftime("%Y-%m-%d_%T")23        full_name = "{}.{}.zip".format(ctf_name, day)24 25        with open(full_name, "wb") as target:26            shutil.copyfileobj(backup, target)27 28        print("Exported {filename}".format(filename=full_name))29