mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
Marking 1.0.0 (#196)
* Use <int:xxx> in routes to prevent some errors 500 (#192) * Use first_or_404() to prevent some errors 500 (#193) * Add a populating script for awards. (#191) * Creating upload_file util * Marking 1.0.0 in __init__ and starting database migrations * Upgrading some more HTML * Adding CHANGELOG.md
This commit is contained in:
17
populate.py
17
populate.py
@@ -6,12 +6,13 @@ import hashlib
|
||||
import random
|
||||
|
||||
from CTFd import create_app
|
||||
from CTFd.models import Teams, Solves, Challenges, WrongKeys, Keys, Files
|
||||
from CTFd.models import Teams, Solves, Challenges, WrongKeys, Keys, Files, Awards
|
||||
|
||||
app = create_app()
|
||||
|
||||
USER_AMOUNT = 50
|
||||
CHAL_AMOUNT = 20
|
||||
AWARDS_AMOUNT = 5
|
||||
|
||||
categories = [
|
||||
'Exploitation',
|
||||
@@ -270,6 +271,20 @@ if __name__ == '__main__':
|
||||
|
||||
db.session.commit()
|
||||
|
||||
# Generating Awards
|
||||
print("GENERATING AWARDS")
|
||||
for x in range(USER_AMOUNT):
|
||||
base_time = datetime.datetime.utcnow() + datetime.timedelta(minutes=-10000)
|
||||
for _ in range(random.randint(0, AWARDS_AMOUNT)):
|
||||
award = Awards(x + 1, gen_word(), random.randint(-10, 10))
|
||||
new_base = random_date(base_time, base_time + datetime.timedelta(minutes=random.randint(30, 60)))
|
||||
award.date = new_base
|
||||
base_time = new_base
|
||||
|
||||
db.session.add(award)
|
||||
|
||||
db.session.commit()
|
||||
|
||||
# Generating Wrong Keys
|
||||
print("GENERATING WRONG KEYS")
|
||||
for x in range(USER_AMOUNT):
|
||||
|
||||
Reference in New Issue
Block a user