|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.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 : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /usr/lib/python3.9/site-packages/up2date_client/__pycache__/ |
a
۔*j` � @ s� d Z ddlmZmZmZmZ ddlZddlZddlZddlm Z ddl
Z
e
jddd�Ze
ed�shej
e_ejZzddlZW n ey� dZY n0 d d
� Zdd� Zd
d� ZdS )z1Used to read hardware info from kudzu, /proc, etc� )�gethostname�getaddrinfo�AF_INET�AF_INET6N)�configzrhn-client-toolsT)�fallback�ugettextc
C s2 t �� } t �� }ddd�}d}d}d}|D �] }|�d�d }|�d�d }|| } ttfD ]�}
zt�|
�}W n tjy� Y q\Y n0 | d r�t �� }|�d�\}} t | �} zP|�
d
� |�|| f� |�� d }
|
tkr�|
}n|
}t�
|
�}||
kr�|}W n" tj�y |�� Y q\Y n0 |�� q\q*tj�d��r~t�dtj��r~tdd��� }|D ]}t|��sp�q^|�� }�q^n�tj�d
��rt�d
tj��rtd
d��� }|D ]`}t|��s��q�|�d�}t|�dk�rܐq�|d �� dk�r�d�|dd� ��d�} �q�q�|dk�s$|dk�r(d}|||fS )z� returns [hostname, intf, intf6]
Where hostname is you FQDN of this machine.
And intf is numeric IPv4 address. And intf6 is IPv6 address.
i� �P )�https�httpN�/� �:r ZenableProxy� z
/etc/hostname�rz/etc/sysconfig/network�=� ZHOSTNAME� z"'
zlocalhost.localdomain�unknown)r �initUp2dateConfigZgetServerURL�splitr r �socket�errorZgetProxySetting�intZ
settimeoutZconnectZgetsockname�getfqdn�close�os�path�isfile�access�R_OK�open� readlines�len�strip�join)�cfg�sl�st�hostnameZintfZintf6Z serverUrlZserverZ
servertype�portZfamily�sZserver_portZintf_tmpZhostname_tmpZhostnameinfo�infoZnetworkinfoZvals� r- �;/usr/lib/python3.9/site-packages/up2date_client/hardware.py�findHostByRoute&