404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.137.164.254: ~ $
3

e�$g��D@sJdZddlmZmZmZmZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl
mZyeWnek
r�eZYnXyddlZdZWnek
r�d	ZYnXyddlZddlZdZWnek
r�d	ZYnXddlZejd
dd�Zeed��seje_ejZddlZejd
dg��ddl Z WdQRXddl	m!Z!yddl"m#Z#m$Z$dZ%Wn^ek
�r�yddl&m#Z#m$Z$dZ%Wn.ek
�r�ddl'm(Z(m)Z)m*Z*dZ%YnXYnXyddl+Z+Wnek
�r�dZ+YnXej,j-d�yddl.m/Z0dZ1Wnek
�r*d	Z1YnXda2da3dd�Z4e4�Z5e5�rfe j6�e!j7�Z8e8j9de5�dd�Z:dd�Z;dd�Z<dd�Z=d d!�Z>d"d#�Z?d$d%�Z@d&d'�ZAd(d)�ZBd*d+�ZCd,d-�ZDd.d/�ZEd0d1�ZFd2d3�ZGd4d5�ZHd6d7�ZId8d9�ZJd:d;�ZKd<d=�Z/eLd>k�rFx<e/�D]2ZMx&eMjN�D]ZOePd?eOeMeOf��qWeP�qWdS)@z1Used to read hardware info from kudzu, /proc, etc�)�gethostname�getaddrinfo�AF_INET�AF_INET6N)�config)�	rhnserver)�up2dateUtils)�ustrTFzrhn-client-tools)Zfallback�ugettextzFailed to save log entryzSMBIOS.*: entry point at)�
up2dateLog)�get_devices�get_computer_info�)�check_hal_dbus_status�get_hal_computer�read_halz/usr/share/rhsm)�HardwarecCsttd�sdStj�S)N�get_warnings)�hasattr�	dmidecoder�rr�/usr/lib/python3.6/hardware.py�dmi_warnings[s
rz.Warnings collected during dmidecode import: %sc	Cs�tdkr�trdStj�}|jtj�y6|jd�}t�}|rXtj�t	j
�}|jd|�Wn dat�}|rxtj�dS|j�atS)z= Initialize _dmi_data unless it already exist and returns it N�allzdmidecode warnings: %sr)
�	_dmi_data�_dmi_not_availablerZdmidecodeXMLZ
SetResultTypeZ
DMIXML_DOCZQuerySectionr�clear_warningsr�initLog�	log_debugZxpathNewContext)Zdmixml�data�dmi_warn�logrrr�_initialize_dmi_datags(
r"cCs6t�}|dkrdS|j|�}|gkr.|djSdSdS)z� Fetch DMI data from given section using given path.
        If data could not be retrieved, returns empty string.
        General method and should not be used outside of this module.
    N�r)r"Z	xpathEvalZcontent)�pathZdmi_datarrrr�get_dmi_data�s

r%cCstd�S)zt Return Vendor from dmidecode bios information.
        If this value could not be fetch, returns empty string.
    z/dmidecode/BIOSinfo/Vendor)r%rrrr�
dmi_vendor�sr&cCstd�}|sd}|S)zt Return UUID from dmidecode system information.
        If this value could not be fetch, returns empty string.
    z7/dmidecode/SystemInfo/SystemUUID[not(@unavailable='1')]r#)r%)Zuuidrrr�dmi_system_uuid�sr'cCs�tjdtj�siStdd�j�}i}d|d<x`|D]X}t|�s@q2|jd�}t|�dkrXq2|dj�}||d<dj|dd��j�||d<q2W|S)	Nz/etc/sysconfig/installinfo�rZINSTALLINFO�class�=rrr#)	�os�access�R_OK�open�	readlines�len�split�strip�join)ZinstallinfoZinstalldict�info�valsZstrippedstringrrr�read_installinfo�s

"r6csHytjd�}Wntk
r&g}YnXtjd��t�fdd�|D��S)z� returns number of CPU in system

    Beware that it can be different from number of active CPU (e.g. on s390x architecture
    z/sys/devices/system/cpu/z^cpu[0-9]+$csg|]}�j|�r|�qSr)�match)�.0�i)�re_cpurr�
