Ejemplo n.º 1
0
from configobj import ConfigObj
from flask_login import LoginManager
import os
from validate import Validator
from CheshireCat.utils import hash_password
from WonderlandUtils import get_root_dir, get_first_file_that_exists, FileNotFound
from Doorknob.MongoDBWrapper import MongoDBWrapper

__all__ = ['app', 'create_app', 'run_app']

# Set to None so code will fail screaming if create_app or run_app haven't been called
app = None
login_manager = None

default_config_dirs = [
    os.path.join(get_root_dir(), "etc", "wonderland-engine")
]

def create_app(_config_dir=None, _config_filename='settings.cfg', _configspec_filename='configspec.cfg'):
    # Create Flask app
    global app
    app = Flask("CheshireCat")

    if _config_dir is not None:
        default_config_dirs.insert(0, _config_dir)

    configspec_path = get_first_file_that_exists(default_config_dirs, _configspec_filename)
    config_path = get_first_file_that_exists(default_config_dirs, _config_filename)

    if configspec_path is None:
        raise FileNotFound('configspec', default_config_dirs, _configspec_filename)
Ejemplo n.º 2
0
    packages=['WhiteRabbit', 'WhiteRabbit.checks', 'Doorknob', 'CheshireCat',
              'CheshireCat.blueprints', 'CheshireCat.blueprints.checks',
              'CheshireCat.blueprints.teams'],
    py_modules=['WonderlandUtils'],
    scripts=['run_cheshire_cat.py', 'run_white_rabbit.py'],

    install_requires=[
        'Flask',
        'Jinja2',
        'Werkzeug',
        'redis',
        'configobj',
        'pymongo',
        'py-bcrypt',
        'Flask-Login',
        'parcon',
        'argparse'
    ],

    data_files=[
        (os.path.join(get_root_dir(), 'etc', 'wonderland-engine'), ['configspec.cfg', 'settings.cfg'])
    ],

    test_suite='nose.collector',
    tests_require='nose',
    url='http://smartboyathome.github.com/Wonderland-Engine/',
    license='AGPL',
    author='smartboyathome',
    author_email='*****@*****.**',
    description='The Wonderland Cyber Defense Scoring Engine is a scoring engine for use in cyber defense competitions and practices. See the docs for more details.'
)