コード例 #1
0
ファイル: spike-server.py プロジェクト: query67/spike
def spike_init():
    logging.info("Initializing Spike")
    timestamp = int(time())

    app = create_app(__get_config_file())
    db.init_app(app)

    with app.app_context():
        db.create_all()

    for r in rulesets_seeds:
        logging.info("Adding ruleset: %s", r)
        rmks = "Ruleset for %s / auto-created %s" % (
            r, strftime("%F - %H:%M", localtime(time())))
        db.session.add(NaxsiRuleSets(r, rmks, timestamp))
    for w in whitelists_seeds:
        logging.info("Adding whitelistset: %s", w)
        rmks = "Ruleset for %s / auto-created %s" % (
            w, strftime("%F - %H:%M", localtime(time())))
        db.session.add(NaxsiWhitelistSets(w, rmks, timestamp))
    try:
        db.session.commit()
    except SQLAlchemyError:
        logging.error(
            'It seems that the database was already initialized. Did you meant to run `%s run` instead?',
            sys.argv[0])
    logging.info('Spike initialization completed')
コード例 #2
0
ファイル: __init__.py プロジェクト: hljupkij/spike
 def setUp(self):
     app = create_app()
     db.init_app(app)
     app.config['TESTING'] = True
     self.app = app.test_client()
     self.created_rules = list()
     self.__create_rule()
コード例 #3
0
def run(debug=False):
    app = create_app(__get_config_file())
    db.init_app(app)

    if debug:
        app.test_request_context().push()

    try:
        host = app.config["APP_HOST"]
    except KeyError:
        host = '0.0.0.0'

    try:
        port = int(app.config["APP_PORT"])
    except KeyError:
        port = 5555

    app.run(debug=debug, host=host, port=port)
コード例 #4
0
ファイル: spike-server.py プロジェクト: hljupkij/spike
def run(debug=False):
    app = create_app(__get_config_file())
    db.init_app(app)

    if debug:
        app.test_request_context().push()

    try:
        host = app.config["APP_HOST"]
    except KeyError:
        host = '127.0.0.1'

    try:
        port = int(app.config["APP_PORT"])
    except KeyError:
        port = 5555

    app.run(debug=debug, host=host, port=port)
コード例 #5
0
ファイル: spike-server.py プロジェクト: hljupkij/spike
def spike_init():
    logging.info("Initializing Spike")
    timestamp = int(time())

    app = create_app(__get_config_file())
    db.init_app(app)

    with app.app_context():
        db.create_all()

    for r in rulesets_seeds:
        logging.info("Adding ruleset: %s", r)
        rmks = "Ruleset for %s / auto-created %s" % (r, strftime("%F - %H:%M", localtime(time())))
        db.session.add(NaxsiRuleSets(r, rmks, timestamp))
    for w in whitelists_seeds:
        logging.info("Adding whitelistset: %s", w)
        rmks = "Ruleset for %s / auto-created %s" % (w, strftime("%F - %H:%M", localtime(time())))
        db.session.add(NaxsiWhitelistSets(w, rmks, timestamp))
    try:
        db.session.commit()
    except SQLAlchemyError:
        logging.error('It seems that the database was already initialized. Did you meant to run `%s run` instead?',
                      sys.argv[0])
    logging.info('Spike initialization completed')
コード例 #6
0
ファイル: test_whitelists.py プロジェクト: nbs-system/spike
 def setUp(self):
     app = create_app()
     db.init_app(app)
     app.config['TESTING'] = True
     self.app = app.test_client()
     self.wid = self.__create_whitelist()
コード例 #7
0
ファイル: test_whitelists.py プロジェクト: ncmd/spike
 def setUp(self):
     app = create_app()
     db.init_app(app)
     app.config['TESTING'] = True
     self.app = app.test_client()
     self.wid = self.__create_whitelist()
コード例 #8
0
ファイル: test_misc.py プロジェクト: hljupkij/spike
 def setUp(self):
     app = create_app()
     db.init_app(app)
     app.config['TESTING'] = True
     self.app = app.test_client()
コード例 #9
0
 def setUp(self):
     app = create_app('../config.cfg')
     db.init_app(app)
     app.config['TESTING'] = True
     self.app = app.test_client()