mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
added wildcard domain in select combo (closes #154)
This commit is contained in:
parent
d37cd40495
commit
5a2dc8b963
1 changed files with 10 additions and 1 deletions
|
@ -152,6 +152,10 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self._what_combo.addItem("to %s" % con.dst_ip)
|
||||
if con.dst_host != "":
|
||||
self._what_combo.addItem("to %s" % con.dst_host)
|
||||
parts = con.dst_host.split('.')[1:]
|
||||
nparts = len(parts)
|
||||
for i in range(0, nparts - 1):
|
||||
self._what_combo.addItem("to *.%s" % '.'.join(parts[i:]))
|
||||
|
||||
self._what_combo.setCurrentIndex(0)
|
||||
self._action_combo.setCurrentIndex(0)
|
||||
|
@ -210,11 +214,16 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
self._rule.operator.operand = "dest.ip"
|
||||
self._rule.operator.data = self._con.dst_ip
|
||||
|
||||
else:
|
||||
elif what_idx == 4:
|
||||
self._rule.operator.type = "simple"
|
||||
self._rule.operator.operand = "dest.host"
|
||||
self._rule.operator.data = self._con.dst_host
|
||||
|
||||
else:
|
||||
self._rule.operator.type = "regexp"
|
||||
self._rule.operator.operand = "dest.host"
|
||||
self._rule.operator.data = ".*%s" % '\.'.join(self._con.dst_host.split('.')[what_idx - 4:])
|
||||
|
||||
self._rule.name = slugify("%s %s %s" % (self._rule.action, self._rule.operator.type, self._rule.operator.data))
|
||||
|
||||
self.hide()
|
||||
|
|
Loading…
Add table
Reference in a new issue