ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib64/python3.6/__pycache__/mailcap.cpython-36.pyc
3

ik#@sdZddlZddlZddlZddgZddZejdjZGdd	d	e	Z
d
dZddZd
dZ
ddZddZddZddgfddZd#ddZgfddZddZddZd d!Zed"kredS)$z%Mailcap file handling.  See RFC 1524.Ngetcaps	findmatchcCsd|krd|dfSdSdS)Nlinenor)rr)entryrr/usr/lib64/python3.6/mailcap.pylineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)__name__
__module____qualname____doc__rrrrr
sr
cCsi}d}xtD]}yt|d}Wntk
r8wYnX|t||\}}WdQRXx6|jD]*\}}||kr||||<qb|||||<qbWqW|S)aReturn 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".

    rrN)listmailcapfilesopenOSError_readmailcapfileitems)capsrZmailcapfpZmorecapskeyvaluerrrrs

cCsPdtjkr"tjd}|jtj}n*dtjkr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPSHOME.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)osenvironsplitpathsep)ZpathstrZmailcapshomerrrr3s


rcCs tjdtdt|d\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps insteadN)warningswarnDeprecationWarningr)rr_rrrreadmailcapfileEsr%c	Csi}x|j}|sP|ddks|jdkr.q|}x4|dddkrf|j}|sTd}|dd|}q4Wt|\}}|oz|s~q|dk	r||d<|d	7}|jd
}x$tt|D]}||j||<qWd
j|j}||kr||j|q|g||<qW||fS)
aRead 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#r Nz\

rr/r*)	readlinestrip	parselinerrangelenjoinlowerappend)	rrrlineZnextlinerfieldstypesjrrrrMs6	
rc
Csg}dt|}}x.||kr@t|||\}}|j||d}qWt|dkrRdS|d|d|dd}}}d|i}x^|D]V}|jd}|dkr|}d}	n$|d|j}||ddj}	||krq|	||<qW||fS)	zParse 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.
    rrr Nview=r')NN)r/
parsefieldr2findr,)
r3r4infieldrr7restZfkeyZfvaluerrrr-vs*

 

r-cCsT|}x:||kr>||}|dkr"Pq|dkr4|d}q|d}qW|||j|fS)z/Separate one key-value pair in a mailcap entry.;\r r)r,)r3r;r<startcrrrr9s

r9r7z	/dev/nullc
Cst|r"d|f}tj|tdSt|||}xd|D]\}d|krnt|d||}|dkrZq4|rntj|dkrnq4t|||||}	|	dk	r4|	|fSq4WdS)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.

    zHRefusing to use mailcap with filename %r. Use a safe temporary filename.Ntestr)NN)NN)_find_unsafer!r"r
lookupsubstrsystem)
rMIMEtyperfilenameplistmsgentrieserCcommandrrrrs 	

cslg}||kr|||}|jd}|dd}||krB|||}dk	r\fdd|D}t|td}|S)Nr)rz/*csg|]}|kr|qSrr).0rM)rrr
<listcomp>szlookup.<locals>.<listcomp>)r)rsortedr	)rrHrrLZ	MIMEtypesr)rrrEs
rEcCs\d}dt|}}xB||krV||}|d}|dkrb|dkrX|||d}|d}||}q||}|d}|dkr||}q|dkr||}q|dkrt|rd|f}tj|tdS||}q|d	krH|}	x ||kr||d
kr|d}qW||	|}
|d}t|
|}t|r>d||
f}tj|tdS||}q|d|}qW|S)Nr'rr%r@stz9Refusing to substitute MIME type %r into a shell command.{}z=Refusing to substitute parameter %r (%s) into a shell command)r/rDr!r"r
	findparam)r=rHrIrJresr;r<rBrKrAnameZparamrrrrFsH








rFcCsF|jd}t|}x,|D]$}|d|j|kr||dSqWdS)Nr8r')r1r/)rYrJr<prrrrWs
rWc	Csddl}t}|jdds(t|dSxtdt|jdD]}|j||d}t|dkrjtddS|d}|d}t||d|\}}|stdtq<td|t	j
|}|r<td|q<WdS)	Nrrr z"usage: mailcap [MIMEtype file] ...r7zNo viewer found forz
Executing:zExit status:)sysrargvshowr.r/printrtyperrG)	r[rr;argsrHfilerNrMstsrrrrCs&

rCcCstdxtD]}td|qWt|s4t}tdtt|}xX|D]P}t|||}x:|D]2}t|}x|D]}td|||q|WtqjWqPWdS)NzMailcap files:	zMailcap entries:z  %-15s)r^rrrQ)rfnZckeysr_rLrMkeyskrrrr]s"


r]__main__)N)rrr!re__all__r	compilesearchrDWarningr
rrr%rr-r9rrErFrWrCr]rrrrr<module>s*)

)