AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/sos/cleaner/mappings/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/sos/cleaner/mappings/__pycache__/hostname_map.cpython-310.pyc
o

���b(�@s(ddlZddlmZGdd�de�ZdS)�N)�SoSMapcs�eZdZdZgd�ZddgZdZdZdZiZ	iZ
dd�Zd	d
�Zdd�Z
d
d�Zdd�Z�fdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�SoSHostnameMapaLMapping 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.
    )�	localhostz.*localdomain.*z^com..*�www�api)z.yamlz.ymlz.crtz.keyz.pemz.logz.repoz.rulesrcCs�|j��D]f\}}t|�d��dkr |j||j|�d�d<q|�d�r0|�d�d|j|<qd�|�d�dd��}|s?q|j��D]&}d�|�d�dd��}||krjd�|j|�d�dd��}||j|<qDq|�	�dS)z�Because we use 'intermediary' dicts for host names and domain names
        in this parser, we need to re-inject entries from the map_file into
        these dicts and not just the underlying 'dataset' dict
        �.�r�obfuscateddomain���N)
�dataset�items�len�split�hosts�
startswith�_domains�join�keys�set_initial_counts)�self�domain�ob_pair�_domain_to_inject�existing_domain�	_existing�
_ob_domain�r�C/usr/lib/python3/dist-packages/sos/cleaner/mappings/hostname_map.py�load_domains_from_map3s&
�
��z$SoSHostnameMap.load_domains_from_mapcCs|D]
}|�|�d��qdS)Nr)�sanitize_domainr)r�domainsrrrr�load_domains_from_optionsSs�z(SoSHostnameMap.load_domains_from_optionscCs"d|vr
|�dd�}t�|tj�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.
        rz(\.|_))�replace�re�compile�I)r�itemrrr�get_regex_resultWszSoSHostnameMap.get_regex_resultcCs�zt|j��dd�d�d�d}t|�d|_Wn	ty"Ynwzt|j��dd�d�d�}t|d�d�d�d|_WdStyLYdSw)	z�Set the initial counter for host and domain obfuscation numbers
        based on what is already present in the mapping.
        T)�reverser�hostrrrN)	�sortedr�valuesr�int�
host_count�
IndexErrorr�domain_count)r�h�drrrr`s �"�z!SoSHostnameMap.set_initial_countscsj||jvrdS|�d�}d�|�d�dd���t|�dkr%|d|jvSt�fdd�|jD��r3dSdS)	zkCheck if a potential domain is in one of the domains we've loaded
        and should be obfuscated
        Trrr
rcsg|]}��|��qSr)�endswith)�.0�_d��no_tldrr�
<listcomp>sz@SoSHostnameMap.domain_name_in_loaded_domains.<locals>.<listcomp>F)rrrr
r�any)rrr)rr5r�domain_name_in_loaded_domainsts

z,SoSHostnameMap.domain_name_in_loaded_domainsc	s�d}d}d}|�d�r||d7}|dd�}|�d�s|�d�r2||d7}|dd�}|�d�s!||jvr<|j|S|�|���sE|S|�|j�r^d|�d�d}|�|d�}||7}||j��vr�t	|j��ddd	�d
�D]i}d}|�|�}|�d�}	|	dr�|	d|j
��vr�d}t|�dks�|ds�qq|s�|d�d�s�|�|�r�tt
|��|�}n*|�|d�r�z|�|d�d}
|dtt
|��|
�}Wn
ty�Yqqwqq|s�tt
|��|�}|||S)N�)r�_rrr
rTcSst|�S)N)r
)�xrrr�<lambda>�sz$SoSHostnameMap.get.<locals>.<lambda>)r(�keyF)rr2rr9�lower�
strip_extsrr"rr*rr
�superr�get�	Exception)rr&�prefix�suffix�final�extr�_host_substr�_test�_h�itm��	__class__rrrB�s^

�

�


�

���zSoSHostnameMap.getc	Cs�|�d�}t|�dkr|�|d���St|�dkr.|�|�}tdd�|D��r,|��}|St|�dkrn|d}|dd�}t|�dkrL|�|���}nd}|�|�}||j|<d�||g�}tdd�|D��rl|��}|SdS)	Nrrr�cS�g|]}|���qSr��isupper�r3r0rrrr7��z0SoSHostnameMap.sanitize_item.<locals>.<listcomp>�unknowncSrOrrPrRrrrr7�rS)	rr
�sanitize_short_namer?r�all�upperrr)	rr&r)�dname�hostnamer�ob_hostname�	ob_domain�_fqdnrrr�
sanitize_item�s*



�zSoSHostnameMap.sanitize_itemcCs\|r||jvr	|S||jvr)d|j}||j|<|jd7_||j|<|�|�|j|S)z�Obfuscate the short name of the host with an incremented counter
        based on the total number of obfuscated host names
        zhost%sr)�	skip_keysrr-r�add_regex_item)rrY�ob_hostrrrrU�s





z"SoSHostnameMap.sanitize_short_namecCsz|jD]}t�|d�|��rd�|�Sq|d��}d�|dd����}|�|�}d�||g�}||jd�|�<|S)zeObfuscate the domainname, broken out into subdomains. Top-level
        domains are ignored.
        rr
r)�ignore_matchesr#�matchrr?�_new_obfuscated_domainr)rr�_skip�
top_domainrXr[rrrr�s
�
zSoSHostnameMap.sanitize_domaincCs2||jvrd|j|j|<|jd7_|j|S)zDGenerate an obfuscated domain for each subdomain name given
        zobfuscateddomain%sr)rr/)rrXrrrrc�s

z%SoSHostnameMap._new_obfuscated_domain)�__name__�
__module__�__qualname__�__doc__rar^r@r-r/rrrr!r'rr9rBr]rUrrc�
__classcell__rrrLrrs*� 	:r)r#�sos.cleaner.mappingsrrrrrr�<module>s


Anon7 - 2022
AnonSec Team