Пример #1
0
    def get_extra_context_data(self, probe):
        # queries
        schedule = []
        for idx, osquery in enumerate(probe.get('osquery', {}).get('schedule', [])):
            # query links. match query_name.
            osquery_ctx = {}
            query_links = []
            query_name = "{}_{}".format(probe['name'], idx)
            for store in stores:
                url = store.get_visu_url({'name': [query_name]})
                if url:
                    query_links.append((store.name, url))
            query_links.sort()
            osquery_ctx['links'] = query_links
            osquery_ctx['html_query'] = format_sql(osquery['query'])
            osquery_ctx['interval'] = osquery['interval']
            osquery_ctx['value'] = osquery.get('value', None)
            osquery_ctx['description'] = osquery.get('description', None)
            schedule.append(osquery_ctx)

        # probe links. query name starts with probe name.
        probe_links = []
        for store in stores:
            url = store.get_visu_url({'name__startswith': [probe['name']]})
            if url:
                probe_links.append((store.name, url))
        probe_links.sort()

        return {'osquery_schedule': schedule,
                'osquery_file_paths': probe.get('osquery', {}).get('file_paths', {}),
                'probe_links': probe_links}
Пример #2
0
 def get_extra_context(self):
     # queries
     schedule = []
     for query_name, osquery_query in self.iter_schedule_queries():
         # query links. match query_name.
         osquery_ctx = {}
         query_links = []
         for store in stores:
             url = store.get_visu_url("osquery_result",
                                      {'name': [query_name]})
             if url:
                 query_links.append((store.name, url))
         query_links.sort()
         osquery_ctx['links'] = query_links
         osquery_ctx['html_query'] = format_sql(osquery_query['query'])
         osquery_ctx['interval'] = osquery_query.get('interval', None)
         osquery_ctx['value'] = osquery_query.get('value', None)
         osquery_ctx['description'] = osquery_query.get('description', None)
         schedule.append(osquery_ctx)
     return {'osquery_schedule': schedule,
             'osquery_file_paths': self.file_paths}
Пример #3
0
 def html_query(self):
     return format_sql(self.query)
Пример #4
0
 def get_sql_html(self):
     return format_sql(self.sql)
Пример #5
0
 def get_query_html(self):
     return format_sql(self.query)
Пример #6
0
 def get_query_html(self):
     if self.query:
         return format_sql(self.query)
Пример #7
0
 def get_discovery_display(self):
     for discovery in self.discovery:
         yield format_sql(discovery)
Пример #8
0
 def get_distributed_query_html(self):
     return format_sql(self.distributed_query)
Пример #9
0
 def get_discovery_display(self):
     for discovery in self.discovery:
         yield format_sql(discovery)
Пример #10
0
 def get_distributed_query_html(self):
     return format_sql(self.distributed_query)