mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 06:24:23 +01:00
@@ -7,7 +7,7 @@ from sqlalchemy.engine.url import make_url
|
|||||||
from sqlalchemy.exc import OperationalError, ProgrammingError
|
from sqlalchemy.exc import OperationalError, ProgrammingError
|
||||||
from sqlalchemy_utils import database_exists, create_database
|
from sqlalchemy_utils import database_exists, create_database
|
||||||
|
|
||||||
from utils import get_config, set_config, cache, migrate, migrate_upgrade
|
from CTFd.utils import get_config, set_config, cache, migrate, migrate_upgrade
|
||||||
|
|
||||||
__version__ = '1.0.0'
|
__version__ = '1.0.0'
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import os
|
|||||||
|
|
||||||
##### GENERATE SECRET KEY #####
|
##### GENERATE SECRET KEY #####
|
||||||
|
|
||||||
with open('.ctfd_secret_key', 'a+') as secret:
|
with open('.ctfd_secret_key', 'a+b') as secret:
|
||||||
secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file
|
secret.seek(0) # Seek to beginning of file since a+ mode leaves you at the end and w+ deletes the file
|
||||||
key = secret.read()
|
key = secret.read()
|
||||||
if not key:
|
if not key:
|
||||||
@@ -23,7 +23,7 @@ class Config(object):
|
|||||||
|
|
||||||
http://flask.pocoo.org/docs/0.11/quickstart/#sessions
|
http://flask.pocoo.org/docs/0.11/quickstart/#sessions
|
||||||
'''
|
'''
|
||||||
SECRET_KEY = key
|
SECRET_KEY = os.environ.get('SECRET_KEY') or key
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from sqlalchemy.exc import DatabaseError
|
|||||||
|
|
||||||
|
|
||||||
def sha512(string):
|
def sha512(string):
|
||||||
return hashlib.sha512(string).hexdigest()
|
return str(hashlib.sha512(string).hexdigest())
|
||||||
|
|
||||||
|
|
||||||
def ip2long(ip):
|
def ip2long(ip):
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import os
|
|||||||
|
|
||||||
def init_plugins(app):
|
def init_plugins(app):
|
||||||
modules = glob.glob(os.path.dirname(__file__) + "/*")
|
modules = glob.glob(os.path.dirname(__file__) + "/*")
|
||||||
blacklist = {'keys', 'challenges'}
|
blacklist = {'keys', 'challenges', '__pycache__'}
|
||||||
for module in modules:
|
for module in modules:
|
||||||
module_name = os.path.basename(module)
|
module_name = os.path.basename(module)
|
||||||
if os.path.isdir(module) and module_name not in blacklist:
|
if os.path.isdir(module) and module_name not in blacklist:
|
||||||
|
|||||||
Reference in New Issue
Block a user