<listcomp>�szcpu_count.<locals>.<listcomp>)r+�listdir�OSError�re�compiler0)Zcpu_dirr)r:r�	cpu_count�s

r@cCs�ytrt�j�dSWnYnXd}tjdtj�r�y^tjd�j�}d}x6|D].}|jd�r`qPt	|j
d�d�}||krP|}qPW|dkr�d|SWnYnXtjd	tj��r$ydtd	d
�j�}t
�}x4|D],}d|kr�t	|j
d�dj��}|j|�q�Wt|�dk�rt|�SWnYnXtjd
tj��r�yFtjd�j�}d}x |D]}d|k�rN|d7}�qNW|dk�rx|SWnYnXdS)Nzcpu.cpu_socket(s)rz/usr/bin/lscpuz/usr/bin/lscpu -pr�#�,�z
/proc/cpuinfor(zphysical id�:z/usr/sbin/dmidecodez /usr/sbin/dmidecode -t processorzProcessor Information���rE)�subscription_manager_available�SubManHardwareZ
getCpuInfor+r,�X_OK�popenr/�
startswith�intr1r-r.�setr2�addr0)�number_sockets�linesZmax_socket_index�lineZsocket_indexZ
socket_ids�countrrr�__get_number_sockets�sX





rRc
Csxdd�}dd�}tjdtj�s"iStr4tjtjd�tdd�j�}tj�dj	�}t
�}d	d
d�}|dd
kr~|dFd�dks�|dk�rz||�}|dkr�d|d<nd|d<||d<||d�|d<||d�|d<||d�|d<||d�|d<||d�|d<||d�|d<||d�|d<||d �|d!<||d"�}|d#k�r:d$}yttt
|��d%�|d&<Wntk
�rtdG|d&<YnX�n||dHk�rp||�}d'|d<||d)�|d<||d*�|d<||d+�|d<||d,�|d<d-||d.�||d/�f|d0<||d1�|d<d#|d<||d�|d<||d2�|d!<||d3�}|j�}y ttt
|d���d4|d&<Wntk
�rjdI|d&<YnX�n�|dJk�r.||�}||d<||d<||d6�|d<||d7�|d<||d8�|d<||d9�|d<||d�|d<|d"}yttt
|��d%�|d&<Wntk
�rdK|d&<YnX||d:�|d!<�n�|dLk�r�||�}||d<||d<||d*�|d<||d9�|d<||d�|d<||d<�|d<||d=�ddM�}yttt
|��d%�|d&<Wntk
�r�dN|d&<YnX�n|dOk�r�i}xH|jdA�D]:}	|	jdB�}
t|
�dk�r�q�|
d%j�||
dj�<�q�W||d<||d�|d<||d<||d<||dC�|d<d#|d<d#|d<d#|d<d#|d<||d:�|d!<d|d&<nX||d<||d<||d<||d<d#|d<d#|d<d#|d<d#|d<d#|d<d#|d!<d|d&<|d�s
d%|d<n@yt|d�|d<Wnd%|d<YnX|ddk�rJd%|d<tj�}|jjdD��rtt�}|�rt||dE<|S)PNcSs|j�}||krdS||S)Nr#)�lower)�a�entry�errr�	get_entry�szread_cpuinfo.<locals>.get_entrycSs�d}i}x�|jd�D]|}t|�s"q|d}|dkr4PxZ|jd�D]L}t|�sNq@|jd�}t|�dkrfq@|dj�|dj�}}|||j�<q@WqW|S)Nrz

r�
rDrC)r1r0r2rS)�cpulistrQ�tmpdict�cpuZcpu_attrr5�name�valuerrr�get_cpulist_as_dicts"
z)read_cpuinfo.<locals>.get_cpulist_as_dictz
/proc/cpuinfo�Cr(�ZCPUZ	Processor)r)Zdescrr9rC�86�x86_64�platformZi386rQZ	vendor_id�typez
model nameZmodelz
cpu familyZmodel_numberZ	model_verZsteppingZ	model_revz
cache size�cacheZbogomips�flags�otherzcpu mhzr#z-1rZspeed�alpha�alphaev6z
cpus detectedr[z	cpu modelz
cpu variationz%s/%szsystem typezsystem variationZ
model_versionzcpu revisionzplatform stringzcycle frequency [Hz]i@B�ia64�vendor�familyZarchrevZrevisionZfeatures�ppc64�machineZclock��s390�s390xrXz: zbogomips per cpuZcpu_socketsZsocket_count���rE)rhrirE)rjrE)rm���rE)rprq)r+r,r-�locale�	setlocale�
LC_NUMERICr.�read�unamerSr@rK�round�float�
ValueErrorr1r0r2rZ	RhnServerZcapabilitiesZ
hasCapabilityrR)
rWr^rYrxrQZhwdictrZZ	mhz_speedZhz_speedr[r5�srNrrr�read_cpuinfo�s�	&





 






r}cCs@tj�}|d}|dd�dkr&t�S|dd�dkr<t�SdS)NrCroz2.6z2.4)r+rx�read_memory_2_6�read_memory_2_4)ZunZkernelrrr�read_memory�sr�cCs�tjdtj�siStdd�j�}|jd�}|d}|j�}i}d|d<tt|d�d�}|dkrt|d	|d	}n|d
|d
}t|�|d<|d}|j�}tt|d�d�}t|�|d
<|S)Nz
/proc/meminfor(rXr�MEMORYr)i� r`��ramrC�swapii)	r+r,r-r.rwr1rK�long�str)�meminforOZcurlineZmemlist�memdict�megsrrrr�s$
rcCs�tjdtj�siStdd�j�}|jd�}i}xB|D]:}|jdd�}|d}t|�dkrZq4|dj�}|||<q4Wi}d|d<|d	}|jd
�}	t|	d�}
t|
d�}|d}|jd
�}	t|	d�}
t|
d�}t	|�|d
<t	|�|d<|S)Nz
/proc/meminfor(rXrDrrr�r)ZMemTotal� iZ	SwapTotalr�r�)
r+r,r-r.rwr1r0r2r�r�)r�rOZmeminfo_dictrPZblobs�keyr]r�Z	total_strZblipsZtotal_kr�Zswap_strZswap_kZ	swap_megsrrrr~�s2



