(self)
| 2722 | return r_name, node |
| 2723 | |
| 2724 | def _set_events_query(self): |
| 2725 | if self.tabWidget.currentIndex() != self.TAB_MAIN: |
| 2726 | return |
| 2727 | |
| 2728 | model = self.TABLES[self.TAB_MAIN]['view'].model() |
| 2729 | qstr = self._db.get_query(self.TABLES[self.TAB_MAIN]['name'], self.TABLES[self.TAB_MAIN]['display_fields']) |
| 2730 | |
| 2731 | filter_text = self.filterLine.text() |
| 2732 | action = "" |
| 2733 | if self.comboAction.currentIndex() == 1: |
| 2734 | action = "action = \"{0}\"".format(Config.ACTION_ALLOW) |
| 2735 | elif self.comboAction.currentIndex() == 2: |
| 2736 | action = "action = \"{0}\"".format(Config.ACTION_DENY) |
| 2737 | elif self.comboAction.currentIndex() == 3: |
| 2738 | action = "action = \"{0}\"".format(Config.ACTION_REJECT) |
| 2739 | |
| 2740 | # FIXME: use prepared statements |
| 2741 | if filter_text == "": |
| 2742 | if action != "": |
| 2743 | qstr += " WHERE " + action |
| 2744 | else: |
| 2745 | if action != "": |
| 2746 | action += " AND " |
| 2747 | qstr += " WHERE " + action + " (" \ |
| 2748 | " process LIKE '%" + filter_text + "%'" \ |
| 2749 | " OR process_args LIKE '%" + filter_text + "%'" \ |
| 2750 | " OR src_port LIKE '%" + filter_text + "%'" \ |
| 2751 | " OR src_ip LIKE '%" + filter_text + "%'" \ |
| 2752 | " OR dst_ip LIKE '%" + filter_text + "%'" \ |
| 2753 | " OR dst_host LIKE '%" + filter_text + "%'" \ |
| 2754 | " OR dst_port LIKE '%" + filter_text + "%'" \ |
| 2755 | " OR rule LIKE '%" + filter_text + "%'" \ |
| 2756 | " OR node LIKE '%" + filter_text + "%'" \ |
| 2757 | " OR time LIKE '%" + filter_text + "%'" \ |
| 2758 | " OR uid LIKE '%" + filter_text + "%'" \ |
| 2759 | " OR pid LIKE '%" + filter_text + "%'" \ |
| 2760 | " OR protocol LIKE '%" + filter_text + "%')" \ |
| 2761 | |
| 2762 | qstr += self._get_order() + self._get_limit() |
| 2763 | self.setQuery(model, qstr) |
| 2764 | |
| 2765 | def _set_nodes_query(self, data): |
| 2766 | model = self._get_active_table().model() |
no test coverage detected