From 58129d5209038e76bf6b83e6aa9a9ddd6994929f Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 1 Dec 2024 22:19:49 +0800 Subject: [PATCH] update --- plugins/mtproxy/index.py | 16 ++++++++++++++++ plugins/rsyncd/index.py | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/plugins/mtproxy/index.py b/plugins/mtproxy/index.py index 8652a5372..03a5bf227 100755 --- a/plugins/mtproxy/index.py +++ b/plugins/mtproxy/index.py @@ -75,6 +75,22 @@ def getServiceFile(): return systemDir + '/mtproxy.service' +def __release_port(port): + from collections import namedtuple + try: + from utils.firewall import Firewall as MwFirewall + MwFirewall.instance().addAcceptPort(port, 'mtproxy', 'port') + return port + except Exception as e: + return "Release failed {}".format(e) + + +def openFtpPort(): + for i in ["8349"]: + __release_port(i) + return True + + def initDreplace(): envTpl = getConfEnvTpl() diff --git a/plugins/rsyncd/index.py b/plugins/rsyncd/index.py index 78b85d451..a35c14a6a 100755 --- a/plugins/rsyncd/index.py +++ b/plugins/rsyncd/index.py @@ -347,15 +347,15 @@ def getRecListData(): n = i + 1 reg = '' if n == flist_len: - reg = '\\[' + flist[i] + '\\](.*)\\[?' + reg = r'\[' + flist[i] + r'\](.*)\[?' else: - reg = '\\[' + flist[i] + '\\](.*)\\[' + flist[n] + '\\]' + reg = r'\[' + flist[i] + r'\](.*)\[' + flist[n] + r'\]' t1 = re.search(reg, content, re.S) if t1: args = t1.groups()[0] # print('args start', args, 'args_end') - t2 = re.findall('\\s*(.*)\\s*\\=\\s*?(.*)?', args, re.M | re.I) + t2 = re.findall(r'\s*(.*)\s*\=\s*?(.*)?', args, re.M | re.I) for i in range(len(t2)): tmp[t2[i][0].strip()] = t2[i][1].strip() ret_list.append(tmp)