Merge branch 'ui2.0' into main

This commit is contained in:
Gustavo Iñiguez Goia 2020-11-02 10:29:28 +01:00
commit aa18d184a2
7 changed files with 337 additions and 175 deletions

View file

@ -32,6 +32,9 @@ class Config:
def reload(self):
self.settings = QtCore.QSettings("opensnitch", "settings")
def hasKey(self, key):
return self.settings.contains(key)
def setSettings(self, path, value):
self.settings.setValue(path, value)
self.settings.sync()

View file

@ -35,29 +35,9 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self.setupUi(self)
self._accept_button = self.findChild(QtWidgets.QPushButton, "acceptButton")
self._accept_button.clicked.connect(self._cb_accept_button_clicked)
self._apply_button = self.findChild(QtWidgets.QPushButton, "applyButton")
self._apply_button.clicked.connect(self._cb_apply_button_clicked)
self._cancel_button = self.findChild(QtWidgets.QPushButton, "cancelButton")
self._cancel_button.clicked.connect(self._cb_cancel_button_clicked)
self._default_timeout_button = self.findChild(QtWidgets.QSpinBox, "spinUITimeout")
self._default_action_combo = self.findChild(QtWidgets.QComboBox, "comboUIAction")
self._default_target_combo = self.findChild(QtWidgets.QComboBox, "comboUITarget")
self._default_duration_combo = self.findChild(QtWidgets.QComboBox, "comboUIDuration")
self._dialog_pos_combo = self.findChild(QtWidgets.QComboBox, "comboUIDialogPos")
self._nodes_combo = self.findChild(QtWidgets.QComboBox, "comboNodes")
self._node_action_combo = self.findChild(QtWidgets.QComboBox, "comboNodeAction")
self._node_duration_combo = self.findChild(QtWidgets.QComboBox, "comboNodeDuration")
self._node_monitor_method_combo = self.findChild(QtWidgets.QComboBox, "comboNodeMonitorMethod")
self._node_loglevel_combo = self.findChild(QtWidgets.QComboBox, "comboNodeLogLevel")
self._node_intercept_unknown_check = self.findChild(QtWidgets.QCheckBox, "checkInterceptUnknown")
self._node_name_label = self.findChild(QtWidgets.QLabel, "labelNodeName")
self._node_version_label = self.findChild(QtWidgets.QLabel, "labelNodeVersion")
self._node_apply_all_check = self.findChild(QtWidgets.QCheckBox, "checkApplyToNodes")
self.acceptButton.clicked.connect(self._cb_accept_button_clicked)
self.applyButton.clicked.connect(self._cb_apply_button_clicked)
self.cancelButton.clicked.connect(self._cb_cancel_button_clicked)
def showEvent(self, event):
super(PreferencesDialog, self).showEvent(event)
@ -65,11 +45,11 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
try:
self._reset_status_message()
self._hide_status_label()
self._nodes_combo.clear()
self.comboNodes.clear()
self._node_list = self._nodes.get()
for addr in self._node_list:
self._nodes_combo.addItem(addr)
self.comboNodes.addItem(addr)
if len(self._node_list) == 0:
self._reset_node_settings()
@ -80,13 +60,15 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
# connect the signals after loading settings, to avoid firing
# the signals
self._nodes_combo.currentIndexChanged.connect(self._cb_node_combo_changed)
self._node_action_combo.currentIndexChanged.connect(self._cb_node_needs_update)
self._node_duration_combo.currentIndexChanged.connect(self._cb_node_needs_update)
self._node_monitor_method_combo.currentIndexChanged.connect(self._cb_node_needs_update)
self._node_loglevel_combo.currentIndexChanged.connect(self._cb_node_needs_update)
self._node_intercept_unknown_check.clicked.connect(self._cb_node_needs_update)
self._node_apply_all_check.clicked.connect(self._cb_node_needs_update)
self.comboNodes.currentIndexChanged.connect(self._cb_node_combo_changed)
self.comboNodeAction.currentIndexChanged.connect(self._cb_node_needs_update)
self.comboNodeDuration.currentIndexChanged.connect(self._cb_node_needs_update)
self.comboNodeMonitorMethod.currentIndexChanged.connect(self._cb_node_needs_update)
self.comboNodeLogLevel.currentIndexChanged.connect(self._cb_node_needs_update)
self.comboNodeLogFile.currentIndexChanged.connect(self._cb_node_needs_update)
self.comboNodeAddress.currentIndexChanged.connect(self._cb_node_needs_update)
self.checkInterceptUnknown.clicked.connect(self._cb_node_needs_update)
self.checkApplyToNodes.clicked.connect(self._cb_node_needs_update)
# True when any node option changes
self._node_needs_update = False
@ -97,83 +79,127 @@ class PreferencesDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self._default_target = self._cfg.getSettings(self.CFG_DEFAULT_TARGET)
self._default_timeout = self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT)
self._default_duration_combo.setCurrentText(self._default_duration)
self._default_action_combo.setCurrentText(self._default_action)
self._default_target_combo.setCurrentIndex(int(self._default_target))
self._default_timeout_button.setValue(int(self._default_timeout))
self.comboUIDuration.setCurrentText(self._default_duration)
self.comboUIAction.setCurrentText(self._default_action)
self.comboUITarget.setCurrentIndex(int(self._default_target))
self.spinUITimeout.setValue(int(self._default_timeout))
self._load_node_settings()
def _load_node_settings(self):
addr = self._nodes_combo.currentText()
addr = self.comboNodes.currentText()
if addr != "":
try:
node_data = self._node_list[addr]['data']
self._node_version_label.setText(node_data.version)
self._node_name_label.setText(node_data.name)
self._node_loglevel_combo.setCurrentIndex(node_data.logLevel)
self.labelNodeVersion.setText(node_data.version)
self.labelNodeName.setText(node_data.name)
self.comboNodeLogLevel.setCurrentIndex(node_data.logLevel)
node_config = json.loads(node_data.config)
self._node_action_combo.setCurrentText(node_config['DefaultAction'])
self._node_duration_combo.setCurrentText(node_config['DefaultDuration'])
self._node_monitor_method_combo.setCurrentText(node_config['ProcMonitorMethod'])
self._node_intercept_unknown_check.setChecked(node_config['InterceptUnknown'])
self._node_loglevel_combo.setCurrentIndex(int(node_config['LogLevel']))
self.comboNodeAction.setCurrentText(node_config['DefaultAction'])
self.comboNodeDuration.setCurrentText(node_config['DefaultDuration'])
self.comboNodeMonitorMethod.setCurrentText(node_config['ProcMonitorMethod'])
self.checkInterceptUnknown.setChecked(node_config['InterceptUnknown'])
self.comboNodeLogLevel.setCurrentIndex(int(node_config['LogLevel']))
if node_config.get('Server') != None:
self.comboNodeAddress.setEnabled(True)
self.comboNodeLogFile.setEnabled(True)
self.comboNodeAddress.setCurrentText(node_config['Server']['Address'])
self.comboNodeLogFile.setCurrentText(node_config['Server']['LogFile'])
else:
self.comboNodeAddress.setEnabled(False)
self.comboNodeLogFile.setEnabled(False)
except Exception as e:
print(self.LOG_TAG + "exception loading config: ", e)
def _reset_node_settings(self):
self._node_action_combo.setCurrentIndex(0)
self._node_duration_combo.setCurrentIndex(0)
self._node_monitor_method_combo.setCurrentIndex(0)
self._node_intercept_unknown_check.setChecked(False)
self._node_loglevel_combo.setCurrentIndex(0)
self._node_name_label.setText("")
self._node_version_label.setText("")
self.comboNodeAction.setCurrentIndex(0)
self.comboNodeDuration.setCurrentIndex(0)
self.comboNodeMonitorMethod.setCurrentIndex(0)
self.checkInterceptUnknown.setChecked(False)
self.comboNodeLogLevel.setCurrentIndex(0)
self.labelNodeName.setText("")
self.labelNodeVersion.setText("")
def _save_settings(self):
self._show_status_label()
self._set_status_message("Applying configuration...")
if self.tabWidget.currentIndex() == 0:
self._cfg.setSettings(self.CFG_DEFAULT_ACTION, self._default_action_combo.currentText())
self._cfg.setSettings(self.CFG_DEFAULT_DURATION, self._default_duration_combo.currentText())
self._cfg.setSettings(self.CFG_DEFAULT_TARGET, self._default_target_combo.currentIndex())
self._cfg.setSettings(self.CFG_DEFAULT_TIMEOUT, self._default_timeout_button.value())
self._cfg.setSettings(self.CFG_DEFAULT_ACTION, self.comboUIAction.currentText())
self._cfg.setSettings(self.CFG_DEFAULT_DURATION, self.comboUIDuration.currentText())
self._cfg.setSettings(self.CFG_DEFAULT_TARGET, self.comboUITarget.currentIndex())
self._cfg.setSettings(self.CFG_DEFAULT_TIMEOUT, self.spinUITimeout.value())
elif self.tabWidget.currentIndex() == 1:
addr = self._nodes_combo.currentText()
if (self._node_needs_update or self._node_apply_all_check.isChecked()) and addr != "":
self._show_status_label()
addr = self.comboNodes.currentText()
if (self._node_needs_update or self.checkApplyToNodes.isChecked()) and addr != "":
try:
notif = ui_pb2.Notification(
id=int(str(time.time()).replace(".", "")),
type=ui_pb2.CHANGE_CONFIG,
data="",
rules=[])
if self._node_apply_all_check.isChecked():
if self.checkApplyToNodes.isChecked():
for addr in self._nodes.get_nodes():
notif.data = self._load_node_config(addr)
self._nodes.save_node_config(addr, notif.data)
nid = self._nodes.send_notification(addr, notif, self._notification_callback)
error = self._save_node_config(notif, addr)
if error != None:
self._set_status_error(error)
return
else:
notif.data = self._load_node_config(addr)
self._nodes.save_node_config(addr, notif.data)
nid = self._nodes.send_notification(addr, notif, self._notification_callback)
self._notifications_sent[nid] = notif
error = self._save_node_config(notif, addr)
if error != None:
self._set_status_error(error)
return
except Exception as e:
print(self.LOG_TAG + "exception saving config: ", e)
self._set_status_error("Exception saving config: %s" % str(e))
self._node_needs_update = False
def _save_node_config(self, notifObject, addr):
try:
self._set_status_message("Applying configuration on %s ..." % addr)
notifObject.data, error = self._load_node_config(addr)
if error != None:
return error
self._nodes.save_node_config(addr, notifObject.data)
nid = self._nodes.send_notification(addr, notifObject, self._notification_callback)
self._notifications_sent[nid] = notifObject
except Exception as e:
print(self.LOG_TAG + "exception saving node config on %s: " % addr, e)
self._set_status_error("Exception saving node config %s: %s" % (addr, str(e)))
return addr + ": " + str(e)
return None
def _load_node_config(self, addr):
node_config = json.loads(self._nodes.get_node_config(addr))
node_config['DefaultAction'] = self._node_action_combo.currentText()
node_config['DefaultDuration'] = self._node_duration_combo.currentText()
node_config['ProcMonitorMethod'] = self._node_monitor_method_combo.currentText()
node_config['LogLevel'] = self._node_loglevel_combo.currentIndex()
node_config['InterceptUnknown'] = self._node_intercept_unknown_check.isChecked()
return json.dumps(node_config)
try:
if self.comboNodeAddress.currentText() == "":
return None, "Server address can not be empty"
node_config = json.loads(self._nodes.get_node_config(addr))
node_config['DefaultAction'] = self.comboNodeAction.currentText()
node_config['DefaultDuration'] = self.comboNodeDuration.currentText()
node_config['ProcMonitorMethod'] = self.comboNodeMonitorMethod.currentText()
node_config['LogLevel'] = self.comboNodeLogLevel.currentIndex()
node_config['InterceptUnknown'] = self.checkInterceptUnknown.isChecked()
if node_config.get('Server') != None:
# skip setting Server Address if we're applying the config to all nodes
if self.checkApplyToNodes.isChecked():
print("skipping server address")
node_config['Server']['Address'] = self.comboNodeAddress.currentText()
node_config['Server']['LogFile'] = self.comboNodeLogFile.currentText()
#else:
# print(addr, " doesn't have Server item")
return json.dumps(node_config), None
except Exception as e:
print(self.LOG_TAG + "exception loading node config on %s: " % addr, e)
return None, "Error loading %s configuration" % addr
def _hide_status_label(self):
self.statusLabel.hide()