r~cCsBtj�}tj�}ddd�}d}d}d}�x|D�]}|jd�d}|jd�d}||}	x�ttfD]�}
ytj|
�}Wntjk
r�wbYnX|d	r�tj�}|jd�\}}	t	|	�}	yR|j
d
�|j||	f�|j�d}
|
tkr�|
}n|
}tj
|
�}||
k�r|}Wn"tjk
�r(|j�wbYnX|j�qbWq.Wtjjd��r�tjdtj��r�tdd�j�}x�|D]}t|��s~�ql|j�}�qlWn�tjjd
��r tjd
tj��r td
d�j�}xd|D]\}t|��sҐq�|jd�}t|�dk�r�q�|dj�dk�r�dj|dd��jd�}P�q�W|dk�s4|dk�r8d}|||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)ZhttpsZhttpN�/rCrDrZenableProxy�z
/etc/hostnamer(z/etc/sysconfig/networkr*rZHOSTNAMEr#z"' 	
zlocalhost.localdomain�unknown)r�initUp2dateConfigZ
getServerlURLr1rr�socket�errorZgetProxySettingrKZ
settimeoutZconnectZgetsockname�getfqdn�closer+r$�isfiler,r-r.r/r0r2r3)�cfgZsl�st�hostnameZintfZintf6Z	serverUrlZserverZ
servertypeZportrlr|Zserver_portZintf_tmpZhostname_tmpZhostnameinfor4Znetworkinfor5rrr�findHostByRoute�sj








