CasperSecurity

Current Path : /lib/python3/dist-packages/aptsources/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/aptsources/__pycache__/distinfo.cpython-310.pyc

o

4��f/8�@s�ddlmZddlZddlZddlZddlZddlmZmZddl	Z	ddl
Z
ddl
mZdd�Z
Gdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zdd�ZGdd�de�Zedkr�edd�Ze�ej�ejD]VZe�dej�e�dej�e�dej�e�dej�ejikr�e�de ej�!���ej"D]Z#e�de#je#je#j$f�q�ej%D]
Z&e�de&j�q�qndSdS)�)�print_functionN)�Popen�PIPE)�gettextc		#sl�t�}t�|��P}|D],}d|vr|�|d�d��d|vr/d|dvr(n|�|d�t|���EdHq	Wd�dS|D]
}d|vrQ|�|d�qDWd�n1s\wYt|��}t	t
t�|���}Wd�n1sywY|D]l}|d|vr�q�dV|d�
d	d�|d<t�|��I}|D]>}d|vs�d|dvr�q�d
|vr�|d�t�fdd�|d
�d�D��r�q�t|�jd
i|����D]}|�d
�r�q�|Vq�q�Wd�n1s�wYq�t�|��9}|D]}d|v�rd|dv�rnq�|D]}d|v�rd|dv�r�qt|���EdH�qWd�dS1�s/wYdS)a~Expand the given template.

    A template file consists of a header, followed by paragraphs
    of templated suites, followed by a footer. A templated suite
    is any paragraph where the Suite field contains {.

    This function expands all templated suites using the information
    found in the CSV file supplied by distro-info-data.

    It yields lines of template info.
    zX-Exclude-Suitesz, �Suite�{N�series��versionz LTSz	X-Versionc3sT�|]%}|�d�rt�|dd���dkp%|�d�o%t�|dd���dkVqdS)�le�Nr�ge)�
startswith�apt_pkg�version_compare)�.0�field��ver��5/usr/lib/python3/dist-packages/aptsources/distinfo.py�	<genexpr>Zs�
��

�z#_expand_template.<locals>.<genexpr>r)�setr�TagFile�update�split�add�str�
splitlines�open�reversed�list�csv�
DictReader�replace�any�formatr)	�template�csv_path�known_suites�tmpl�section�
csv_object�releases�rel�linerrr�_expand_template&sp�
����
��
������$�r0c@�$eZdZdd�Zdd�Zdd�ZdS)�TemplatecCsXd|_d|_g|_d|_d|_d|_d|_g|_g|_d|_	i|_
d|_d|_d|_
dS�NFT)�name�child�parents�
match_name�description�base_uri�type�
components�children�	match_uri�
mirror_set�distribution�	available�official��selfrrr�__init__ys
zTemplate.__init__cCs|dd�|jD�vS)z8 Check if the distribution provides the given component css�|]}|jVqdS�N)r4)r�crrrr�s�z)Template.has_component.<locals>.<genexpr>)r;)rC�comprrr�
has_component�szTemplate.has_componentcCs.t|�\}}}||jvr|j|�||�SdS)z8 Check if a given url of a repository is a valid mirror F)�	split_urlr>�has_repository)rC�url�proto�hostname�dirrrr�	is_mirror�s
zTemplate.is_mirrorN)�__name__�
__module__�__qualname__rDrHrOrrrrr2wsr2c@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�	ComponentNcCs||_||_||_||_dSrE)r4r8�description_long�parent_component)rCr4�desc�	long_descrUrrrrD�s
zComponent.__init__cC�|jSrE�rUrBrrr�get_parent_component��zComponent.get_parent_componentcC�
||_dSrErY)rC�parentrrr�set_parent_component��
zComponent.set_parent_componentcCs$|jdur|jS|jdur|jSdSrE)rTr8rBrrr�get_description�s


