ui,stats: fixed Events search with different languages

When a language other than English was used, the search in the Events
did not work.
This commit is contained in:
Gustavo Iñiguez Goia 2024-12-30 22:21:59 +01:00
parent d8c3684f2b
commit 24a5105d77
Failed to generate hash of commit

View file

@ -172,19 +172,19 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
"model": None, "model": None,
"delegate": "commonDelegateConfig", "delegate": "commonDelegateConfig",
"display_fields": "time as Time, " \ "display_fields": "time as Time, " \
"node as Node, " \ "node, " \
"action as Action, " \ "action, " \
"src_port as SrcPort, " \ "src_port, " \
"src_ip as SrcIP, " \ "src_ip, " \
"dst_ip as DstIP, " \ "dst_ip, " \
"dst_host as DstHost, " \ "dst_host, " \
"dst_port as DstPort, " \ "dst_port, " \
"protocol as Protocol, " \ "protocol, " \
"uid as UID, " \ "uid, " \
"pid as PID, " \ "pid, " \
"process as Process, " \ "process, " \
"process_args as Cmdline, " \ "process_args, " \
"rule as Rule", "rule",
"group_by": LAST_GROUP_BY, "group_by": LAST_GROUP_BY,
"last_order_by": "1", "last_order_by": "1",
"last_order_to": 1, "last_order_to": 1,
@ -2615,11 +2615,11 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
filter_text = self.filterLine.text() filter_text = self.filterLine.text()
action = "" action = ""
if self.comboAction.currentIndex() == 1: if self.comboAction.currentIndex() == 1:
action = "Action = \"{0}\"".format(Config.ACTION_ALLOW) action = "action = \"{0}\"".format(Config.ACTION_ALLOW)
elif self.comboAction.currentIndex() == 2: elif self.comboAction.currentIndex() == 2:
action = "Action = \"{0}\"".format(Config.ACTION_DENY) action = "action = \"{0}\"".format(Config.ACTION_DENY)
elif self.comboAction.currentIndex() == 3: elif self.comboAction.currentIndex() == 3:
action = "Action = \"{0}\"".format(Config.ACTION_REJECT) action = "action = \"{0}\"".format(Config.ACTION_REJECT)
# FIXME: use prepared statements # FIXME: use prepared statements
if filter_text == "": if filter_text == "":
@ -2628,18 +2628,20 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
else: else:
if action != "": if action != "":
action += " AND " action += " AND "
qstr += " WHERE " + action + " ("\ qstr += " WHERE " + action + " (" \
" " + self.COL_STR_PROCESS + " LIKE '%" + filter_text + "%'" \ " process LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_PROC_CMDLINE + " LIKE '%" + filter_text + "%'" \ " OR process_args LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_SRC_PORT + " LIKE '%" + filter_text + "%'" \ " OR src_port LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_SRC_IP + " LIKE '%" + filter_text + "%'" \ " OR src_ip LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_DST_IP + " LIKE '%" + filter_text + "%'" \ " OR dst_ip LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_DST_HOST + " LIKE '%" + filter_text + "%'" \ " OR dst_host LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_DST_PORT + " LIKE '%" + filter_text + "%'" \ " OR dst_port LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_RULE + " LIKE '%" + filter_text + "%'" \ " OR rule LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_NODE + " LIKE '%" + filter_text + "%'" \ " OR node LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_TIME + " LIKE '%" + filter_text + "%'" \ " OR time LIKE '%" + filter_text + "%'" \
" OR " + self.COL_STR_PROTOCOL + " LIKE '%" + filter_text + "%')" \ " OR uid LIKE '%" + filter_text + "%'" \
" OR pid LIKE '%" + filter_text + "%'" \
" OR protocol LIKE '%" + filter_text + "%')" \
qstr += self._get_order() + self._get_limit() qstr += self._get_order() + self._get_limit()
self.setQuery(model, qstr) self.setQuery(model, qstr)