CasperSecurity

Current Path : /lib/python3.10/distutils/command/__pycache__/
Upload File :
Current File : //lib/python3.10/distutils/command/__pycache__/register.cpython-310.pyc

o

��bc�-�@sddZddlZddlZddlZddlZddlmZddlm	Z	ddl
TddlmZGdd�de	�Z
dS)	zhdistutils.command.register

Implements the Distutils 'register' command (register with the repository).
�N)�warn)�
PyPIRCCommand)�*)�logc@s�eZdZdZejddgZejgd�Zddd�fgZdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zddd�ZdS)�registerz7register the distribution with the Python package index)�list-classifiersNz list the valid Trove classifiers)�strictNzBWill stop the registering if the meta-data are not fully compliant)�verifyrr�checkcCsdS)NT���selfrr�1/usr/lib/python3.10/distutils/command/register.py�<lambda>szregister.<lambda>cCst�|�d|_d|_dS)Nr)r�initialize_options�list_classifiersrrrrrrs

zregister.initialize_optionscCs*t�|�d|jfdd�}||jjd<dS)Nr)r�)r�restructuredtextr
)r�finalize_optionsr�distribution�command_options)r
�
check_optionsrrrr$s

�zregister.finalize_optionscCsX|��|��|��D]}|�|�q|jr|��dS|jr&|��dS|��dS�N)	r�_set_config�get_sub_commands�run_command�dry_run�verify_metadatar�classifiers�
send_metadata)r
�cmd_namerrr�run+szregister.runcCs8tdt�|j�d�}|��|j|_d|_|��dS)zDeprecated API.zddistutils.command.register.check_metadata is deprecated,               use the check command insteadr
rN)r�PendingDeprecationWarningr�get_command_obj�ensure_finalizedrrr!)r
r
rrr�check_metadata:s�zregister.check_metadatacCs||��}|ikr!|d|_|d|_|d|_|d|_d|_d	S|jd|jfvr0td|j��|jdkr9|j|_d|_d	S)
z: Reads the configuration file and set attributes.
        �username�password�
repository�realmT�pypiz%s not found in .pypircFN)�_read_pypircr&r'r(r)�
has_config�DEFAULT_REPOSITORY�
ValueError)r
�configrrrrDs






zregister._set_configcCs*|jd}tj�|�}t�|�|��dS)z8 Fetch the list of classifiers from the server.
        z?:action=list_classifiersN)r(�urllib�request�urlopenr�info�_read_pypi_response)r
�url�responserrrrUs
zregister.classifierscCs&|�|�d��\}}t�d||�dS)zF Send the metadata to the package index server to be checked.
        r	�Server response (%s): %sN)�post_to_server�build_post_datarr3)r
�code�resultrrrr\szregister.verify_metadatac
Cs|jrd}|j}|j}nd}d}}d��}||vr5|�dtj�t�}|s)d}n||vr1td�||vs|dkr�|sAtd�}|r;|sJt	�	d�}|rCt
j��}t
j
�|j�d	}|�|j|||�|�|�d
�|�\}}|�d||ftj�|dkr�|jr�||j_dS|�d
tj�|�d|��tj�d}|��dvr�td�}|s�d}|��dvs�|��dkr�|�||�dSdSdS|dk�r\ddi}	d|	d<|	d<|	d<d|	d<|	ds�td�|	d<|	dr�|	d|	dk�r+|	ds�t	�	d�|	d<|	dr�|	d�st	�	d�|	d<|	d�r|	d|	dk�r#d|	d<d|	d<td�|	d|	dks�|	d�s;td�|	d<|	d�r0|�|	�\}}|dk�rPt�d||�dSt�d�t�d �dS|d!k�r�dd"i}	d|	d<|	d�sytd#�|	d<|	d�rn|�|	�\}}t�d||�dSdS)$a_ Send the metadata to the package index server.

            Well, do the following:
            1. figure who the user is, and then
            2. send the data as a Basic auth'ed POST.

            First we try to read the username/password from $HOME/.pypirc,
            which is a ConfigParser-formatted file with a section
            [distutils] containing username and password entries (both
            in clear text). Eg:

                [distutils]
                index-servers =
                    pypi

                [pypi]
                username: fred
                password: sekrit

            Otherwise, to figure who the user is, we offer the user three
            choices:

             1. use existing login,
             2. register as a new user, or
             3. set the password to a random string and email the user.

        �1�x�z1 2 3 4z�We need to know who you are, so please choose either:
 1. use your existing login,
 2. register as a new user,
 3. have the server generate a new password for you (and email it to you), or
 4. quit
