https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/sos/report/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/sos/report/plugins/__pycache__/jars.cpython-310.pyc
o

-�_g��@s^ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
Gdd�dee	�ZdS)�N)�partial)�Plugin�RedHatPlugin�	PluginOptc@s^eZdZdZdZdZeddedd�edd	d
d�gZdZ	d
Z
dd�Zdd�Zdd�Z
dd�ZdS)�Jarsz1Collect information about available Java archives�jars)�java�append-locations�z,colon-delimited list of additional JAR paths)�default�val_type�desc�all-known-locationsFzscan all known paths)rr
)z/usr/share/javaz
/usr/lib/java)z/optz
/usr/localz/var/libcCs�dgi}g}ttj�}|�d�r|ttj�7}|�d�}|r%||�d�7}|D]"}t�|�D]\}}}|D]}	|�||	�}
|�	|
�rG|�
|
�q5q.q'|D]}|�|�}|�|�}
|s\|
ri||
|d�}|d�
|�qLt
j|ddd�}|j|d	d
d�dS)Nrrr	�:)�path�sha1�maven_id�)�,�: )�indent�
separatorsz	jars.jsonT)�plug_dir)�listr�
jar_locations�
get_option�extra_jar_locations�split�os�walk�	path_join�is_jar�append�get_maven_id�
get_jar_id�json�dumps�add_string_as_file)�self�results�	jar_paths�	locations�user_locations�location�dirpath�_�	filenames�filenamer�jar_pathr�jar_id�record�results_str�r6�9/usr/lib/python3/dist-packages/sos/report/plugins/jars.py�setup1s:




���

��z
Jars.setupc
Cs�tj�|�rWt�|�rWz*t�|��}d|��vr"	Wd�WdSWd�WdS1s.wYWdSttjfyV}z|�	d|�d|���WYd}~dSd}~wwdS)z�Check whether given file is a JAR file.

        JARs are ZIP files which usually include a manifest
        at the canonical location 'META-INF/MANIFEST.MF'.
        zMETA-INF/MANIFEST.MFNTzCould not determine if z is a JAR: F)
rr�isfile�zipfile�
is_zipfile�ZipFile�namelist�IOError�
BadZipfile�	_log_info)r(r�file�errr6r6r7r!Ts&�������zJars.is_jarc
s~i}z�t�|���}t�d���fdd�|��D�}t|�dkr)	Wd�WdS|�|d��L}|��D]?}|��}|�	d�stz|�
d�\}}|�d	���}|�d	���}|||<Wq5tysYWd�Wd�WdSwq5Wd�n1swYWd�W|SWd�W|S1s�wYW|St
y�}	z|�d
|�d|	���WYd}	~	|Sd}	~	ww)z�Extract Maven coordinates from a given JAR file, if possible.

        JARs build by Maven (most popular Java build system) contain
        'pom.properties' file. We can extract Maven coordinates
         from there.
        z*META-INF/maven/[^/]+/[^/]+/pom.properties$csg|]	}��|�r|�qSr6)�match)�.0�x��rgxr6r7�
<listcomp>psz%Jars.get_maven_id.<locals>.<listcomp>�Nr�#�=�utf8z)Could not extract Maven coordinates from r)r:r<�re�compiler=�len�open�	readlines�strip�
startswithr�decode�
ValueErrorr>r@)
r(r2�propsrA�result�props_f�line�key�valuerBr6rFr7r#esN
�
�������������zJars.get_maven_idc
Cs�d}z2t|dd��}t��}tt|jd�d�D]}|�|�qWd�n1s)wY|��}W|StyR}z|�	d|�d|���WYd}~|Sd}~ww)	zHCompute JAR id.

        Returns sha1 hash of a given JAR file.
        r
�rb)�modei�NzCould not compute JAR id for r)
rP�hashlibr�iterr�read�update�	hexdigestr>r@)r(r2r3rA�digest�bufrBr6r6r7r$�s��
� ��zJars.get_jar_idN)�__name__�
__module__�__qualname__�
short_desc�plugin_name�profilesr�str�option_listrrr8r!r#r$r6r6r6r7rs"���
#r)r_r%rrMr:�	functoolsr�sos.report.pluginsrrrrr6r6r6r7�<module>s


https://t.me/RX1948 - 2025