Esempio n. 1
0
    def agents(self):

        analyzer_data = list(self._get_analyzers(env.request.parameters.getlist("status")))
        list(hookmanager.trigger("HOOK_AGENTS_EXTRA_CONTENT", analyzer_data))
        extra_columns = filter(None, hookmanager.trigger("HOOK_AGENTS_EXTRA_COLUMN"))

        return view.ViewResponse(template.PrewikkaTemplate(__name__, "templates/agents.mak").render(data=analyzer_data, extra_columns=extra_columns), menu=mainmenu.HTMLMainMenu())
Esempio n. 2
0
    def draw(self):
        dataset = self.view_template.dataset()
        data = self.setup(dataset)
        if data:
            return data

        return view.ViewResponse(
            dataset.render(),
            menu=mainmenu.HTMLMainMenu(**self._mainmenu_options))
Esempio n. 3
0
    def forensic(self, groupby=[], is_dashboard=False):
        groupby = env.request.parameters.getlist("groupby") or groupby
        query = env.request.parameters.get("query")
        mode = env.request.parameters.get("query_mode",
                                          self.criterion_config_default)

        if groupby and not (is_dashboard):
            raise error.RedirectionError(
                url_for(".dashboard",
                        query=query,
                        groupby=groupby,
                        query_mode=mode), 302)

        if not groupby and is_dashboard:
            groupby = self.groupby_default

        dataset = self._get_dataset()
        self._set_common(dataset)

        dataset["available_types"] = filter(
            lambda x: list(env.renderer.get_backends(x)) and x != "table",
            DiagramChart.TYPES if groupby else ChronologyChart.TYPES)
        dataset["chart_type"] = env.request.parameters.get(
            "chart_type",
            _DEFAULT_CHART_TYPES["diagram" if groupby else "chronology"])
        dataset["groupby_tempo"] = _TEMPORAL_VALUES
        dataset["fields_info"] = self.fields_info
        dataset["actions"] = itertools.chain(
            self.get_forensic_actions(),
            self._trigger_datasearch_hook("ACTION"))
        dataset["search"] = self.query_parser(
            query,
            groupby=groupby,
            limit=env.request.parameters["limit"],
            parent=self)
        dataset["extra_resources"] = self._extra_resources
        dataset["common_paths"] = {
            path.split(".", 1)[-1]: _(label)
            for label, path in env.dataprovider.get_common_paths(self.type,
                                                                 index=True)
        }
        dataset["expert_enabled"] = self.expert_enabled

        return view.ViewResponse(dataset)
Esempio n. 4
0
    def riskoverview(self):
        # Don't show the risk overview if the user is not logged in
        if not env.request.user:
            return

        # We don't use groupby because the result won't be sorted then.
        objs = collections.OrderedDict((w, None) for w in self._widgets)

        for i in filter(
                None,
                hookmanager.trigger("HOOK_RISKOVERVIEW_DATA",
                                    _except=env.log.debug)):
            if i.name not in objs and self._widgets:
                continue
            elif objs.get(i.name) is None:
                objs[i.name] = i
            else:
                for j in i.data:
                    objs[i.name].data.append(j)

        return view.ViewResponse(
            template.PrewikkaTemplate(__name__, "templates/table.mak").render(
                data=filter(None, objs.values())))
Esempio n. 5
0
 def about(self):
     return view.ViewResponse(template.PrewikkaTemplate(__name__, "templates/about.mak"))