View file

@ -52,7 +52,7 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self._prompt_trigger.connect(self.on_connection_prompt_triggered)
self._timeout_trigger.connect(self.on_timeout_triggered)
self._tick_trigger.connect(self.on_tick_triggered)
self._tick = int(self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT)) if self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT) else self.DEFAULT_TIMEOUT
self._tick = int(self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT)) if self._cfg.hasKey(self.CFG_DEFAULT_TIMEOUT) else self.DEFAULT_TIMEOUT
self._tick_thread = None
self._done = threading.Event()
self._timeout_text = ""
@ -99,7 +99,7 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
if self._tick_thread != None and self._tick_thread.is_alive():
self._tick_thread.join()
self._cfg.reload()
self._tick = int(self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT)) if self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT) else self.DEFAULT_TIMEOUT
self._tick = int(self._cfg.getSettings(self.CFG_DEFAULT_TIMEOUT)) if self._cfg.hasKey(self.CFG_DEFAULT_TIMEOUT) else self.DEFAULT_TIMEOUT
self._tick_thread = threading.Thread(target=self._timeout_worker)
self._tick_thread.stop = self._ischeckAdvanceded
self._timeout_triggered = False

View file

@ -251,6 +251,11 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self.comboAction.currentIndexChanged.connect(self._cb_combo_action_changed)
self.limitCombo.currentIndexChanged.connect(self._cb_limit_combo_changed)
self.cmdCleanSql.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanHosts.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanProcs.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanAddrs.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanPorts.clicked.connect(self._cb_clean_sql_clicked)
self.cmdCleanUsers.clicked.connect(self._cb_clean_sql_clicked)
self.tabWidget.currentChanged.connect(self._cb_tab_changed)
self.delRuleButton.clicked.connect(self._cb_del_rule_clicked)
self.enableRuleCheck.clicked.connect(self._cb_enable_rule_toggled)
@ -325,6 +330,13 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self.TABLES[self.TAB_PORTS]['cmd'] = self.cmdPortsBack
self.TABLES[self.TAB_USERS]['cmd'] = self.cmdUsersBack
self.TABLES[self.TAB_MAIN]['cmdCleanStats'] = self.cmdCleanSql
self.TABLES[self.TAB_HOSTS]['cmdCleanStats'] = self.cmdCleanHosts
self.TABLES[self.TAB_PROCS]['cmdCleanStats'] = self.cmdCleanProcs
self.TABLES[self.TAB_ADDRS]['cmdCleanStats'] = self.cmdCleanAddrs
self.TABLES[self.TAB_PORTS]['cmdCleanStats'] = self.cmdCleanPorts
self.TABLES[self.TAB_USERS]['cmdCleanStats'] = self.cmdCleanUsers
self.TABLES[self.TAB_MAIN]['filterLine'] = self.filterLine
self.TABLES[self.TAB_RULES]['filterLine'] = self.rulesFilterLine
self.TABLES[self.TAB_HOSTS]['filterLine'] = self.hostsFilterLine
@ -549,6 +561,7 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
def _cb_clean_sql_clicked(self):
self._db.clean(self.TABLES[self.tabWidget.currentIndex()]['name'])
self._refresh_active_table()
def _cb_cmd_back_clicked(self, idx):
cur_idx = self.tabWidget.currentIndex()
@ -699,6 +712,8 @@ class StatsDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self.TABLES[cur_idx]['tipLabel'].setVisible(not state)
if self.TABLES[cur_idx]['filterLine'] != None:
self.TABLES[cur_idx]['filterLine'].setVisible(not state)
if self.TABLES[cur_idx].get('cmdCleanStats') != None:
self.TABLES[cur_idx]['cmdCleanStats'].setVisible(not state)
def _set_rules_tab_active(self, row, cur_idx):
data = row.data()

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>355</height>
<width>662</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
@ -205,6 +205,16 @@
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="comboUIAction">
<property name="sizePolicy">
@ -243,19 +253,6 @@
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
@ -276,14 +273,14 @@
<string>Nodes</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="6" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Process monitor method</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_11">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default duration will take place when there's no UI connected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -293,6 +290,16 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_15">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Address of the node.&lt;/p&gt;&lt;p&gt;Default: unix:///tmp/osui.sock (unix:// is mandatory if it's a Unix socket)&lt;/p&gt;&lt;p&gt;It can also be an IP address with the port: 127.0.0.1:50051&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Address</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QComboBox" name="comboNodes">
<property name="sizePolicy">
@ -303,22 +310,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="sizePolicy">
@ -332,7 +323,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default action will take place when there's no UI connected.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -342,56 +333,14 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="2" column="2">
<widget class="QLabel" name="labelNodeVersion">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="comboNodeMonitorMethod">
<item>
<property name="text">
<string>proc</string>
</property>
</item>
<item>
<property name="text">
<string>audit</string>
</property>
</item>
<item>
<property name="text">
<string>ftrace</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>HostName</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>60</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="7" column="3">
<item row="9" column="2">
<widget class="QComboBox" name="comboNodeLogLevel">
<item>
<property name="text">
@ -425,7 +374,42 @@
</item>
</widget>
</item>
<item row="3" column="3">
<item row="8" column="2">
<widget class="QComboBox" name="comboNodeMonitorMethod">
<item>
<property name="text">
<string>proc</string>
</property>
</item>
<item>
<property name="text">
<string>audit</string>
</property>
</item>
<item>
<property name="text">
<string>ftrace</string>
</property>
</item>
</widget>
</item>
<item row="10" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>60</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="comboNodeAction">
<property name="editable">
<bool>false</bool>
@ -450,14 +434,17 @@
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_14">
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Log file to write logs.&lt;br/&gt;&lt;/p&gt;&lt;p&gt;/dev/stdout will print logs to the standard output.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Default log level</string>
<string>Log file</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If checked, opensnitch will prompt you to allow or deny connections that don't have an asocciated PID, due to several reasons.&lt;/p&gt;&lt;p&gt;The pop-up dialog will only contain information about the network connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@ -467,14 +454,33 @@
</property>
</widget>
</item>
<item row="1" column="3">
<item row="1" column="2">
<widget class="QLabel" name="labelNodeName">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="4" column="3">
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>HostName</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="comboNodeAddress">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>unix:///tmp/osui.sock</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="QComboBox" name="comboNodeDuration">
<item>
<property name="text">
@ -493,7 +499,24 @@
</item>
</widget>
</item>
<item row="0" column="3">
<item row="4" column="2">
<widget class="QComboBox" name="comboNodeLogFile">
<property name="editable">
<bool>true</bool>
</property>
<item>
<property name="text">
<string>/var/log/opensnitchd.log</string>
</property>
</item>
<item>
<property name="text">
<string>/dev/stdout</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="checkApplyToNodes">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@ -506,13 +529,36 @@
</property>
</widget>
</item>
<item row="5" column="3">
<item row="7" column="2">
<widget class="QCheckBox" name="checkInterceptUnknown">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Default log level</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">

