HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sos/cleaner/parsers/__pycache__/username_parser.cpython-310.pyc
o

���bT�@s,ddlmZddlmZGdd�de�ZdS)�)�SoSCleanerParser)�SoSUsernameMapcsFeZdZdZdZdZgZgd�Zd�fdd�	Zdd	�Z	d
d�Z
�ZS)
�SoSUsernameParsera�Parser for obfuscating usernames within an sosreport archive.

    Note that this parser does not rely on regex matching directly, like most
    other parsers do. Instead, usernames are discovered via scraping the
    collected output of lastlog. As such, we do not discover new usernames
    later on, and only usernames present in lastlog output will be obfuscated,
    and those passed via the --usernames option if one is provided.
    zUsername Parser�username_map)
�core�nobody�	nfsnobody�shutdown�stack�reboot�root�ubuntu�username�wtmpNcs(t�|_tt|��|�|j�|�dS�N)r�mapping�superr�__init__�load_names_from_options)�self�config�	opt_names��	__class__��E/usr/lib/python3/dist-packages/sos/cleaner/parsers/username_parser.pyr)szSoSUsernameParser.__init__c	Cspt�}|��D]#}z|��d}Wn	tyYqw|r$|��|jvr%q|�|�q|D]}|j�|�q-dS)z�Since we don't get the list of usernames from a straight regex for
        this parser, we need to override the initial parser prepping here.
        rN)	�set�
splitlines�split�	Exception�lower�	skip_list�addr�get)r�content�users�line�user�eachrrr�load_usernames_into_map.s��z)SoSUsernameParser.load_usernames_into_mapcCs|dfS)Nrr)rr&rrr�_parse_line>szSoSUsernameParser._parse_liner)�__name__�
__module__�__qualname__�__doc__�name�map_file_key�regex_patternsr!rr)r*�
__classcell__rrrrrs	
rN)�sos.cleaner.parsersr�!sos.cleaner.mappings.username_maprrrrrr�<module>s