Server IP : 184.107.3.203 / Your IP : 216.73.216.51 Web Server : Apache System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64 User : adminteladeoro ( 1015) PHP Version : 8.2.28 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /usr/lib/python3.6/site-packages/sos/cleaner/mappings/__pycache__/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
3 ~ �gv � @ s0 d dl Z d dlZd dlmZ G dd� de�ZdS )� N)�SoSMapc @ s| e Zd ZdZdddddddd gZi Zd Zddd dgZdZdd� Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zd S )!�SoSIPMapa� A mapping store for IP addresses Each IP address added to this map is chcked for subnet membership. If that subnet already exists in the map, then IP addresses are deterministically generated sequentially within that subnet. For example, if a given IP is matched to subnet 192.168.1.0/24 then 192.168.1 may be obfuscated to 100.11.12.0/24. Each IP address in the original 192.168.1.0/24 subnet will then be assigned an address in 100.11.12.0/24 sequentially, such as 100.11.12.1, 100.11.12.2, etc... Internally, the ipaddress library is used to manipulate the address objects however, when retrieved by SoSCleaner any values will be strings. z127.*z::1z0\.(.*)?z1\.(.*)?z8.8.8.8z8.8.4.4z 169.254.*z255.*�d Z127Z169Z172Z192Fc C s@ x:| j j� D ],}t|�jddd�d |jd�d krdS qW dS )a There are multiple ways in which an ip address could be handed to us in a way where we're matching against a previously obfuscated address. Here, match the ip address to any of the obfuscated addresses we've already created �/� )�maxsplitr TF)�dataset�values�str�split)�selfZipaddr�_ip� r �/usr/lib/python3.6/ip_map.py� ip_in_dataset1 s $zSoSIPMap.ip_in_datasetc C s� d}|j |�r|jdj|��}|| jkr2| j| S | j|�sF| j|�rJ|S d|kr�x.| jj� D ] \}}|j |�r^|jd�d S q^W | j|�S )zEnsure that when requesting an obfuscated address, we return a str object instead of an IPv(4|6)Address object r �=�]�)� r )r r r r ) � startswith�lstrip�joinr Zignore_itemr �itemsr �add)r �itemZ filt_start�key�valuer r r �get= s zSoSIPMap.getc C sb g }x8| j D ].}|j|jkr&||_dS |j|kr|j|� qW |r^|jdd� dd� |d |_dS )a/ Determine if a given address is in a subnet of an already obfuscated network and if it is, then set the address' network to the network object we're tracking. This allows us to match ip addresses with or without a CIDR notation and maintain proper network relationships. Nc S s | j S )N)� prefixlen)�nr r r �<lambda>h s z;SoSIPMap.set_ip_cidr_from_existing_subnet.<locals>.<lambda>T)r �reverser )� _networks�ip�broadcast_address�network�append�sort)r �addrZnetsZnetr r r � set_ip_cidr_from_existing_subnetV s z)SoSIPMap.set_ip_cidr_from_existing_subnetc C sf yt j|�}W n" tk r0 | jj|� � Y nX |j}t|j�dkrR| j|� n | j |� | j |�S )ziGiven an IP address, sanitize it to an obfuscated network or host address as appropriate z255.255.255.255)� ipaddressZip_interface� ValueError�ignore_matchesr&