From 740465a44706e518c3ac7fef87e09df2c181ebbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Mon, 10 Feb 2025 00:58:40 +0100 Subject: [PATCH] ui: improved search in detail views Allow to filter by more fields. --- ui/opensnitch/dialogs/stats.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/opensnitch/dialogs/stats.py b/ui/opensnitch/dialogs/stats.py index d54e5c49..4fb25597 100644 --- a/ui/opensnitch/dialogs/stats.py +++ b/ui/opensnitch/dialogs/stats.py @@ -3377,7 +3377,7 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): where = qstr.split("WHERE")[1] # get SELECT ... WHERE (*) ands = where.split("AND (")[0] # get WHERE (*) AND (...) qstr = qstr.split("WHERE")[0] # get * WHERE ... - qstr += "WHERE %s" % ands + qstr += "WHERE %s" % ands.lstrip() # if there's no text to filter, strip the filter "AND ()", and # return the original query. @@ -3389,7 +3389,9 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): "c.pid LIKE '%{0}%' OR " \ "c.protocol LIKE '%{0}%' OR " \ "c.src_port LIKE '%{0}%' OR " \ - "c.src_ip LIKE '%{0}%' OR ".format(text) + "c.src_ip LIKE '%{0}%' OR " \ + "c.process_cwd LIKE '%{0}%' OR " \ + "c.rule LIKE '%{0}%' OR ".format(text) # exclude from query the field of the view we're filtering by if self.IN_DETAIL_VIEW[cur_idx] != self.TAB_PORTS: @@ -3400,6 +3402,8 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]): qstr += "c.dst_host LIKE '%{0}%' OR ".format(text) if self.IN_DETAIL_VIEW[cur_idx] != self.TAB_PROCS: qstr += "c.process LIKE '%{0}%' OR ".format(text) + if self.IN_DETAIL_VIEW[cur_idx] != self.TAB_USERS: + qstr += "c.uid LIKE '%{0}%' OR ".format(text) qstr += "c.process_args LIKE '%{0}%')".format(text)