ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/mimify.pyc

�
^
bc@s�dZdZdZdZddlZddlZejded�dd	d
dgZej	dej
�Zej	d
ej
�Zej	dej
ej
B�Zej	dej
ej
B�Zej	d�Zej	dej
�Zej	dej
�Zej	dej
�Zdd0d��YZdd1d��YZd�Zd�Zdd�Zdd�Zej	d�Zej	d�Zd�Zej	d �Zd!�Zej	d"ej
�Zej	d#ej
�Z ej	d$�Z!d%�Z"d&�Z#ddl$Z$e%d'kse&e$j'�dkr�e$j'ddkr�ddl(Z(d(Z)dZ*e(j(e$j'd)d*�\Z+Z,e&e,�d2kr}e)GHe$j-d)�nd3e+kd4e+kks�d5e+kr�d6e+kr�e)GHe$j-d)�nx�e+D]�\Z.Z/e.d+kr�e#Z0q�e.d-kr�eZ0q�e.d/krJye1e/�ZWq_e2e3fk
rFe)GHe$j-d)�q_Xq�e.d.kr�d)Z*q�q�We&e,�dkr�e$j4e$j5fZ6n<e&e,�d)kr�e,de$j5fZ6ne,de,d)fZ6e*r�e6e*fZ6ne0e6�ndS(7s�Mimification and unmimification of mail messages.

Decode quoted-printable parts of a mail message or encode using
quoted-printable.

Usage:
        mimify(input, output)
        unmimify(input, output, decode_base64 = 0)
to encode and decode respectively.  Input and output may be the name
of a file or an open file object.  Only a readline() method is used
on the input file, only a write() method is used on the output file.
When using file names, the input and output file names may be the
same.

Interactive usage:
        mimify.py -e [infile [outfile]]
        mimify.py -d [infile [outfile]]
to encode and decode respectively.  Infile defaults to standard
input and outfile to standard output.
i�s
ISO-8859-1s> i����Ns>the mimify module is deprecated; use the email package insteaditmimifytunmimifytmime_encode_headertmime_decode_headers.^content-transfer-encoding:\s*quoted-printables$^content-transfer-encoding:\s*base64s0^content-type:.*multipart/.*boundary="?([^;"
]*)s:^(content-type:.*charset=")(us-ascii|iso-8859-[0-9]+)(".*)s^-*
s=([0-9a-f][0-9a-f])s=\?iso-8859-1\?q\?([^? 	
]+)\?=s^subject:\s+re: tFilecBs eZdZd�Zd�ZRS(s{A simple fake file object that knows about limited read-ahead and
    boundaries.  The only supported method is readline().cCs||_||_d|_dS(N(tfiletboundarytNonetpeek(tselfRR((s+/opt/alt/python27/lib64/python2.7/mimify.pyt__init__3s		cCs||jdk	rdS|jj�}|s,|S|jrx||jdkrU||_dS||jdkrx||_dSn|S(Nts
s--
(RRRtreadlineR(R	tline((s+/opt/alt/python27/lib64/python2.7/mimify.pyR8s			(t__name__t
__module__t__doc__R
R(((s+/opt/alt/python27/lib64/python2.7/mimify.pyR/s	t
HeaderFilecBseZd�Zd�ZRS(cCs||_d|_dS(N(RRR(R	R((s+/opt/alt/python27/lib64/python2.7/mimify.pyR
Hs	cCs�|jdk	r$|j}d|_n|jj�}|s=|Stj|�rP|Sxk|jj�|_t|j�dks�|jddkr�|jddkr�|S||j}d|_qSWdS(Nit s	(RRRRthetmatchtlen(R	R
((s+/opt/alt/python27/lib64/python2.7/mimify.pyRLs	&
(RRR
R(((s+/opt/alt/python27/lib64/python2.7/mimify.pyRGs	cCs�d}d}xktj||�}|dkr1Pn||||jd�!tt|jd�d��}|jd�}qW|||S(s6Decode a single line of quoted-printable text to 8bit.RiiiN(t	mime_codetsearchRtstarttchrtinttgrouptend(R
tnewlinetpostres((s+/opt/alt/python27/lib64/python2.7/mimify.pytmime_decode^scCs�d}d}x�tj||�}|dkr1Pn|jd�}dj|jd��}||||jd�!t|�}|jd�}qW|||S(sDecode a header line to 8bit.RiiRt_N(	t	mime_headRRRtjointsplitRR R(R
RRRR((s+/opt/alt/python27/lib64/python2.7/mimify.pyRks$icCsGd}d}d}d}|jr=|jd tkr=t}nd}t|�}x|j�}	|	shdS|r�|	t|� |kr�|	t|�}	|}
nd}
t|	�}	tj|	�r�d}qRn|r�t	j|	�r�d}qRn|j
|
|	�|rtj|	�rd}ntj|	�}|rFd|j
d�}ntj|	�rRPqRqRW|rx|so|rxd}nx�|j�}	|	s�dStjtd|	�}	|r�|	t|� |kr�|	t|�}	|}
nd}
x�|rx|	|dkr|j
|
|	�d}d}	Pn|	|d	krt|j
|
|	�t||�}t|||�|j}	|	s�Pq�q�nPq�W|	r�|r�x]|	d
dkr�|	d
 }	|j�}