Your selection [default 1]: z&Please choose one of the four options!z
Username: z
Password: r�submitr7��zAI can store your PyPI login so future submissions will be faster.z (the login will be stored in %s)�X�ynzSave your login (y/N)?�n�y�2�:action�user�namer'�emailN�confirmz
 Confirm: z!Password and confirm don't match!z
   EMail: z"You will receive an email shortly.z7Follow the instructions in it to complete registration.�3�password_resetzYour email address: )r,r&r'�split�announcer�INFO�input�print�getpassr0r1�HTTPPasswordMgr�parse�urlparser(�add_passwordr)r8r9r�_get_rc_file�lower�
_store_pypircr3)
r
�choicer&r'�choices�auth�hostr:r;�datarrrrcs����
�
�������
��

��
	
�




��zregister.send_metadatacCs�|jj}id|�dd�d|���d|���d|���d|���d|���d	|���d
|���d|�	��d|�
��d
|���d|���d|�
��d|���d|���d|���}|dsc|dsc|drgd|d<|S)NrF�metadata_versionz1.0rH�version�summary�	home_page�author�author_email�license�description�keywords�platformr�download_url�provides�requires�	obsoletesz1.1)r�metadata�get_name�get_version�get_description�get_url�get_contact�get_contact_email�get_licence�get_long_description�get_keywords�
get_platforms�get_classifiers�get_download_url�get_provides�get_requires�
get_obsoletes)r
�action�metar^rrrr9�sN��������	�
���
�����zregister.build_post_dataNc
Cs�d|vr|�d|d|jftj�d}d|}|d}t��}|��D]?\}}t|�tg�td�fvr7|g}|D])}t|�}|�	|�|�	d|�|�	d�|�	|�|rb|d	d
krb|�	d�q9q$|�	|�|�	d�|�
��d�}d
|tt|��d�}	t
j�|j||	�}
t
j�t
jj|d��}d}z|�|
�}Wn;t
jjy�}
z|jr�|
j��}|
j|
jf}WYd}
~
n(d}
~
wt
jjy�}
zdt|
�f}WYd}
~
nd}
~
ww|jr�|�|�}d}|jr�d�d|df�}|�|tj�|S)zC Post a query to the server, and return a string response.
        rHzRegistering %s to %sz3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254z
--z--rz*
Content-Disposition: form-data; name="%s"z

����
�
zutf-8z/multipart/form-data; boundary=%s; charset=utf-8)zContent-typezContent-length)�password_mgrr>Ni�)r@�OKzK---------------------------------------------------------------------------)rNr(rrO�io�StringIO�items�type�str�write�getvalue�encode�lenr0r1�Request�build_opener�HTTPBasicAuthHandler�open�error�	HTTPError�
show_response�fp�readr:�msg�URLErrorr4�join)r
r^r\�boundary�sep_boundary�end_boundary�body�key�value�headers�req�openerr;�er�rrrr8�sh��



��


��
���
zregister.post_to_serverr)�__name__�
__module__�__qualname__rfr�user_options�boolean_options�sub_commandsrrr!r%rrrrr9r8rrrrrs$�
zr)�__doc__rRr��urllib.parser0�urllib.request�warningsr�distutils.corer�distutils.errors�	distutilsrrrrrr�<module>s
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY