o
    �õ±j«  ã                   @   s.   d dl Z dd„ Zedkreƒ Zeeƒ dS dS )é    Nc                  C   s  ddg} dd„ }i }t  dt j¡}d}t  ||¡}tdƒD ]^}zt  ||¡}t  ||¡}| D ]}	|||	ƒD ]}
d||
< q5q.W q tyf } z|jd d	krTW Y d}~ n(|jd d
kraW Y d}~q‚ d}~w ty{ } z
t	|ƒ W Y d}~qd}~ww t
| ¡ ƒS )z•
	Returns a list of IP addresses which potentially an active DNS server used by the current machine.
	Please be aware that it's not at all precise!
	Ú
NameServerÚDhcpNameServerc              
   S   s°   zKz*i }t  | |¡\}}t|ƒdkr*| d¡dkr&| d¡D ]}d||< qnd||< W n ty= } zW Y d }~nd }~ww W t| ¡ ƒS W t| ¡ ƒS t| ¡ ƒ     Y S )Nr   ú,éÿÿÿÿ)ÚwinregÚQueryValueExÚlenÚfindÚsplitÚ	ExceptionÚlistÚkeys)ÚifaceÚkeynameÚresultÚresÚ_ÚxÚe© r   ú�/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/winacl/functions/winregistry.pyÚget_ips
   s$   
ÿ€€ÿ€þ$z*get_nameserver_candidates.<locals>.get_ipsNz=System\CurrentControlSet\Services\Tcpip\Parameters\Interfacesi   r   é   i  )r   ÚConnectRegistryÚHKEY_LOCAL_MACHINEÚOpenKeyÚrangeÚEnumKeyÚOSErrorÚargsr   Úprintr   r   )Úkeynamesr   ÚipsÚhklmÚkeyÚaKeyÚiÚasubkey_namer   r   r   r   r   r   r   Úget_nameserver_candidates   s6   
ÿÿ€€ÿr(   Ú__main__)r   r(   Ú__name__r   r    r   r   r   r   Ú<module>   s    -þ