zComponent.get_descriptioncCr\rE)r8�rCrVrrr�set_description�r_zComponent.set_descriptioncCr\rE�rTrarrr�set_description_long�r_zComponent.set_description_longcCrXrErcrBrrr�get_description_long�r[zComponent.get_description_long)NNN)
rPrQrRrDrZr^r`rbrdrerrrrrS�s
rSc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�Mirrorz( Storage for mirror related information NcCs"||_g|_|�||�||_dSrE)rM�repositories�add_repository�location)rCrLrMrNrirrrrD�s
zMirror.__init__cCs|j�t||��dSrE)rg�append�
Repository�rCrLrNrrrrh�szMirror.add_repositorycs�fdd�|jD�S)Ncsg|]	}|j�kr|�qSr�rL�r�rrmrr�
<listcomp>�sz5Mirror.get_repositories_for_proto.<locals>.<listcomp>�rg)rCrLrrmr�get_repositories_for_proto��z!Mirror.get_repositories_for_protocCs6|durdS|jD]}|j|kr||jvrdSq	dSr3)rgrLrN)rCrLrNrorrrrJ�s
�zMirror.has_repositorycs�fdd��jD�S)Ncsg|]}|��j��qSr)�get_urlrMrnrBrrrp�sz(Mirror.get_repo_urls.<locals>.<listcomp>rqrBrrBr�
get_repo_urls�rszMirror.get_repo_urlscCrXrE�rirBrrr�get_location�r[zMirror.get_locationcCr\rErv)rCrirrr�set_location�r_zMirror.set_locationrE)rPrQrR�__doc__rDrhrrrJrurwrxrrrrrf�s
rfc@r1)rkcCs||_||_dSrE�rLrNrlrrrrD�s
zRepository.__init__cCs|j|jfSrErzrBrrr�get_info�szRepository.get_infocCsd|j||jfS)Nz
%s://%s/%srz)rCrMrrrrt�szRepository.get_urlN)rPrQrRrDr{rtrrrrrk�srkcCs6tjd|dd�}t|�dkr|�d�t|�dks|S)zE split a given URL into the protocoll, the hostname and the dir part z:*\/+�)�maxsplitrN)�rer�lenrj)rKrrrrrI�s

�rIc@seZdZddd�Zdd�ZdS)�DistInfoN�/usr/share/python-apt/templatesc
Cs8d|_g|_tj�d�|_d}t�d�}t�d�}|sPztgd�dt	d��
�d��}Wn#tt
fyO}z|jtjkrCt�d	|�d
}WYd}~nd}~ww||_i}d||f}d�|���}	d}
d}t||	�D�]�}|�d
d�}
t|
�dkr{qk|
d��}|
d��}|dkr�t|�|_qk|dkr�||_qk|dkr�|�|
|�d}t�}
||
_||
_d||
_qk|dkr�||
_qk|dkr�d|
_|jD]}|j|kr�|
j �!|�|j"�!|
�q�qk|dkr�t�#|�|
_$qk|dkr�t�#|�|
_%qk|dkr�||
_&qk|dk�r|
j'�s||
_'qk|d|jk�r||
_'qk|dk�r|
j(�s||
_(qk|d|jk�r+||
_(qk|dk�s8|d|jk�r�t)j*�+|��rB|�pLt)j*�,t)j*�-||��}||v�r�i}z$t.|��}t/t0|j1dd �|D���}Wd�n	1�srwYWnt2�y�t3d!�g}Ynw|D]0}|�4d"��r�|�5d#|�}�q�t6|�\}}}||v�r�||�7||��q�t8||||�||<�q�|||<|||
_9qk|d$k�r�t|�|
_:qk|d%k�r�|�r�|
�;|j��s�|
j<�!|�t=|�}qk|d&k�r�|�>t|��qk|d'k�r|�?t|��qk|d(k�r|�@|�qk|�|
|�d}
d}dS))Nr	zAPT::Architecturez^#LOC:(.+)$zS^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(mirror)|(https))://[A-Za-z0-9/\.:\-_@]+)$)�lsb_releasez-iz-sT)�universal_newlines�stdoutrz#lsb_release failed, using defaults:�Debianz
%s/%s.infoz/usr/share/distro-info/{}.csv�:�r|�ChangelogURI�MetaReleaseURIrz^%s$�	MatchName�ParentSuite�	Available�Official�RepositoryType�BaseURIz
BaseURI-%s�MatchURIzMatchURI-%s�MirrorsFilezMirrorsFile-%scSsg|]}|���qSr)�strip)r�xrrrrpAsz%DistInfo.__init__.<locals>.<listcomp>z#WARNING: Failed to read mirror filez#LOC:z\1�DescriptionrS�CompDescription�CompDescriptionLong�ParentComponent)A�metarelease_uri�	templatesr�config�find�archr~�compilerr�communicater��OSError�IOError�errno�ENOENT�logging�warning�distr&�lowerr0rr�_�changelogs_uri�finish_templater2r4r?r7r5r6rjr<�string_to_boolr@rAr:r9r=�os�path�isabs�abspath�joinrr!�filter�match�	Exception�printr�subrIrhrfr>r8rHr;rSrbrdr^)rCr��base_dirri�	match_loc�match_mirror_line�exc�map_mirror_sets�
dist_fname�	csv_fnamer'�	componentr/�tokensr�value�nannyr>�value_f�mirror_datarLrMrNrrrrD�s�
�������

��
�

����
�


�




�zDistInfo.__init__cCs�|sdS|jdur|jr|jD]}|jr|j|_nq|jikr2|jr2|jD]}|jr1|j|_nq&|rB|�|j�sB|j�|�d}|jD]}|j|_qE|j	�|�dS)z finish the current tempalte N)
r=r5r6r>rHr4r;rjrAr�)rCr'r��trrrr�bs(
�
�

zDistInfo.finish_template)Nr�)rPrQrRrDr�rrrrr��s
tr��__main__�Ubuntur�z

Suite: %szDesc: %szBaseURI: %szMatchURI: %szMirrors: %sz %s -%s -%sz  %s)'�
__future__rr"r�r�r��
subprocessrrr~rrr�r0�objectr2rSrfrkrIr�rP�d�infor�r�r'r4r8r9r=r>r!�keysr;rGrTr<r5rrrr�<module>sJQ !






�
��
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