コード例 #1
0
ファイル: application.py プロジェクト: mlyzhong/faraday
    def __init__(self, args):
        self._original_excepthook = sys.excepthook

        self.args = args

        self._mappers_manager = MapperManager()

        self._model_controller = ModelController(self._mappers_manager)

        self._plugin_manager = PluginManager(
            os.path.join(CONF.getConfigPath(), "plugins"))

        self._workspace_manager = WorkspaceManager(self._mappers_manager)

        # Create a PluginController and send this to UI selected.
        self._plugin_controller = PluginController('PluginController',
                                                   self._plugin_manager,
                                                   self._mappers_manager)

        if self.args.cli:
            self.app = CliApp(self._workspace_manager, self._plugin_controller)
            CONF.setMergeStrategy("new")
        else:
            self.app = UiFactory.create(self._model_controller,
                                        self._plugin_manager,
                                        self._workspace_manager,
                                        self._plugin_controller, self.args.gui)

        self.timer = TimerClass()
        self.timer.start()
コード例 #2
0
    def __init__(self):

        super(RawReportProcessor, self).__init__()
        from faraday import setupPlugins
        setupPlugins()

        self.pending_actions = Queue()

        try:
            plugin_manager = PluginManager(
                os.path.join(CONF.getConfigPath(), "plugins"))
        except AttributeError:
            get_logger().warning(
                "Upload reports in WEB-UI not configurated, run Faraday client and try again..."
            )
            self._stop = True
            return

        mappers_manager = MapperManager()

        self.model_controller = ModelController(mappers_manager,
                                                self.pending_actions)
        self.model_controller.start()
        self.end_event = Event()

        plugin_controller = PluginController('PluginController',
                                             plugin_manager, mappers_manager,
                                             self.pending_actions,
                                             self.end_event)

        self.processor = ReportProcessor(plugin_controller, None)
        self._stop = False
コード例 #3
0
ファイル: application.py プロジェクト: x0james/faraday
    def __init__(self, args):
        self._original_excepthook = sys.excepthook

        self.args = args

        logger = getLogger(self)
        if args.creds_file:
            try:
                with open(args.creds_file, 'r') as fp:
                    creds = json.loads(fp.read())
                    username = creds.get('username')
                    password = creds.get('password')
                    session_cookie = login_user(CONF.getServerURI(), username,
                                                password)
                    if session_cookie:
                        logger.info('Login successful')
                        CONF.setDBUser(username)
                        CONF.setDBSessionCookies(session_cookie)
                    else:
                        logger.error('Login failed')
            except (IOError, ValueError):
                logger.error("Credentials file couldn't be loaded")

        self._mappers_manager = MapperManager()
        pending_actions = Queue()
        self._model_controller = ModelController(self._mappers_manager,
                                                 pending_actions)

        self._plugin_manager = PluginManager(
            os.path.join(CONF.getConfigPath(), "plugins"),
            pending_actions=pending_actions,
        )

        self._workspace_manager = WorkspaceManager(self._mappers_manager)

        # Create a PluginController and send this to UI selected.
        self._plugin_controller = PluginController('PluginController',
                                                   self._plugin_manager,
                                                   self._mappers_manager,
                                                   pending_actions)

        if self.args.cli:

            self.app = CliApp(self._workspace_manager, self._plugin_controller)

            if self.args.keep_old:
                CONF.setMergeStrategy("old")
            else:
                CONF.setMergeStrategy("new")

        else:
            self.app = UiFactory.create(self._model_controller,
                                        self._plugin_manager,
                                        self._workspace_manager,
                                        self._plugin_controller, self.args.gui)

        self.timer = TimerClass()
        self.timer.start()
コード例 #4
0
ファイル: reports.py プロジェクト: PortSwigger/faraday_old
def import_external_reports(workspace_name=None, disable_polling=False):
    plugins_path = os.path.join(CONF.getConfigPath(), "plugins")
    plugin_manager = PluginManager(plugins_path)
    mappers_manager = MapperManager()

    if workspace_name:
        query = Workspace.query.filter_by(name=workspace_name)
    else:
        query = Workspace.query

    process_workspaces(mappers_manager, plugin_manager, query, disable_polling)