r�c	Cs�d}ytd|d�}Wn
|Sd}xV|j�D]J}|rT|jd�dkrT|j�d}P|jd�dkr0|j�d	}||kr0d
}q0W|j�|S)
Nr#z/proc/net/bonding/%sr(FzPermanent HW addr: rrozSlave Interface: rCTrErE)r.r/�findr1r�)�masterZslave�hwaddrZbondingZslave_foundrPZifnamerrr�get_slave_hwaddrFs r�cCs.i}d|d<t�\|d<|d<|d<|ddkrRt�|d<d|dkrRtj�|d<|ddkr�y4t|dd�}tdd	�|�}|d
dd
|d<Wnd|d<YnX|ddkr�y4t|dd�}td
d	�|�}|d
dd
|d<Wnd|d<YnX|ddk�rd|d<|ddk�r*d|d<|S)NZNETINFOr)r��ipaddrZip6addrr��.cSs|dtjkS)Nr)r�r)�xrrr�<lambda>iszread_network.<locals>.<lambda>rr`z	127.0.0.1cSs|dtjkS)Nr)r�r)r�rrrr�rsz::1r#)r�rr�r�r�filter)ZnetdictZ
list_of_addrsZ
ipv4_addrsZ
ipv6_addrsrrr�read_network[s4
r�c4Cs�i}d|d<tr(tr(tjjd�|StrFtttj�tj	���}nt
j�}�x6|D�],}y,trntj|�}nt
j
|�t
jdd}Wnd}YnXytjd|�}Wnd}YnX|r�tjj|�}t||�}y@tr�tj|�}n,td|d	�}|j�jd
�dj�}|j�Wn |dk�r0d
}nd}YnXy.t�rNtj|�}nt
j
|�t
jdd}Wnd}YnXy.t�r�tj|�}	nt
j
|�t
jdd}	Wnd}	YnXy.t�r�tj|�}
nt
j
|�t
jdd}
Wnd}
YnXg}t�r`tj|�}xL|D]D}
x<|
j�D]0}|j }|dk�r:d}|j!||j"|j#d���q"W�qW�ny�x�t
j
|�t
j$D]�}|djd�d}t%j&|�}|j'�r�d}n(|j(�r�d}n|j)�r�d}n|j*�r�d}|d}d}xd|jd�D]V}|�s�PnF|j+�dk�r|d7}n.|dt,t-|jd�dd��dd�j.d�7}�q�W|j!|||d���qtWWnt/k
�rlYnX|||	|
||d�||<qVW|S)NZ
NETINTERFACESr)zWWarning: information about network interfaces could not be retrieved on this platform.
r�addrr#z/sys/class/net/%s/masterz/sys/class/net/%s/device/ueventr(r*r�loZloopbackZUnknown�netmask�	broadcast�globalZuniverse)�scoper�r��%�link�hostZsiterDZffffr�r�rC�1)r�r�r�r��moduleZipv6)0�ethtool_present�netifaces_present�sys�stderr�write�listrL�ethtoolrZget_active_devices�	netifaces�
interfacesZ
get_hwaddrZifaddressesZAF_LINKr+�readlinkr$�basenamer�Z
get_moduler.�readliner1r2r�Z
get_ipaddrrZget_netmaskZ
get_broadcastZget_interfaces_infoZget_ipv6_addressesr��appendZaddressr�r�	ipaddressZIPv6AddressZ	is_globalZ
is_link_localZis_loopbackZ
is_site_localrS�binrK�rindex�KeyError)ZintDictr�Z	interfacer�r�Zmaster_interfacer�Zdriver_filer�r�r�Zip6_listZdev_infor4Zip6r�Zip6_addrZ
scope_infoZip6_netmaskZnetmask_bitsZ
two_octetsrrr�read_network_interfaces~s�












