Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
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

i��d{�@s^ddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
Gdd�dee	�ZdS)�N)�partial)�Plugin�RedHatPlugin�	PluginOptc@sjeZdZdZdZdZeddedd�edd	d
d�gZdZ	d
Z
dd�Zedd��Z
edd��Ze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]}	|�||	�}
t�	|
�rG|�
|
�q5q.q'|D]}t�|�}t�|�}
|s\|
ri||
|d�}|d�
|�qLt
j|ddd�}|j|d	d
d�dS)Nrrr	�:)�path�sha1�maven_id�)�,z: )�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�r5�9/usr/lib/python3/dist-packages/sos/report/plugins/jars.py�setup1s:




���

��z
Jars.setupc	Cs�tj�|�rCt�|�rCz*t�|��}d|��vr"	Wd�WdSWd�WdS1s.wYWdSttjfyBYdSwdS)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.MFNTF)	rr�isfile�zipfile�
is_zipfile�ZipFile�namelist�IOError�
BadZipfile)r�fr5r5r6r Ts �����zJars.is_jarcsVi}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�Y|Sw)
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|�qSr5)�match)�.0�x��rr5r6�
<listcomp>psz%Jars.get_maven_id.<locals>.<listcomp>�Nr�#�=�utf8)r9r;�re�compiler<�len�open�	readlines�strip�
startswithr�decode�
ValueErrorr=)r1�propsr?�result�props_f�line�key�valuer5rCr6r"dsH
�
�����������zJars.get_maven_idcCs~d}z2t|dd��}t��}tt|jd�d�D]}|�|�qWd�n1s)wY|��}W|Sty>Y|Sw)zHCompute JAR id.

        Returns sha1 hash of a given JAR file.
        r
�rb)�modei�N)	rM�hashlibr�iterr�read�update�	hexdigestr=)r1r2r?�m�bufr5r5r6r#�s��
��zJars.get_jar_idN)�__name__�
__module__�__qualname__�
short_desc�plugin_name�profilesr�str�option_listrrr7�staticmethodr r"r#r5r5r5r6rs(���
#

r)r\r$rrJr9�	functoolsr�sos.report.pluginsrrrrr5r5r5r6�<module>s


Spamworldpro Mini