403Webshell
Server IP : 167.99.254.82  /  Your IP : 216.73.216.68
Web Server : Apache
System : Linux host.techisquad.com 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64
User : pawluxera ( 1011)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/awscli/customizations/codeartifact/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/awscli/customizations/codeartifact/__pycache__/login.cpython-310.pyc
o

.&�a.V�@s(ddlZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZmZddlmZddlmZdd	lmZd
d�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"dS)�N)�datetime)�tzutc)�
relativedelta)�parse_timestamp)�
is_windows�urlparse�RawConfigParser�StringIO)�utils)�BasicCommand)�	uni_printcCs|g}d}dD]0}t||�}|dkr.|r|�d�|�t|��|�|dkr+|dd�n|�|r2n|dk}qd�|�}|S)NF)�years�months�days�hours�minutesr�and����� )�getattr�append�str�join)�	remaining�values�prev_non_zero_attr�attr�value�message�r �J/usr/lib/python3/dist-packages/awscli/customizations/codeartifact/login.py�get_relative_expiration_times



r"c@sLeZdZdZ	ddd�Zddd�Zdd	�Zd
d�Zddd
�Ze	dd��Z
dS)�	BaseLoginz-%s was not found. Please verify installation.NcCs.||_||_||_||_||_||_||_dS�N)�
auth_token�
expiration�repository_endpoint�domain�
repository�subprocess_utils�	namespace)�selfr%r&r'r(r)r*r+r r r!�__init__(s
zBaseLogin.__init__FcC�td��)Nzlogin()��NotImplementedError)r,�dry_runr r r!�login2�zBaseLogin.logincCs<|D]}tj�d�|��tj�tj�tj�tj�qdS)Nr)�sys�stdout�writer�os�linesep)r,�tool�commands�commandr r r!�_dry_run_commands5s
�zBaseLogin._dry_run_commandscCsrt|jt�t���tdd�}t|�}tj�d�	||j
��tj�tj�tj�d�	||j��tj�tj�dS)N�)�secondszASuccessfully configured {} to use AWS CodeArtifact repository {} zLogin expires in {} at {})
rr&r�nowrr"r4r5r6�formatr'r7r8)r,r9r�expiration_messager r r!�_write_success_message;s��
�
�z BaseLogin._write_success_messagecCs�|r
|�||�dS|D],}z|jj||jj|jjd�Wqty8}z|jtjkr2t|j|��|�d}~ww|�	|�dS)N)r5�stderr)
r<r*�
check_call�PIPE�OSError�errno�ENOENT�
ValueError�_TOOL_NOT_FOUND_MESSAGErB)r,r9r:r1r;�exr r r!�
_run_commandsKs&
����zBaseLogin._run_commandscKr.)Nzget_commands()r/)�cls�endpointr%�kwargsr r r!�get_commands`szBaseLogin.get_commandsr$�F)�__name__�
__module__�__qualname__rJr-r2r<rBrL�classmethodrPr r r r!r#%s
�


r#c@sZeZdZdZdZdZddd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dS)�NuGetBaseLoginz{endpoint}v3/index.jsonz/Added source %s to the user level NuGet.Config
z&Updated source %s in the NuGet.Config
Fc
Csz|��}Wnty#}z|jtjkrt|j|����|�d}~ww|jj|j	d�}|�
||�\}}|rA|�d||�}|j}n
|�d||�}|j
}|rad�dd�|D��}	t|	�td�dSz|jj||jjd�Wntjy�}
ztd	�|
�d}
~
wwt||�|�d
�dS)N)rN�update�addrcSsg|]}t|��qSr )r)�.0�cdr r r!�
<listcomp>�sz(NuGetBaseLogin.login.<locals>.<listcomp>�
�rCz"Failed to update the NuGet.Config
�nuget)�_get_source_to_url_dictrFrGrHrIrJ�_get_tool_name�_NUGET_INDEX_URL_FMTr@r'�_get_source_name�_get_configure_command�_SOURCE_UPDATED_MESSAGE�_SOURCE_ADDED_MESSAGErrr*�check_outputrE�
subprocess�CalledProcessErrorrB)r,r1�source_to_url_dictrK�nuget_index_url�source_name�already_existsr;�source_configured_message�dry_run_command�er r r!r2rsP������
���zNuGetBaseLogin.logincCsr|jj|��|jjd�}|�d���}dd�|D�}i}tdt|�d�D]}|�||d�||�	||�<q$|S)Nr]zutf-8cSsg|]
}|��dkr|�qS����strip)rY�liner r r!r[�sz:NuGetBaseLogin._get_source_to_url_dict.<locals>.<listcomp>r�)
r*rf�_get_list_commandrE�decode�
splitlines�range�len�_parse_source_url�_parse_source_name)r,�response�linesri�ir r r!r_�s��z&NuGetBaseLogin._get_source_to_url_dictcCs$|���dd�d}|�dd�dS)Nz [rr)rs�rsplit�split)r,rt�line_without_tagr r r!r|�sz!NuGetBaseLogin._parse_source_namecCs|��Sr$rr)r,rtr r r!r{�sz NuGetBaseLogin._parse_source_urlcCs`d�|j|j�}|��D]\}}||kr|dfSq|��D]}||kr+|dfSq|dfS)Nz{}/{}TF)r@r(r)�items�keys)r,�codeartifact_url�source_dict�default_namerk�
source_urlr r r!rb�s��zNuGetBaseLogin._get_source_namecCr.)Nz_get_tool_name()r/�r,r r r!r`�r3zNuGetBaseLogin._get_tool_namecCr.)Nz_get_list_command()r/r�r r r!rv�r3z NuGetBaseLogin._get_list_commandcCr.)Nz_get_configure_command()r/�r,�	operationrjrkr r r!rc�r3z%NuGetBaseLogin._get_configure_commandNrQ)rRrSrTrarerdr2r_r|r{rbr`rvrcr r r r!rVes	
,'
rVc@�$eZdZdd�Zdd�Zdd�ZdS)�
NuGetLogincC�dS)Nr^r r�r r r!r`��zNuGetLogin._get_tool_namecC�gd�S)N)r^�sources�listz-format�detailedr r�r r r!rv�r3zNuGetLogin._get_list_commandcCsdd|d|d|ddd|jgS)Nr^r�z-namez-sourcez	-username�awsz	-password)r%r�r r r!rc�s�z!NuGetLogin._get_configure_commandN�rRrSrTr`rvrcr r r r!r���r�c@r�)�DotNetLogincCr�)N�dotnetr r�r r r!r`r�zDotNetLogin._get_tool_namecCr�)N)r�r^r��sourcez--formatr�r r�r r r!rv
r3zDotNetLogin._get_list_commandcCsfdd|dg}|dkr|�|�|d|g7}n|�|�|d|g7}|ddd	|jg7}ts1|�d
�|S)Nr�r^r�rXz--namez--sourcez
--usernamer�z
--passwordz--store-password-in-clear-text)rr%r)r,r�rjrkr;r r r!rc
s

�
z"DotNetLogin._get_configure_commandNr�r r r r!r�r�r�c@sFeZdZe����dkrdndZddd�Zedd��Z	ed	d
��Z
dS)
�NpmLogin�windowsznpm.cmd�npmFcCs2|�|j�}|j|j|j|d�}|�d||�dS)N)�scoper�)�	get_scoper+rPr'r%rL)r,r1r�r:r r r!r2)s�
�zNpmLogin.logincCsFt�d�}|dur|S|�d�r|}nd�|�}|�|�s!td��|S)Nz^(@[a-z0-9-~][a-z0-9-._~]*)�@z@{}zZInvalid scope name, scope must contain URL-safe characters, no leading dots or underscores)�re�compile�
startswithr@�matchrI)rMr+�valid_scope_namer�r r r!r�2s



�zNpmLogin.get_scopec
Ks�g}|�d�}|rd�|�nd}|�|jdd||g�t�|�}d�|j|j�}|�|jdd|dg�d�|j|j�}	|�|jdd|	|g�|S)	Nr�z{}:registry�registry�config�setz//{}{}:always-auth�truez//{}{}:_authToken)�getr@r�NPM_CMDr�urlsplit�netloc�path)
rMrNr%rOr:r�r��repo_uri�always_auth_config�auth_token_configr r r!rPHs(
�
����zNpmLogin.get_commandsNrQ)rRrSrT�platform�system�lowerr�r2rUr�rPr r r r!r�#s
	
r�c@s&eZdZdZddd�Zedd��ZdS)	�PipLoginz1{scheme}://aws:{auth_token}@{netloc}{path}simple/FcCs"|�|j|j�}|�d||�dS)N�pip)rPr'r%rL)r,r1r:r r r!r2ns�zPipLogin.logincKs4t�|�}|jj|j||j|jd�}dddd|ggS)N)�schemer%r�r�r�r�r�zglobal.index-url)rr��PIP_INDEX_URL_FMTr@r�r�r�)rMrNr%rOr��
pip_index_urlr r r!rPts
�zPipLogin.get_commandsNrQ)rRrSrTr�r2rUrPr r r r!r�js

r�csFeZdZdZ	d�fdd�	Zedd��Zd
dd	�Zed
d��Z�Z	S)�
TwineLoginz�[distutils]
index-servers=
    pypi
    codeartifact

[codeartifact]
repository: {repository_endpoint}
username: aws
password: {auth_token}Ncs4|dur|��}||_tt|��||||||�dSr$)�get_pypi_rc_path�pypi_rc_path�superr�r-)r,r%r&r'r(r)r*r���	__class__r r!r-�s

�zTwineLogin.__init__c
Ks@d|vsJd��|d}|jj||d�}t�}tj�|�r�zL|�|�|�dd�}dd�|�d�D�}d	|vrH|�	d	�|�
dddd�|��d	|��vrS|�
d	�|�
d	d
|�|�
d	dd�|�
d	d
|�Wn$ty�}	ztj�d|�tj�tj�|	�d}	~	ww|�t|��t�}
|�|
�|
��}|
��|S)Nr�zpypi_rc_path must be provided.)r'r%�	distutilsz
index-serverscSs g|]}|��dkr|���qSrprr)rY�serverr r r!r[�s
�z+TwineLogin.get_commands.<locals>.<listcomp>r\�codeartifactr)�usernamer��passwordz%s is in an invalid state.)�DEFAULT_PYPI_RC_FMTr@rr7r��exists�readr�r�rr�r�sections�add_section�	Exceptionr4r5r6r8�readfpr	�getvalue�close)rMrNr%rOr��default_pypi_rc�pypi_rc�
index_servers�serversro�pypi_rc_stream�pypi_rc_strr r r!rP�sH�
�
�
��
zTwineLogin.get_commandsFcCs�|j|j|j|jd�}|r@tj�d�tj�tj�tj�d|j�tj�tj�tj�tj�tj�|�tj�tj�dSt	|jd��
}|�|�Wd�n1sVwY|�
d�dS)N)r�z.Dryrun mode is enabled, not writing to pypirc.z(%s would have been set to the following:zw+�twine)rPr'r%r�r4r5r6r7r8�openrB)r,r1r��fpr r r!r2�s&���zTwineLogin.logincCstj�tj�d�d�S)N�~z.pypirc)r7r�r�
expanduser)rMr r r!r��szTwineLogin.get_pypi_rc_pathr$rQ)
rRrSrTr�r-rUrPr2r��
__classcell__r r r�r!r��s�

7r�c@s�eZdZdZdedd�dedd�dedd�dedd�dedd�d�Z	d	Z
d
Zddee	�
��dd
�dddd�dddd�dddd�ddddd�dddd�dddddd�gZdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�CodeArtifactLoginz>Log in to the idiomatic tool for the requested package format.r^F)�package_format�	login_cls�namespace_supportr�T�pypi)r^r�r�r�r�r2z�Sets up the idiomatic tool for your package format to use your CodeArtifact repository. Your login information is valid for up to 12 hours after which you must login again.r9z1The tool you want to connect with your repository)�name�	help_text�choices�requiredr(zYour CodeArtifact domain name)r�r�r�zdomain-ownerz5The AWS account ID that owns your CodeArtifact domainr+z0Associates a namespace with your repository toolzduration-seconds�integerz9The time, in seconds, that the login information is valid)r��
cli_type_namer�r�r)z!Your CodeArtifact repository namezdry-run�
store_truez�Only print the commands that would be executed to connect your tool with your repository without making any changes to your configuration)r��actionr�r��defaultcCs,|j|d}|s|jrtd�|���|jS)Nr�z,Argument --namespace is not supported for {})�TOOL_MAPr+rIr@)r,r9�parsed_args�namespace_compatibler r r!�_get_namespaceJs
�z CodeArtifactLogin._get_namespacecCs8|j|j|d�}|jr|j|d<|jdi|��}|dS)N)r(r)r@�domainOwner�repositoryEndpointr )r(r)�domain_owner�get_repository_endpoint)r,�codeartifact_clientr�r�rO� get_repository_endpoint_responser r r!�_get_repository_endpointTs�
�z*CodeArtifactLogin._get_repository_endpointcCs>d|ji}|jr
|j|d<|jr|j|d<|jdi|��}|S)Nr(r��durationSecondsr )r(r��duration_seconds�get_authorization_token)r,r�r�rO� get_authorization_token_responser r r!�_get_authorization_tokends�

�z*CodeArtifactLogin._get_authorization_tokencCs�|j��}|j|d}t�|jd|�}|�||�}|�|||�}|j}|j	}	|�
||�}
|d}t|d�}|j|d|||||	t|
�}
|
�
|j�dS)Nr�r��authorizationTokenr&r�r)r9r�r��	cli_utils�!create_client_from_parsed_globals�_sessionr�r�r(r)r�rrgr2r1)r,r��parsed_globalsr9r�r��auth_token_resr'r(r)r+r%r&r2r r r!�	_run_mainss,
����zCodeArtifactLogin._run_mainN)rRrSrT�__doc__r�r�r�r�r�r��NAME�DESCRIPTIONr�r��	ARG_TABLEr�r�r�r�r r r r!r��s~�������
��������.
r�)#rGr7r�r4rgr�r�dateutil.tzr�dateutil.relativedeltar�botocore.utilsr�
awscli.compatrrrr	�awscli.customizationsr
r��awscli.customizations.commandsr�awscli.customizations.utilsrr"�objectr#rVr�r�r�r�r�r�r r r r!�<module>s0@Gt

Youez - 2016 - github.com/yon3zu
LinuXploit