4r�c	CsBi}d|d<tj�dj�}|ddko6|dd�dkrH|dkrH|St�}|rZ||d	<td
�}|rn||d<td�}|r�|d
|}||d<td�|d<td�}|r�||d<td�}|r�||d<td�}|r�||d<td�}td�}td�}	td�}
dd|d|d|	d|
f|d<x*t|j��D]}||dk�r ||=�q W|S)NZDMIr)r`rr9rCrarbrkz!/dmidecode/SystemInfo/ProductName�productz/dmidecode/SystemInfo/Versionr��systemz%/dmidecode/BaseBoardInfo/ManufacturerZboardz/dmidecode/BIOSinfo/VendorZbios_vendorz/dmidecode/BIOSinfo/VersionZbios_versionz/dmidecode/BIOSinfo/ReleaseDateZbios_releasez#/dmidecode/ChassisInfo/SerialNumberz/dmidecode/ChassisInfo/AssetTagz%/dmidecode/BaseBoardInfo/SerialNumberz"/dmidecode/SystemInfo/SerialNumberz#(%s: %s) (%s: %s) (%s: %s) (%s: %s)ZchassisZassetrr)r+rxrSr&r%r��keys)Zdmidictrxrkr��versionr��releaseZchassis_serialZchassis_tagZboard_serialZ
system_serial�krrr�read_dmisJ(r�c
Cs�ytrt�}nt�}|j�}Wn6tk
rTtj�}dtj�d}|j	|�iSXi}x*|D]"}|j
d�r`t||�|t|�<q`W|jt
��|S)Nz0Error reading system and smbios information: %s
rr�)�using_gudevr
rZGetAllProperties�	Exceptionrrr��exc_inforrJr	�update�
get_smbios)ZpropsZcomputerr!�msgZsystem_and_smbiosr�rrr�get_hal_system_and_smbios;s 


r�c	CsDt�triSt�t�td�td�td�td�td�td�d�SdS)	a
 Returns dictionary with values we are interested for.
        For historical reason it is in format, which use HAL.
        Currently in dictionary are keys:
        smbios.system.uuid, smbios.bios.vendor, smbios.system.serial,
        smbios.system.manufacturer.
    z"/dmidecode/SystemInfo/SerialNumberz"/dmidecode/SystemInfo/Manufacturerz!/dmidecode/SystemInfo/ProductNamez/dmidecode/SystemInfo/SKUnumberz/dmidecode/SystemInfo/Familyz/dmidecode/SystemInfo/Version)zsmbios.system.uuidzsmbios.bios.vendorzsmbios.system.serialzsmbios.system.manufacturerzsmbios.system.productzsmbios.system.skunumberzsmbios.system.familyzsmbios.system.versionN)r"rr'r&r%rrrrr�Psr�c.Cs"trt�}nzt�\}}d}|s"|r<tj�}d}|j|�d}g}|r�yt�}|rT|}Wn.tj�}dtj�d}|j|�YnXyt	�}|r�|j
|�Wn"ttd�tj�d�YnXyt
�}|r�|j
|�Wn"ttd�tj�d�YnXtj�}|d�sNyt�}|�r(|j
|�Wn"ttd�tj�d�YnXyt�}|�rf|j
|�Wn.tj�}d	tj�d}|j|�YnXyt�}|�r�|j
|�Wn"ttd
�tj�d�YnX|d�syt�}|�r�|j
|�Wn"ttd�tj�d�YnX|S)NrzaWarning: haldaemon or messagebus service not running. Cannot probe hardware and DMI information.
rz'Error reading hardware information: %s
zError reading cpu information:z(Error reading system memory information:ZskipNetworkz%Error reading networking information:z"Error reading DMI information: %s
z)Error reading install method information:z,Error reading network interface information:)r�rrrrZlog_merr�r�r}r��print�_r�rr�r�r�r6r�)ZallhwZ
hal_statusZdbus_statusZhwdaemonr!r��retr�rrrrgsz



r�__main__z'%s' : '%s')Q�__doc__r�rrrrr>r+r�Zup2date_clientrrrZrhn.i18nr	r��	NameErrorrKr�r��ImportErrorr�r�r��gettextZtranslation�trr
r�ZdbusZsuppress_errorsrrZup2date_client.hardware_udevrr
r�Zup2date_client.hardware_gudevZup2date_client.hardware_halrrrrtr$r�Zsubscription_manager.hwproberrGrFrrrr rrr!rr"r%r&r'r6r@rRr}r�rr~r�r�r�r�r�r�r��__name__Zhwr�r�r�rrrr�<module>s�





7B!K#:]


Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
capabilities.cpython-36.opt-1.pyc File 5.28 KB 0644
capabilities.cpython-36.pyc File 5.34 KB 0644
cldetect.cpython-36.opt-1.pyc File 2.31 KB 0644
cldetect.cpython-36.pyc File 2.31 KB 0644
clientCaps.cpython-36.opt-1.pyc File 1.98 KB 0644
clientCaps.cpython-36.pyc File 1.98 KB 0644
clpwd.cpython-36.opt-1.pyc File 3.9 KB 0644
clpwd.cpython-36.pyc File 3.9 KB 0644
config.cpython-36.opt-1.pyc File 10.38 KB 0644
config.cpython-36.pyc File 10.38 KB 0644
debUtils.cpython-36.opt-1.pyc File 2.03 KB 0644
debUtils.cpython-36.pyc File 2.03 KB 0644
getMethod.cpython-36.opt-1.pyc File 2.25 KB 0644
getMethod.cpython-36.pyc File 2.25 KB 0644
haltree.cpython-36.opt-1.pyc File 3.07 KB 0644
haltree.cpython-36.pyc File 3.07 KB 0644
hardware.cpython-36.opt-1.pyc File 18.42 KB 0644
hardware.cpython-36.pyc File 18.42 KB 0644
hardware_gudev.cpython-36.opt-1.pyc File 7.69 KB 0644
hardware_gudev.cpython-36.pyc File 7.69 KB 0644
hardware_hal.cpython-36.opt-1.pyc File 6.73 KB 0644
hardware_hal.cpython-36.pyc File 6.73 KB 0644
hardware_udev.cpython-36.opt-1.pyc File 7.67 KB 0644
hardware_udev.cpython-36.pyc File 7.67 KB 0644
pkgUtils.cpython-36.opt-1.pyc File 269 B 0644
pkgUtils.cpython-36.pyc File 269 B 0644
pkgplatform.cpython-36.opt-1.pyc File 288 B 0644
pkgplatform.cpython-36.pyc File 288 B 0644
pmPlugin.cpython-36.opt-1.pyc File 2.45 KB 0644
pmPlugin.cpython-36.pyc File 2.45 KB 0644
rhnChannel.cpython-36.opt-1.pyc File 4.39 KB 0644
rhnChannel.cpython-36.pyc File 4.39 KB 0644
rhnHardware.cpython-36.opt-1.pyc File 468 B 0644
rhnHardware.cpython-36.pyc File 468 B 0644
rhnPackageInfo.cpython-36.opt-1.pyc File 1.9 KB 0644
rhnPackageInfo.cpython-36.pyc File 1.9 KB 0644
rhncli.cpython-36.opt-1.pyc File 7.17 KB 0644
rhncli.cpython-36.pyc File 7.17 KB 0644
rhnreg.cpython-36.opt-1.pyc File 27 KB 0644
rhnreg.cpython-36.pyc File 27.25 KB 0644
rhnreg_constants.cpython-36.opt-1.pyc File 13.69 KB 0644
rhnreg_constants.cpython-36.pyc File 13.69 KB 0644
rhnserver.cpython-36.opt-1.pyc File 4.6 KB 0644
rhnserver.cpython-36.pyc File 4.6 KB 0644
rpcServer.cpython-36.opt-1.pyc File 7.27 KB 0644
rpcServer.cpython-36.pyc File 7.27 KB 0644
rpmUtils.cpython-36.opt-1.pyc File 3.11 KB 0644
rpmUtils.cpython-36.pyc File 3.11 KB 0644
transaction.cpython-36.opt-1.pyc File 2.59 KB 0644
transaction.cpython-36.pyc File 2.59 KB 0644
tui.cpython-36.opt-1.pyc File 31.25 KB 0644
tui.cpython-36.pyc File 31.25 KB 0644
up2dateAuth.cpython-36.opt-1.pyc File 7.07 KB 0644
up2dateAuth.cpython-36.pyc File 7.07 KB 0644
up2dateErrors.cpython-36.opt-1.pyc File 13.32 KB 0644
up2dateErrors.cpython-36.pyc File 13.32 KB 0644
up2dateLog.cpython-36.opt-1.pyc File 2.48 KB 0644
up2dateLog.cpython-36.pyc File 2.48 KB 0644
up2dateUtils.cpython-36.opt-1.pyc File 4.06 KB 0644
up2dateUtils.cpython-36.pyc File 4.06 KB 0644