diff options
-rw-r--r-- | sos/cleaner/mappings/__init__.py | 2 | ||||
-rw-r--r-- | sos/cleaner/parsers/username_parser.py | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sos/cleaner/mappings/__init__.py b/sos/cleaner/mappings/__init__.py index 92aedf4a..a6998f9d 100644 --- a/sos/cleaner/mappings/__init__.py +++ b/sos/cleaner/mappings/__init__.py @@ -94,7 +94,7 @@ class SoSMap(): :returns: A compiled regex pattern for the item :rtype: ``re.Pattern`` """ - return re.compile(item, re.I) + return re.compile(re.escape(item), re.I) def sanitize_item(self, item): """Perform the obfuscation relevant to the item being added to the map. diff --git a/sos/cleaner/parsers/username_parser.py b/sos/cleaner/parsers/username_parser.py index 6d9a9ff0..da72f380 100644 --- a/sos/cleaner/parsers/username_parser.py +++ b/sos/cleaner/parsers/username_parser.py @@ -55,9 +55,11 @@ class SoSUsernameParser(SoSCleanerParser): continue if not user or user.lower() in self.skip_list: continue - users.add(user) - for each in users: + users.add(user.lower()) + for each in sorted(users, key=len, reverse=True): self.mapping.get(each) + if '\\' in each: + self.mapping.get(each.split('\\')[-1]) def _parse_line(self, line): return line, 0 |