Skip to content

Commit

Permalink
[clean] Properly obfuscate MAC addresses
Browse files Browse the repository at this point in the history
Some of mac addresses was not properly obfuscated because
some collected data contains mac addresses in format
01:<mac> and parser was not ready for that.

Also added mapper which will obfuscate mac address in case
it is in format with _ instead of : as for example

00_50_56_87_5d_01

instead of

00:50:56:87:5d:01

Format with _ is used for example by vmware plugin.

Resolves: sosreport#3302

Signed-off-by: Jan Jansky <jjansky@redhat.com>
  • Loading branch information
jjansky1 authored and TurboTurtle committed Jul 13, 2023
1 parent aade89e commit 59c2660
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sos/cleaner/mappings/mac_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ def sanitize_item(self, item):
if re.match('(([0-9a-fA-F]{4}:){3}([0-9a-fA-F]){4})', item):
return self.mac6_quad_template % hextets
# match 48-bit IPv4 MAC addresses
if re.match('([0-9a-fA-F]:?){12}', item):
if re.match('([0-9a-fA-F][:_]?){12}', item):
return self.mac_template % hextets
4 changes: 2 additions & 2 deletions sos/cleaner/parsers/mac_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
)
# aa:bb:cc:dd:ee:ff avoiding ipv6 substring matches
IPV4_REG = (
r'((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-])?([0-9a-fA-F]{2}([:-])){5}'
r'([0-9a-fA-F]){2}(\'|\")?(\/|\,|\-|\.|\s|$)))'
r'((?<!([0-9a-fA-F\'\"]:)|::)'
r'(([^:\-])?(([0-9a-fA-F]{2}([:\-\_])){5,6}([0-9a-fA-F]{2}))))'
)


Expand Down

0 comments on commit 59c2660

Please sign in to comment.