diff --git a/management/mail_log.py b/management/mail_log.py index ad645d90..5abacc4f 100755 --- a/management/mail_log.py +++ b/management/mail_log.py @@ -391,7 +391,7 @@ def scan_postgrey_line(date, log, collector): """ Scan a postgrey log line and extract interesting data """ m = re.match(r"action=(greylist|pass), reason=(.*?), (?:delay=\d+, )?client_name=(.*), " - "client_address=(.*), sender=(.*), recipient=(.*)", + r"client_address=(.*), sender=(.*), recipient=(.*)", log) if m: @@ -423,7 +423,7 @@ def scan_postfix_smtpd_line(date, log, collector): # Check if the incoming mail was rejected - m = re.match("NOQUEUE: reject: RCPT from .*?: (.*?); from=<(.*?)> to=<(.*?)>", log) + m = re.match(r"NOQUEUE: reject: RCPT from .*?: (.*?); from=<(.*?)> to=<(.*?)>", log) if m: message, sender, user = m.groups() @@ -467,7 +467,7 @@ def scan_postfix_smtpd_line(date, log, collector): def scan_dovecot_login_line(date, log, collector, protocol_name): """ Scan a dovecot login log line and extract interesting data """ - m = re.match("Info: Login: user=<(.*?)>, method=PLAIN, rip=(.*?),", log) + m = re.match(r"Info: Login: user=<(.*?)>, method=PLAIN, rip=(.*?),", log) if m: # TODO: CHECK DIT diff --git a/management/web_update.py b/management/web_update.py index 825158b3..82cfc3f4 100644 --- a/management/web_update.py +++ b/management/web_update.py @@ -167,7 +167,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): proxy_redirect_off = False frame_options_header_sameorigin = False web_sockets = False - m = re.search("#(.*)$", url) + m = re.search(r"#(.*)$", url) if m: for flag in m.group(1).split(","): if flag == "pass-http-host": @@ -178,7 +178,7 @@ def make_domain_config(domain, templates, ssl_certificates, env): frame_options_header_sameorigin = True elif flag == "web-sockets": web_sockets = True - url = re.sub("#(.*)$", "", url) + url = re.sub(r"#(.*)$", "", url) nginx_conf_extra += "\tlocation {} {{".format(path) nginx_conf_extra += "\n\t\tproxy_pass {};".format(url) diff --git a/setup/migrate.py b/setup/migrate.py index 319acd49..2cd61c85 100755 --- a/setup/migrate.py +++ b/setup/migrate.py @@ -23,7 +23,7 @@ def migration_1(env): # Migrate the 'domains' directory. for sslfn in glob.glob(os.path.join( env["STORAGE_ROOT"], 'ssl/domains/*' )): fn = os.path.basename(sslfn) - m = re.match("(.*)_(certifiate.pem|cert_sign_req.csr|private_key.pem)$", fn) + m = re.match(r"(.*)_(certifiate.pem|cert_sign_req.csr|private_key.pem)$", fn) if m: # get the new name for the file domain_name, file_type = m.groups() diff --git a/tests/tls.py b/tests/tls.py index 8795f36a..18b6b7c4 100644 --- a/tests/tls.py +++ b/tests/tls.py @@ -96,7 +96,7 @@ def sslyze(opts, port, ok_ciphers): # Failed. Just output the error. out = re.sub("[\\w\\W]*CHECKING HOST\\(S\\) AVAILABILITY\n\\s*-+\n", "", out) # chop off header that shows the host we queried out = re.sub("[\\w\\W]*SCAN RESULTS FOR.*\n\\s*-+\n", "", out) # chop off header that shows the host we queried - out = re.sub("SCAN COMPLETED IN .*", "", out) + out = re.sub(r"SCAN COMPLETED IN .*", "", out) out = out.rstrip(" \n-") + "\n" # Print. diff --git a/tools/readable_bash.py b/tools/readable_bash.py index ac4b6448..78a4bc08 100644 --- a/tools/readable_bash.py +++ b/tools/readable_bash.py @@ -408,7 +408,7 @@ class BashScript(Grammar): string = re.sub(".* #NODOC\n", "", string) string = re.sub("\n\s*if .*then.*|\n\s*fi|\n\s*else|\n\s*elif .*", "", string) string = quasitokenize(string) - string = re.sub("hide_output ", "", string) + string = re.sub(r"hide_output ", "", string) parser = BashScript.parser() result = parser.parse_string(string)