View file

@ -153,8 +153,7 @@
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear">
<normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</normaloff>../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../../.designer/backup</iconset>
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
@ -426,6 +425,16 @@
<item>
<widget class="QLineEdit" name="hostsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanHosts">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -504,6 +513,16 @@
<item>
<widget class="QLineEdit" name="procsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanProcs">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -576,6 +595,16 @@
<item>
<widget class="QLineEdit" name="addrsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanAddrs">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -648,6 +677,16 @@
<item>
<widget class="QLineEdit" name="portsFilterLine"/>
</item>
<item>
<widget class="QPushButton" name="cmdCleanPorts">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -709,11 +748,38 @@
</layout>
</item>
<item>
<widget class="QLabel" name="tipUsersLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt;&quot;&gt;(double click to view details of an item)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="tipUsersLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:7pt;&quot;&gt;(double click to view details of an item)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cmdCleanUsers">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="edit-clear-all"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableView" name="usersTable">

View file

@ -167,8 +167,14 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
def _on_tray_icon_activated(self, reason):
if reason == QtWidgets.QSystemTrayIcon.Trigger or reason == QtWidgets.QSystemTrayIcon.MiddleClick:
if self._stats_dialog.isVisible():
if self._stats_dialog.isVisible() and not self._stats_dialog.isMinimized():
self._stats_dialog.hide()
elif self._stats_dialog.isVisible() and self._stats_dialog.isMinimized() and not self._stats_dialog.isMaximized():
self._stats_dialog.hide()
self._stats_dialog.showNormal()
elif self._stats_dialog.isVisible() and self._stats_dialog.isMinimized() and self._stats_dialog.isMaximized():
self._stats_dialog.hide()
self._stats_dialog.showMaximized()
else:
self._stats_dialog.show()
@ -495,7 +501,7 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
# TODO: move to notificatons.py
def new_node_message():
print("listening for client responses...", addr)
print("new node connected, listening for client responses...", addr)
while self._exit == False:
try:
if stop_event.is_set():