mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 00:24:40 +01:00
ui: use raw strings notation to for regexps
and silence python3.12 warnings.
This commit is contained in:
parent
2d96ec1fc7
commit
e6ae9ca6ef
4 changed files with 10 additions and 10 deletions
|
@ -48,7 +48,7 @@ class LinuxDesktopParser(threading.Thread):
|
|||
|
||||
def _parse_exec(self, cmd):
|
||||
try:
|
||||
is_flatpak = re.search("^/usr/[s]*bin/flatpak.*--command=([a-zA-Z0-9-_\/\.\+]+)", cmd)
|
||||
is_flatpak = re.search(r"^/usr/[s]*bin/flatpak.*--command=([a-zA-Z0-9-_\/\.\+]+)", cmd)
|
||||
if is_flatpak:
|
||||
return is_flatpak.group(1)
|
||||
|
||||
|
|
|
@ -620,14 +620,14 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
|||
parts = combo.currentText().split(' ')
|
||||
text = parts[len(parts)-1]
|
||||
# ^(|.*\.)yahoo\.com
|
||||
dsthost = '\.'.join(text.split('.')).replace("*", "")
|
||||
dsthost = "^(|.*\.)%s" % dsthost[2:]
|
||||
dsthost = r'\.'.join(text.split('.')).replace("*", "")
|
||||
dsthost = r"^(|.*\.)%s" % dsthost[2:]
|
||||
return Config.RULE_TYPE_REGEXP, Config.OPERAND_DEST_HOST, dsthost
|
||||
|
||||
elif combo.itemData(what_idx) == self.FIELD_REGEX_IP:
|
||||
parts = combo.currentText().split(' ')
|
||||
text = parts[len(parts)-1]
|
||||
return Config.RULE_TYPE_REGEXP, Config.OPERAND_DEST_IP, "%s" % '\.'.join(text.split('.')).replace("*", ".*")
|
||||
return Config.RULE_TYPE_REGEXP, Config.OPERAND_DEST_IP, "%s" % r'\.'.join(text.split('.')).replace("*", ".*")
|
||||
|
||||
def _on_action_clicked(self, action):
|
||||
self._default_action = action
|
||||
|
|
|
@ -23,11 +23,11 @@ DIALOG_UI_PATH = "%s/../res/ruleseditor.ui" % os.path.dirname(sys.modules[__name
|
|||
class RulesEditorDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
|
||||
|
||||
LOG_TAG = "[rules editor]"
|
||||
classA_net = "10\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
||||
classB_net = "172\.1[6-9]\.\d+\.\d+|172\.2[0-9]\.\d+\.\d+|172\.3[0-1]+\.\d{1,3}\.\d{1,3}"
|
||||
classC_net = "192\.168\.\d{1,3}\.\d{1,3}"
|
||||
others_net = "127\.\d{1,3}\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}"
|
||||
multinets = "2[32][23459]\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
||||
classA_net = r"10\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
||||
classB_net = r"172\.1[6-9]\.\d+\.\d+|172\.2[0-9]\.\d+\.\d+|172\.3[0-1]+\.\d{1,3}\.\d{1,3}"
|
||||
classC_net = r"192\.168\.\d{1,3}\.\d{1,3}"
|
||||
others_net = r"127\.\d{1,3}\.\d{1,3}\.\d{1,3}|169\.254\.\d{1,3}\.\d{1,3}"
|
||||
multinets = r"2[32][23459]\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
||||
MULTICAST_RANGE = "^(" + multinets + ")$"
|
||||
LAN_RANGES = "^(" + others_net + "|" + classC_net + "|" + classB_net + "|" + classA_net + "|::1|f[cde].*::.*)$"
|
||||
LAN_LABEL = "LAN"
|
||||
|
|
|
@ -402,7 +402,7 @@ class NetworkServices():
|
|||
for line in etcServices:
|
||||
if line[0] == "#":
|
||||
continue
|
||||
g = re.search("([a-zA-Z0-9\-]+)( |\t)+([0-9]+)\/([a-zA-Z0-9\-]+)(.*)\n", line)
|
||||
g = re.search(r"([a-zA-Z0-9\-]+)( |\t)+([0-9]+)\/([a-zA-Z0-9\-]+)(.*)\n", line)
|
||||
if g:
|
||||
self.srv_array.append("{0}/{1} {2}".format(
|
||||
g.group(1),
|
||||
|
|
Loading…
Add table
Reference in a new issue