Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cleaner] Improve IPV6 MAC address RE #3766

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions sos/cleaner/parsers/mac_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
r'[0-9a-fA-F]{2}(\'|\")?(\/|\,|\-|\.|\s|$))'
)
# aabb:ccee:ddee:ffaa
# - but disallow "substrings"
# - but allow fe80: or fe80:: prefix for link-local
IPV6_REG_4HEX = (
r'((?<!([0-9a-fA-F\'\"]:)|::)(([^:\-]?[0-9a-fA-F]{4}(:|-)){3}'
r'[0-9a-fA-F]{4}(\'|\")?(\/|\,|\-|\.|\s|$)))'
r'((?<!(?:([.|^|\b]{5}\w|[.|^|\b]fe80:|fe80::)))'
r'(([0-9a-fA-F]{4}:){3}[0-9a-fA-F]{4})(?!\w))|'
r'((?<!\w)(([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{4})(?!\w))'
)
# aa:bb:cc:dd:ee:ff avoiding ipv6 substring matches
IPV4_REG = (
Expand Down
Loading