403Webshell
Server IP : 138.197.107.151  /  Your IP : 216.73.217.120
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : wpbetasites_mrakzqskir ( 1022)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/sos/upload/targets/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/sos/upload/targets/__pycache__/redhat.cpython-312.pyc
�

G%@i))���ddlZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZ
	ddlZdZGd	�d
e�Zy#e$rdZY�wxYw)�N)�UploadTarget)�
convert_bytes�TIMEOUT_DEFAULT)�DeviceAuthorizationClass)�
RHELPolicy)�_sosTFc���eZdZdZdZdZdZd�fd�	ZdZdZ	e	Z
d	ZdZd
Z
d�Z�fd�Zd
�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�fd�	Zd�Z�fd�Z�xZS)�RHELUploadTargetzVhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/auth/devicezPhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/tokenzRed Hat Upload Target�redhatNc�*��t�|�|||��y)N)�parser�args�cmdline)�super�__init__)�selfr
rr�	__class__s    ��;/usr/lib/python3/dist-packages/sos/upload/targets/redhat.pyrzRHELUploadTarget.__init__!s���
����T�7��C�zhttps://api.access.redhat.comzsftp://sftp.access.redhat.com�posti@c�<�t|jdt�S)z.Return true if we are running in a RHEL system�policy)�
isinstance�commonsr�rs r�check_distributionz#RHELUploadTarget.check_distribution-s���$�,�,�x�0�*�=�=rc�`��t�|�|�|jdj|_y)N�cmdlineopts)r�pre_workr�upload_directory)r�hook_commonsrs  �rrzRHELUploadTarget.pre_work1s'���
����&� $���]� ;� L� L��rc�
�|jdjr$|jjt	d��|jdj
s-|j|_|jjd�yy)NrzVThe option --upload-user has been deprecated in favour of device authorization in RHELz&No case id provided, uploading to SFTP)r�upload_user�ui_log�info�_�case_id�RH_SFTP_HOST�
upload_urlrs r�prompt_for_upload_userz'RHELUploadTarget.prompt_for_upload_user7sl���<�<�
�&�2�2��K�K����5�6�
��|�|�M�*�2�2�"�/�/�D�O��K�K���E�F�3rc��|jdjr%|jjt	d��yy)NrzVThe option --upload-pass has been deprecated in favour of device authorization in RHEL)r�upload_passr$r%r&rs r�prompt_for_upload_passwordz+RHELUploadTarget.prompt_for_upload_passwordBs8���<�<�
�&�2�2��K�K����5�6�
�3rc��d|jdj�d�}	|jr|jS|jdjr|jdjS|jdjdk(r|jS|jdjs|jS	|j�|��S#t
$r(}|jjd|���Yd}~�<d}~wwxYw)Nz/support/v1/cases/rz/attachments�sftpz=There was a problem while setting the remote upload target:  )	rr'r)�upload_protocolr(�	Exceptionr$r%�RH_API_HOST)r�rh_case_api�es   r�get_upload_urlzRHELUploadTarget.get_upload_urlJs���*����]�3�;�;�<�L�J��	�������&��|�|�M�*�5�5��|�|�M�2�=�=�=��|�|�M�*�:�:�f�D��(�(�(��<�<�
�.�6�6��(�(�(�7��"�"�#�K�=�1�1���	��K�K���*�*+��.�
�
��	�s(�C�1C�)'C�$C�	C8�C3�3C8c�(�d|j��}d|iS)NzBearer �
Authorization)�
_device_token)r�str_auths  r�_get_upload_https_authz'RHELUploadTarget._get_upload_https_auth^s ���T�/�/�0�1����*�*rc��d|jjd�d||j�fi}t|j|j
�}|j
�|_|jjd|j����tj|j�||j�|t��S)z�If upload_https() needs to use requests.post(), use this method.

        Policies should override this method instead of the base upload_https()

        :param archive:     The open archive file object
        �file�/����/Device authorized correctly. Uploading file to )�files�headers�verify�timeout)�name�split�_get_upload_headersr�client_identifier_url�token_endpoint�get_access_tokenr8r$r%�get_upload_url_string�requestsrr5r:r)r�archiverBr@�RHELAuths     r�_upload_https_postz#RHELUploadTarget._upload_https_postbs���
�W�\�\�'�'��,�R�0�'��-�-�/�1�
��,��*�*��#�#���&�6�6�8��������J� �6�6�8�9�;�	<��}�}�T�0�0�2�%�%)�%@�%@�%B�$*�O�E�	Erc�b�|j�j|j�rddd�SiS)N�falsezno-cache)�	isPrivatez
cache-control)r5�
startswithr2rs rrFz$RHELUploadTarget._get_upload_headers{s/����� �+�+�D�,<�,<�=�!(�:�F�F��	rc���|j�j|j�ry|j�j|j�ry|j	|j
�S)NzRed Hat Customer PortalzRed Hat Secure FTP)r5rRr2r(�_get_obfuscated_upload_urlr)rs rrJz&RHELUploadTarget.get_upload_url_string�sW����� �+�+�D�,<�,<�=�,���� �+�+�D�,=�,=�>�'��.�.�t���?�?rc��|jjd�d}|jdjr|jdj�d|��}|jr*t
jj|j|�}|S)z�The RH SFTP server will only automatically connect file uploads to
        cases if the filename _starts_ with the case number
        r=r>rr&)�upload_archive_namerErr'r �os�path�join)r�fnames  r�_get_sftp_upload_namez&RHELUploadTarget._get_sftp_upload_name�sy���(�(�.�.�s�3�B�7���<�<�
�&�.�.��|�|�M�2�:�:�;�1�U�G�D�E�� � ��G�G�L�L��!6�!6��>�E��rc����|jjd�d|j�vrt�|��St
st
d��d}d}|js6	t|j|j�}|j�|_|jr,|jjd|j����|j dz}d}	|jr�|j#�}
t%j&||
d	�
�}	|	j(dk(rFt+j,|	j.�d}t+j,|	j.�d
}�n|jj1d|	j(�d|	j+����|jj3d�n�ddi}t%j&|t+j4|�d	��}|j(dk(rRt+j,|j.�}
|
d}|
d
}|jjt7d|�d���n9|jj1d|j(�d|j+����|r|rt�|�|||��St
d��#t$r3}dt|�vr|jjd�Yd}~��Hd}~wwxYw)z�Override the base upload_sftp to allow for setting an on-demand
        generated anonymous login for the RH SFTP server if a username and
        password are not given
        z//�zPpython3-requests is not installed and is required for obtaining SFTP auth token.Nzend user deniedz:Device token authorization has been cancelled by the user.r?z/support/v2/sftp/token�
)rArC���username�tokenz$DEBUG: auth attempt failed (status: z): zUUnable to retrieve Red Hat auth token using provided credentials. Will try anonymous.�isAnonymousT)�datarCzUser z^ used for anonymous upload. Please inform your support engineer so they may retrieve the data.z)DEBUG: anonymous request failed (status: )�user�password�user_dirz1Could not retrieve valid or anonymous credentials)r(rEr5r�upload_sftp�REQUESTS_LOADEDr1r8rrGrHrI�strr$r%rJr2r:rKr�status_code�json�loads�text�debug�error�dumpsr&)rrdrerf�_token�_userrMr4�url�retrA�adata�anon�resprs              �rrgzRHELUploadTarget.upload_sftp�s����
���"�"�4�(��+�4�3F�3F�3H�H��7�&�(�(���>�?�
?�����
�!�!�
A�3��.�.��'�'���&.�%>�%>�%@��"�����K�K���!�!%�!;�!;�!=� >�@�
A����!9�9��������1�1�3�G��-�-��W�b�A�C����#�%��
�
�3�8�8�,�Z�8�����C�H�H�-�g�6�����!�!�:�3�?�?�:K�3��x�x�z�l�$�����!�!�7��
#�D�)�E��=�=��4�:�:�e�+<�b�I�D����3�&��z�z�$�)�)�,���Z�(���g������ � ���e�W�%M�N�O��
���!�!�?��'�'�(��D�I�I�K�=�:���V��7�&�E�F�05�'�7�
7��K�L�L��g�
�%��A��.��K�K�$�$�:����	
�s�  J&�&	K"�/(K�K"c��tjj|�}||jk\rM|jjt
dt|j��d���|j|_	yy)NzLSize of archive is bigger than Red Hat Customer Portal limit for uploads of z  via sos http upload. 
)
rWrX�getsize�_max_size_requestr$�warningr&rr(r))rrL�sizes   r�check_file_too_bigz#RHELUploadTarget.check_file_too_big�sr���w�w���w�'��
�4�)�)�)��K�K����*�"�4�#9�#9�:�;�<-�-�.�
�#�/�/�D�O�*rc	����	|j�j|j�r|j|�t�|�|�}|S#t$r�}d}|jj|j�s�|jjtd|�d|j����|j|_t�|�|�}Yd}~|Sd}~wwxYw)zOverride the base upload_archive to provide for automatic failover
        from RHCP failures to the public RH dropbox
        Fz0Upload to Red Hat Customer Portal failed due to z	. Trying N)r5rRr2r}r�upload_archiver1r)r$ror&r()rrL�uploadedr4rs    �rrzRHELUploadTarget.upload_archive�s����
	7��"�"�$�/�/��0@�0@�A��'�'��0��w�-�g�6�H�����		7��H��?�?�-�-�d�.>�.>�?���K�K����D��C�y��!2�!2� 3�5�6�
�#�/�/�D�O��w�-�g�6�H����		7�s�A	A�	C�A<C�C)NNN)T)�__name__�
__module__�__qualname__rGrH�upload_target_name�upload_target_idrr2r(�_upload_url�_upload_methodr8rzrrr*r-r5r:rNrFrJr[rgr}r�
__classcell__)rs@rr
r
s����E��8�N�0����D�2�K�2�L��K��N��M�"��>�M�	G��2�(+�E�2�
@�
�JM�X
0��rr
)rWrk�sos.upload.targetsr�
sos.utilitiesrr�sos.policies.authr�sos.policies.distros.redhatr�sosrr&rKrh�ImportErrorr
�rr�<module>r�sM��
��+�8�6�2�����O�
i�|�i��	���O��s�<�A�A

Youez - 2016 - github.com/yon3zu
LinuXploit