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/email/__pycache__/generator.cpython-36.pyc
3

iS@sdZdddgZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZdd	l
mZd
ZdZejdZejd
ejZejdZejdZGdddZGdddeZdZGdddeZeeejdZdeZej Z dS)z:Classes to generate plain text from a message object tree.	GeneratorDecodedGeneratorBytesGeneratorN)deepcopy)StringIOBytesIO)_has_surrogates)HeaderWriteError_
z
\r\n|\r|\nz^From z\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]s\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]c@seZdZdZd'ddddZddZd(d	d
ZddZd
dZddZ	ddZ
ddZddZddZ
ddZeZddZddZdd Zd!d"Zed)d#d$Zed%d&ZdS)*rzGenerates output from a Message object tree.

    This basic generator writes the message to the given file object as plain
    text.
    N)policycCs6|dkr|dkrdn|j}||_||_||_||_dS)aCreate the generator for message flattening.

        outfp is the output file-like object for writing the message to.  It
        must have a write() method.

        Optional mangle_from_ is a flag that, when True (the default if policy
        is not set), escapes From_ lines in the body of the message by putting
        a `>' in front of them.

        Optional maxheaderlen specifies the longest length for a non-continued
        header.  When a header line is longer (in characters, with tabs
        expanded to 8 spaces) than maxheaderlen, the header will split as
        defined in the Header class.  Set maxheaderlen to zero to disable
        header wrapping.  The default is 78, as recommended (but not required)
        by RFC 2822.

        The policy keyword specifies a policy object that controls a number of
        aspects of the generator's operation.  If no policy is specified,
        the policy associated with the Message object passed to the
        flatten method is used.

        NT)mangle_from__fp
_mangle_from_maxheaderlenr)selfoutfpr
rrr'/usr/lib64/python3.6/email/generator.py__init__'szGenerator.__init__cCs|jj|dS)N)rwrite)rsrrrrGszGenerator.writeFcCs|jdkr|jn|j}|dk	r*|j|d}|jdk	rB|j|jd}|j|_|j|j|_d|_|j|j|_|j}|j}zL||_||_|r|j	}|sdt
jt
j
}|j||j|j
|Wd||_||_XdS)aPrint the message object tree rooted at msg to the output file
        specified when the Generator instance was created.

        unixfrom is a flag that forces the printing of a Unix From_ delimiter
        before the first object in the message tree.  If the original message
        has no From_ delimiter, a `standard' one is crafted.  By default, this
        is False to inhibit the printing of any From_ delimiter.

        Note that for subobjects, no From_ line is printed.

        linesep specifies the characters used to indicate a new line in
        the output.  The default value is determined by the policy specified
        when the Generator instance was created or, if none was specified,
        from the policy associated with the msg.

        N)linesep)max_line_lengthzFrom nobody )rclonerr_NL_encode_encoded_NLZ_EMPTY_encoded_EMPTYZget_unixfromtimeZctimer_write)rmsgunixfromrrZold_gen_policyZold_msg_policyZufromrrrflattenKs,
zGenerator.flattencCs|j||jd|jdS)z1Clone this generator with the exact same options.N)r)	__class__rr)rfprrrr|szGenerator.clonecCstS)N)r)rrrr_new_bufferszGenerator._new_buffercCs|S)Nr)rrrrrrszGenerator._encodecCsX|sdStj|}x*|ddD]}|j||j|jq W|drT|j|ddS)Nr)r))NLCREsplitrr)rlineslinerrr_write_liness

zGenerator._write_linescCs|j}z"d|_|j|_}|j|Wd||_|j}|`X|rht|}|jd|d|jd|dt|dd}|dkr|j|n|||jj|j	dS)Nzcontent-transfer-encodingrzcontent-typer(_write_headers)
r
_munge_cter'	_dispatchrZreplace_headergetattrr/rgetvalue)rr"ZoldfpZsfpZ	munge_ctemethrrrr!s"zGenerator._writecCst|j}|j}tj||fjdd}t|d|d}|dkrh|jdd}t|d|d}|dkrh|j}||dS)N-r
Z_handle_)get_content_maintypeget_content_subtype
UNDERSCOREjoinreplacer2
_writeBody)rr"mainsubZspecificr4Zgenericrrrr1szGenerator._dispatchcCsx|jD]\}}|jj||}|jjr|jj}|j|jjsRtd|d||}|j|rr|dt|}tj	|rtd||j
|q
W|j
|jdS)Nz folded header does not end with z: z folded header contains newline: )	raw_itemsrZfoldverify_generated_headersrendswithr	lenNEWLINE_WITHOUT_FWSPsearchrr)rr"hvfoldedrfolded_no_lineseprrrr/s

zGenerator._write_headerscCs|j}|dkrdSt|ts.tdt|t|jr~|jd}|dk	r~t|}|d=|j	|||j}|d|df|_
|jrtj
d|}|j|dS)Nzstring payload expected: %scharsetzcontent-transfer-encodingzcontent-typez>From )get_payload
isinstancestr	TypeErrortyper_payloadZ	get_paramrZset_payloadr0rfcrer=r.)rr"payloadrHrrr_handle_texts"


zGenerator._handle_textcCsg}|j}|dkrg}n(t|tr2|j|dSt|tsB|g}x>|D]6}|j}|j|}|j|d|jd|j	|j
qHW|j}|s|jj
|}|j|}|j||jdk	r|jrtjd|j}	n|j}	|j|	|j|j|jd||j|r|jj|jdx4|D],}
|j|jd||j|jj|
qW|j|jd|d|j|jdk	r|jrtjd|j}n|j}|j|dS)NF)r#rz>From z--r)rIrJrKrlistr'rr$rappendr3Zget_boundaryrr9_make_boundaryZset_boundarypreamblerrOr=r.rpopepilogue)rr"ZmsgtextsZsubpartspartrgboundaryZalltextrUZ	body_partrWrrr_handle_multipart
sJ









zGenerator._handle_multipartcCs0|j}|jdd|_z|j|Wd||_XdS)Nr)r)rrr[)rr"prrr_handle_multipart_signedGs
z"Generator._handle_multipart_signedcCsg}x|jD]t}|j}|j|}|j|d|jd|j}|j|j}|rx|d|jkrx|j	|jj
|ddq|j	|qW|jj|jj
|dS)NF)r#rr(r)r))
rIr'rr$rr3r+rrrSr9rr)rr"ZblocksrXrrYtextr,rrr_handle_message_delivery_statusRs
z)Generator._handle_message_delivery_statuscCs^|j}|j|}|j}t|trD|j|jdd|jd|j}n
|j	|}|j
j|dS)NrF)r#r)r'rrNrJrRr$rIrr3rrr)rr"rrYrPrrr_handle_messagegs




zGenerator._handle_messagecCsztjtj}d	t|d}|dkr(|S|}d}xD|jdtj|dtj}|j	|sZP|dt
|}|d7}q2W|S)
N=z==rz^--z(--)?$.r(z===============)randomZ	randrangesysmaxsize_fmt_compile_rereescape	MULTILINErCrK)clsr^tokenrZbZcounterZcrerrrrTs
zGenerator._make_boundarycCstj||S)N)ricompile)rlrflagsrrrrhszGenerator._compile_re)NN)FN)N)__name__
__module____qualname____doc__rrr$rr'rr.r!r1r/rQr;r[r]r_r`classmethodrTrhrrrrrs*
1#:csPeZdZdZddZddZddZdd	Zfd
dZeZ	e
dd
ZZS)raGenerates a bytes version of a Message object tree.

    Functionally identical to the base Generator except that the output is
    bytes and not string.  When surrogates were used in the input to encode
    bytes, these are decoded back to bytes for output.  If the policy has
    cte_type set to 7bit, then the message is transformed such that the
    non-ASCII bytes are properly content transfer encoded, using the charset
    unknown-8bit.

    The outfp object must accept bytes in its write method.
    cCs|jj|jdddS)Nasciisurrogateescape)rrencode)rrrrrrszBytesGenerator.writecCstS)N)r)rrrrr'szBytesGenerator._new_buffercCs
|jdS)Nrv)rx)rrrrrrszBytesGenerator._encodecCsx|jD]\}}|jj||}|jjr|jjj}|j|sRtd|d||}|j|rr|dt|}t	j
|rtd||jj|q
W|j|j
dS)Nz folded header does not end with z: z folded header contains newline: )r>rZfold_binaryr?rrxr@r	rANEWLINE_WITHOUT_FWSP_BYTESrCrrr)rr"rDrErFrrGrrrr/s


zBytesGenerator._write_headerscs^|jdkrdSt|jrJ|jjdkrJ|jr<tjd|j|_|j|jntt	|j
|dS)NZ7bitz>From )rNrrZcte_typerrOr=r.superrrQ)rr")r%rrrQs
zBytesGenerator._handle_textcCstj|jd|S)Nrv)rirorx)rlrrprrrrhszBytesGenerator._compile_re)
rqrrrsrtrr'rr/rQr;rurh
__classcell__rr)r%rrs
zD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s(eZdZdZdddddZddZdS)	rzGenerates a text representation of a message.

    Like the Generator base class, except that non-text parts are substituted
    with a format string representing the part.
    N)rcCs.tj|||||d|dkr$t|_n||_dS)aLike Generator.__init__() except that an additional optional
        argument is allowed.

        Walks through all subparts of a message.  If the subpart is of main
        type `text', then it prints the decoded payload of the subpart.

        Otherwise, fmt is a format string that is used instead of the message
        payload.  fmt is expanded with the following keywords (in
        %(keyword)s format):

        type       : Full MIME type of the non-text part
        maintype   : Main MIME type of the non-text part
        subtype    : Sub-MIME type of the non-text part
        filename   : Filename of the non-text part
        description: Description associated with the non-text part
        encoding   : Content transfer encoding of the non-text part

        The default value for fmt is None, meaning

        [Non-text (%(type)s) part of message omitted, filename %(filename)s]
        )rN)rr_FMTrg)rrr
rZfmtrrrrrs
zDecodedGenerator.__init__cCsx|jD]v}|j}|dkr4t|jdd|dq
|dkr>q
t|j|j|j|j|jd|jdd|jd	d
d|dq
WdS)Nr^F)decode)fileZ	multipartz
[no filename]zContent-Descriptionz[no description]zContent-Transfer-Encodingz
[no encoding])rMmaintypesubtypefilenameZdescriptionencoding)	walkr6printrIrgZget_content_typer7get_filenameget)rr"rXrrrrr1s 
zDecodedGenerator._dispatch)NNN)rqrrrsrtrr1rrrrrsr(z%%0%dd)!rt__all__rirer rdcopyriorrZemail.utilsrZemail.errorsr	r8NLror*rkrOrBryrrr|rrAreprrfZ_widthrgrTrrrr<module>s0



|?;