def default(self): """Default command""" host = None port = None # Check for hostname if self.app.pargs.host: host = self.app.pargs.host # Check for port if self.app.pargs.port: port = int(self.app.pargs.port) # Read SQLite data if self.app.pargs.filename: from smalisca.modules.module_sql_models import AppSQLModel # Read SQLite data appSQL = AppSQLModel(self.app.pargs.filename) log.info("Successfully opened SQLite DB") # Create API endpoints flask_app = create_flask_app() # Start web server log.info("Starting web application ...") web_server = WebServer(host, port, flask_app) web_server.create_blueprints(appSQL.get_session()) web_server.run()
def default(self): """Default command""" host = None port = None # Check for hostname if self.app.pargs.host: host = self.app.pargs.host # Check for port if self.app.pargs.port: port = int(self.app.pargs.port) # Read SQLite data if self.app.pargs.filename: from smalisca.modules.module_sql_models import AppSQLModel # Read SQLite data appSQL = AppSQLModel(self.app.pargs.filename) log.info("Successfully opened SQLite DB") # Create API endpoints flask_app = create_flask_app() # Start web server log.info("Starting web application ...") web_server = WebServer(host, port, flask_app) web_server.create_blueprints(appSQL.get_session()) web_server.run()
def default(self): """Default command""" if (self.app.pargs.filename) and (self.app.pargs.fileformat): # Create new app app = App(__name__) # Analysis obj analysis = None # Check for config file if self.app.pargs.config_file: config.smalisca_conf.read(self.app.pargs.config_file) else: log.info("Using default conf (%s)" % config.PROJECT_CONF) config.smalisca_conf.read(config.PROJECT_CONF) config.smalisca_conf.parse() # Read SQLite data if self.app.pargs.fileformat == "sqlite": from smalisca.analysis.analysis_sqlite import AnalyzerSQLite from smalisca.modules.module_sql_models import AppSQLModel # Read SQLite data appSQL = AppSQLModel(self.app.pargs.filename) log.info("Successfully opened SQLite DB") # Create analysis framework log.info("Creating analyzer framework ...") analysis = AnalyzerSQLite(appSQL.get_session()) # Where to read commands from? if self.app.pargs.commands_file: commands = open(self.app.pargs.commands_file, "rt") try: log.info("Reading commands from %s" % self.app.pargs.commands_file) cmd_shell = AnalyzerShell(analysis) cmd_shell.use_rawinput = False cmd_shell.stdin = commands cmd_shell.prompt = '' cmd_shell.cmdloop() finally: commands.close() else: # Start new shell log.info("Starting new analysis shell") cmd_shell = AnalyzerShell(analysis) cmd_shell.cmdloop()
def default(self): """Default command""" if (self.app.pargs.filename) and (self.app.pargs.fileformat): # Create new app app = App(__name__) # Analysis obj analysis = None # Check for config file if self.app.pargs.config_file: config.smalisca_conf.read(self.app.pargs.config_file) else: log.info("Using default conf (%s)" % config.PROJECT_CONF) config.smalisca_conf.read(config.PROJECT_CONF) config.smalisca_conf.parse() # Read SQLite data if self.app.pargs.fileformat == "sqlite": from smalisca.analysis.analysis_sqlite import AnalyzerSQLite from smalisca.modules.module_sql_models import AppSQLModel # Read SQLite data appSQL = AppSQLModel(self.app.pargs.filename) log.info("Successfully opened SQLite DB") # Create analysis framework log.info("Creating analyzer framework ...") analysis = AnalyzerSQLite(appSQL.get_session()) # Where to read commands from? if self.app.pargs.commands_file: commands = open(self.app.pargs.commands_file, "rt") try: log.info("Reading commands from %s" % self.app.pargs.commands_file) cmd_shell = AnalyzerShell(analysis) cmd_shell.use_rawinput = False cmd_shell.stdin = commands cmd_shell.prompt = '' cmd_shell.cmdloop() finally: commands.close() else: # Start new shell log.info("Starting new analysis shell") cmd_shell = AnalyzerShell(analysis) cmd_shell.cmdloop()