aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2021-06-29 15:37:40 -0400
committerJake Hunsaker <jhunsake@redhat.com>2021-06-30 08:42:06 -0400
commitc0d7b95ef313d368013f54182b22a541cd100497 (patch)
tree998de2adc5f17d7a67ee063817180ad7a635a825
parentee6ee9c4ae5b22e693aa832146e0555da4af4fcc (diff)
downloadsos-c0d7b95ef313d368013f54182b22a541cd100497.tar.gz
[mac_parser] Skip over redundant matches
In the event we get a match on an already-obfuscated MAC address, skip the match instead of double-obfuscating the address. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/cleaner/parsers/mac_parser.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sos/cleaner/parsers/mac_parser.py b/sos/cleaner/parsers/mac_parser.py
index f986a809..618c43f8 100644
--- a/sos/cleaner/parsers/mac_parser.py
+++ b/sos/cleaner/parsers/mac_parser.py
@@ -25,6 +25,10 @@ class SoSMacParser(SoSCleanerParser):
# IPv4, avoiding matching a substring within IPv6 addresses
r'(([^:|-])([0-9a-fA-F]{2}([:-])){5}([0-9a-fA-F]){2}(.)?(\s|$|\W))'
]
+ obfuscated_patterns = (
+ '53:4f:53',
+ '534f:53'
+ )
map_file_key = 'mac_map'
prep_map_file = 'sos_commands/networking/ip_-d_address'
@@ -53,6 +57,9 @@ class SoSMacParser(SoSCleanerParser):
if matches:
count += len(matches)
for match in matches:
+ if match.startswith(self.obfuscated_patterns):
+ # avoid double scrubbing
+ continue
stripped_match = self.reduce_mac_match(match)
new_match = self.mapping.get(stripped_match)
line = line.replace(stripped_match, new_match)