File: //lib/python3.6/site-packages/sos/cleaner/mappings/__pycache__/hostname_map.cpython-36.pyc
3
ܓ�i�! � @ s( d dl Z d dlmZ G dd� de�ZdS )� N)�SoSMapc
s� e Zd ZdZdddgZddgZd#ZdZdZdZ dZ
i Zi Z� fdd�Z
dd� Zdd� Z� fdd�Zdd� Zdd� Zdd � Zd!d"� Z� ZS )$�SoSHostnameMapaL Mapping store for hostnames and domain names
Hostnames are obfuscated using an incrementing counter based on the total
number of hosts matched regardless of domain name.
Domain names are obfuscated based on the host's hostname, plus any user
defined domains passed in by the `--domains` options.
Domains are obfuscated as whole units, meaning the domains 'example.com'
and 'host.foo.example.com' will be separately obfuscated with no relation
for example as 'obfuscatedomdain1.com' and 'obfuscatedomain2.com'.
Top-level domains are left untouched.
Z localhostz.*localdomain.*z^com..*ZwwwZapi�.yaml�.yml�.crt�.key�.pem�.log�.repo�.rules�.conf�.cfgTr c s d|kr|j dd�}t� j|�S )z�Override the base get_regex_result() to provide a regex that, if
this is an FQDN or a straight domain, will include an underscore
formatted regex as well.
�.z(\.|_))�replace�super�get_regex_result)�self�item)� __class__� �"/usr/lib/python3.6/hostname_map.pyr 5 s zSoSHostnameMap.get_regex_resultc C s� y2t | jj� dd�d jd�d }t|�d | _W n tk
rF Y nX y<t | jj� dd�d jd�}t|d jd�d �d | _W n tk
r� Y nX dS ) z�Set the initial counter for host and domain obfuscation numbers
based on what is already present in the mapping.
T)�reverser �host� �domainr N) �sorted�hosts�values�split�int�
host_count�
IndexError�_domains�domain_count)r �h�dr r r �set_initial_counts>