From e99c4aec4aba739a57337144c6180c1207b3c5a2 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 Mar 2020 20:36:09 -0800 Subject: [PATCH] Substitute after matching hyphenated ip in logs --- plexpy/logger.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plexpy/logger.py b/plexpy/logger.py index e2b85217..7c3436a8 100644 --- a/plexpy/logger.py +++ b/plexpy/logger.py @@ -143,8 +143,9 @@ class PublicIPFilter(RegexFilter): self.regex = re.compile(r'[0-9]+(?:[.-][0-9]+){3}(?!\d*-[a-z0-9]{6})') def replace(self, text, ip): - if helpers.is_public_ip(ip): - return text.replace(ip, ip.partition('.')[0] + '.***.***.***') + if helpers.is_public_ip(ip.replace('-', '.')): + partition = '-' if '-' in ip else '.' + return text.replace(ip, ip.partition(partition)[0] + (partition + '***') * 3) return text