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')
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()
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)
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)
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')
def setUp(self): app = create_app() db.init_app(app) app.config['TESTING'] = True self.app = app.test_client() self.wid = self.__create_whitelist()
def setUp(self): app = create_app() db.init_app(app) app.config['TESTING'] = True self.app = app.test_client()
def setUp(self): app = create_app('../config.cfg') db.init_app(app) app.config['TESTING'] = True self.app = app.test_client()