|
tt� tkr�|
tt�}
n|	|
}	q�Wt|	�}	n|	r%|r%|
r%ddl}|j|	�}	n|	r{|j
|
|	�q{q{WdS(
s?Convert a quoted-printable part of a MIME mail message to 8bit.iiRNis--s\1s--
s
i����s=
i����(RRtQUOTERRRRtqpRt	base64_retwritetrepltmpRRtretsubR"Rt
unmimify_partRR tbase64tdecodestring(tifiletofilet
decode_base64t	multiparttquoted_printablet	is_base64tis_repltprefixthfileR
tpreftmp_restnifileRR.((s+/opt/alt/python27/lib64/python2.7/mimify.pyR-zs�							
c	Cs�t|�td�kr�t|�}t|�td�kr�||kr�ddl}|jj|�\}}|j||jj|d|��q�n|}t|�td�kr�t|d�}n|}t|d�}t	|||�|j
�dS(s>Convert quoted-printable parts of a MIME mail message to 8bit.Ri����Nt,tw(ttypetopentostpathR$trenameR#RRR-tflush(	tinfiletoutfileR2R0R@tdtfR1R;((s+/opt/alt/python27/lib64/python2.7/mimify.pyR�s$)s[=-�]s[=?-�]cCsg|rt}nt}d}d}t|�dkrb|d dkrbdtd�j�}d}nxl|j||�}|dkr�Pn||||jd�!dt|jd��j�}|j	d�}qeW|||}d}xwt|�dkr^d	}x2||d
ks'||dd
kr4|d}qW|d}||| d}||}q�W||S(
sZCode a single line as quoted-printable.
    If header is set, quote some extra characters.RiisFrom s=%02xtFiiKiIt=s=
N(
tmime_header_chart	mime_charRtordtupperRRRRR(R
theadertregRRRti((s+/opt/alt/python27/lib64/python2.7/mimify.pytmime_encode�s2	"	 '
s<([ 	(]|^)([-a-zA-Z0-9_+]*[-�][-a-zA-Z0-9_+-�]*)(?=[ 	)]|
)cCs�d}d}xytj||�}|dkr1Pnd||||jd�!|jd�tt|jd�d�f}|jd�}qW|||S(s.Code a single header line as quoted-printable.Ris%s%s%s=?%s?Q?%s?=iiN(tmime_headerRRRRtCHARSETRQR(R
RRR((s+/opt/alt/python27/lib64/python2.7/mimify.pyRs"s^mime-version:s^content-transfer-encoding:s[-�]cCs3d}}}d}d}}}	g}
d}g}d}
t|�}x�|j�}|s_Pn|r~tj|�r~d}ntj|�r�d}ntj|�r�d}tj|�r�d}q�t	j|�r�d}q�nt
j|�}|r	d|jd�}ntj|�r"|}Pn|
j
|�qIWx;|j�}|sLPn|r�||dkrl|}
Pn||dkr�|}
Pq�n|r�|j
|�q6n|rx]|ddkr|d }|j�}|tt� tkr�|tt�}n||}q�Wt|�}n|j
|�|	sItj|�rId}	}qIn|s6t|�tkrmd}qmq6q6Wx�|
D]�}|r�t|�}ntj|�}|r
|	r�|jd	�j�d
kr
d|jd�t|jd�f}q
q
d
|jdd�}n|r[tj|�r[d}|r;|d}q[|rN|d}q[|d}n|j|�qxW|sx|r�|r�|jd�|jd�|	r�|jdt�q�|jd�n|r�|r�|jd�n|j|�x3|D]+}|rt|d�}n|j|�q�W|j|
�|
}x�|r.||dkr�xB|j�}|shdS|r�t|d�}n|j|�qRWn||dkr�t||�}t||d�|j}|s�Pn|j|�q9nx?|j�}|sdS|rt|d�}n|j|�q�Wq9WdS(s@Convert an 8bit part of a MIME mail message to quoted-printable.iRis--s--
s
i����s=
isus-asciis%s%s%sis%sus-ascii%ssContent-Transfer-Encoding: sbase64
squoted-printable
s7bit
sMime-Version: 1.0
sContent-Type: text/plain; s
charset="%s"
scharset="us-ascii"
s,Content-Transfer-Encoding: quoted-printable
N(RRRtiso_charRtmvRtcteR&R'R*RRtappendRR%R tMAXLENRtchrsettlowerRSR(RQRtmimify_partR(R0R1tis_mimethas_ctetis_qpR5R3tmust_quote_bodytmust_quote_headert
has_iso_charsRNt
header_endtmessagetmessage_endR8R
R:Rt
chrset_resR;((s+/opt/alt/python27/lib64/python2.7/mimify.pyR[s�			












		
cCs�t|�td�kr�t|�}t|�td�kr�||kr�ddl}|jj|�\}}|j||jj|d|��q�n|}t|�td�kr�t|d�}n|}t|d�}t	||d�|j
�dS(s>Convert 8bit parts of a MIME mail message to quoted-printable.Ri����NR<R=i(R>R?R@RAR$RBR#RRR[RC(RDRER0R@RFRGR1R;((s+/opt/alt/python27/lib64/python2.7/mimify.pyR�s$)t__main__s/Usage: mimify [-l len] -[ed] [infile [outfile]]isl:edbs-eRs-ds-bs-l(((iii(s-eR(s-dR(s-bR(s-dR(7RRXRSR%R+twarningstwarntDeprecationWarningt__all__tcompiletIR&R'tSR*RYRRR"R)RRR RR-RRKRJRQRRRRURVRTR[RtsysRRtargvtgetopttusageR2toptstargstexittotatencodeRt
ValueErrort
OverflowErrortstdintstdouttencode_args(((s+/opt/alt/python27/lib64/python2.7/mimify.pyt<module>s�	
	
	U	 		�	4		


Zerion Mini Shell 1.0