def daemon_main(listen_address, listen_port, server_push): # Get the config file name. config_file = get_default_config_file() if not config_file: raise RuntimeError("Could not find config file, aborting!") # Load the Orchestrator options. orchestrator_config = OrchestratorConfig() orchestrator_config.config_file = config_file orchestrator_config.from_config_file(orchestrator_config.config_file, allow_profile = True) if orchestrator_config.profile: orchestrator_config.profile_file = get_profile( orchestrator_config.profile) if orchestrator_config.profile_file: orchestrator_config.from_config_file( orchestrator_config.profile_file) else: raise RuntimeError("Could not find profile, aborting!") # Get the plugins folder from the parameters. # If no plugins folder is given, use the default. plugins_folder = orchestrator_config.plugins_folder if not plugins_folder: plugins_folder = path.abspath(__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): from golismero import common plugins_folder = path.abspath(common.__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): raise RuntimeError( "Default plugins folder not found, aborting!") orchestrator_config.plugins_folder = plugins_folder # Load the daemon configuration from command line. if listen_address: orchestrator_config.listen_address = listen_address if listen_port: orchestrator_config.listen_port = listen_port if server_push: orchestrator_config.server_push = server_push # Force the daemon UI plugin. orchestrator_config.ui_mode = "daemon" # Force disable colored output. orchestrator_config.color = False # Force maximum verbosity level. orchestrator_config.verbose = Logger.MORE_VERBOSE # Launch GoLismero. launcher.run(orchestrator_config)
def main(): # Get the config file name. config_file = get_default_config_file() if not config_file: raise RuntimeError("Could not find config file, aborting!") # Load the Orchestrator options. orchestrator_config = OrchestratorConfig() orchestrator_config.ui_mode = "web" orchestrator_config.color = False orchestrator_config.config_file = config_file orchestrator_config.from_config_file(orchestrator_config.config_file, allow_profile=True) if orchestrator_config.profile: orchestrator_config.profile_file = get_profile( orchestrator_config.profile) if orchestrator_config.profile_file: orchestrator_config.from_config_file( orchestrator_config.profile_file) else: raise RuntimeError("Could not find profile, aborting!") # Get the plugins folder from the parameters. # If no plugins folder is given, use the default. plugins_folder = orchestrator_config.plugins_folder if not plugins_folder: plugins_folder = path.abspath(__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): from golismero import common plugins_folder = path.abspath(common.__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): raise RuntimeError( "Default plugins folder not found, aborting!") orchestrator_config.plugins_folder = plugins_folder # Check if all options are correct. orchestrator_config.check_params() # Launch GoLismero. launcher.run(orchestrator_config)
def main(): # Get the config file name. config_file = get_default_config_file() if not config_file: raise RuntimeError("Could not find config file, aborting!") # Load the Orchestrator options. orchestrator_config = OrchestratorConfig() orchestrator_config.ui_mode = "web" orchestrator_config.colorize = False orchestrator_config.config_file = config_file orchestrator_config.from_config_file(orchestrator_config.config_file, allow_profile = True) if orchestrator_config.profile: orchestrator_config.profile_file = get_profile(orchestrator_config.profile) if orchestrator_config.profile_file: orchestrator_config.from_config_file(orchestrator_config.profile_file) else: raise RuntimeError("Could not find profile, aborting!") # Get the plugins folder from the parameters. # If no plugins folder is given, use the default. plugins_folder = orchestrator_config.plugins_folder if not plugins_folder: plugins_folder = path.abspath(__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): from golismero import common plugins_folder = path.abspath(common.__file__) plugins_folder = path.dirname(plugins_folder) plugins_folder = path.join(plugins_folder, "plugins") if not path.isdir(plugins_folder): raise RuntimeError("Default plugins folder not found, aborting!") orchestrator_config.plugins_folder = plugins_folder # Check if all options are correct. orchestrator_config.check_params() # Launch GoLismero. launcher.run(orchestrator_config)
def test(): config = OrchestratorConfig() config.from_dictionary({ "plugins_folder": path.abspath(path.join(here, "plugin_tests")), "ui_mode": "test", }) audit = AuditConfig() audit.from_dictionary({ "targets": [ "http://www.example.com/folder/subfolder/index.html", ], "reports": [ "-", ], "audit_db": "sqlite://", }) ##audit.plugin_load_overrides = [(True, "recon/test")] # XXX DEBUG shorter run try: print "Launching GoLismero..." print t1 = time.time() code = run(config, audit) t2 = time.time() print print "GoLismero ran for %f seconds" % (t2 - t1) print assert code == 0 print "Validating the audit database..." print validate(audit.audit_name) finally: print "Cleaning up..." print try: os.unlink("%s.db" % audit.audit_name) except Exception: pass print "Done!"
def test(): config = OrchestratorConfig() config.from_dictionary({ "plugins_folder": path.abspath(path.join(here, "plugin_tests")), "ui_mode": "test", }) audit = AuditConfig() audit.from_dictionary({ "targets": ["http://www.example.com/folder/subfolder/index.html",], "reports": ["-",], "audit_db": "", }) ##audit.plugin_load_overrides = [(True, "recon/test")] # XXX DEBUG shorter run try: print "Launching GoLismero..." print t1 = time.time() code = run(config, audit) t2 = time.time() print print "GoLismero ran for %f seconds" % (t2 - t1) print assert code == 0 print "Validating the audit database..." print validate(audit) finally: print "Cleaning up..." print try: os.unlink("%s.db" % audit.audit_name) except Exception: pass print "Done!"
# Check the settings with the UI plugin. try: ui_plugin.check_params(cmdParams, auditParams) except Exception, e: ##raise # XXX DEBUG msg = str(e) if not msg: msg = "configuration error!" elif msg == "No targets selected for audit.": msg = "no targets selected for audit " \ "(did you misspell the database filename?)" parser.error(msg) # Launch GoLismero. launcher.run(cmdParams, auditParams) exit(0) #------------------------------------------------------------------------------ def expand_wildcards(filenames): expanded = [] for filename in filenames: if "*" in filename or "?" in filename: expanded.extend(glob(filename)) else: expanded.append(filename) return expanded #------------------------------------------------------------------------------
# Load the UI plugin. ui_plugin_id = "ui/" + cmdParams.ui_mode ui_plugin = manager.load_plugin_by_id(ui_plugin_id) # Show an error message if something goes wrong. except Exception, e: ##raise # XXX DEBUG parser.error("error loading plugins: %s" % str(e)) # Check the settings with the UI plugin. try: ui_plugin.check_params(cmdParams, auditParams) except Exception, e: ##raise # XXX DEBUG msg = str(e) if not msg: msg = "configuration error!" parser.error(msg) #-------------------------------------------------------------------------- # Launch GoLismero. launcher.run(cmdParams, auditParams) exit(0) #------------------------------------------------------------------------------ if __name__ == '__main__': main()