mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Substitute after matching hyphenated ip in logs
This commit is contained in:
parent
2d0a97f259
commit
e99c4aec4a
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue