CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/mail/scripts/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/mail/scripts/__pycache__/mailmail.cpython-310.pyc

o

�bn(�@sdZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZddlmZd	Zej�d
�ZdZdZeej�Zeed
�ZGdd�d�Zdd�Zed�Zdd�Z Gdd�d�Z!dd�Z"dd�Z#da$dd�Z%dd�Z&dd �Z'd!d"�Z(d#d$�Z)dS)%z4
Implementation module for the I{mailmail} command.
�N)�ConfigParser)�StringIO)�version)�reactor)�Logger�textFileLogObserver)�smtpz
/etc/mailmailz~/.twisted/mailmailz	127.0.0.1z�Subject: Failed Message Delivery

  Message delivery failed.  The following occurred:

  %s
--
The Twisted sendmail application.
)�observerc@seZdZdZdS)�Optionsat
    Store the values of the parsed command-line options to the I{mailmail}
    script.

    @type to: L{list} of L{str}
    @ivar to: The addresses to which to deliver this message.

    @type sender: L{str}
    @ivar sender: The address from which this message is being sent.

    @type body: C{file}
    @ivar body: The object from which the message is to be read.
    N)�__name__�
__module__�__qualname__�__doc__�rr�?/usr/lib/python3/dist-packages/twisted/mail/scripts/mailmail.pyr
(sr
cCs&zt��WStyt��YSw�N)�os�getlogin�
BaseException�getpass�getuserrrrrr8s

�rzUnsupported option.c		Cs�t�}dd�|D�|_t�|_d|vrtdt�t��d|vr!t�d|vr't�d|vr<||�d�d|_|j�	|j�d	|vsDd
|vrFt�d|vrNd|_
nd
|_
d|vrYd
|_
nd|_
d|vsdd|vrhd|_nd
|_d|vrqt�d|vr�d|_|j|_
g|_nd
|_g|_gggggd�}t�}	d}tj��}|��s�nM|�dd�}|d��}|jr�|dvr�|j�tj�|d�dg�|dkr�d}n|dkr�tj�|d�d|_||vr�||�|d�|r�|�|�q�|ds�|�d|j�d��|d�s|j�std��|�d�d�|j���|d�s"|�d t���d��|�|�|j�rE|j
D]}z	|j�	|�W�q.t �yDY�q.w|�!dd�t|�"�tj�#��|_$|S)!NcSsg|]	}|�d�s|�qS)�-)�
startswith)�.0�errr�
<listcomp>Dsz parseOptions.<locals>.<listcomp>z	--versionzmailmail version:z-bpz-bsz-F�z-iz-oiz-odbTFz-odfz-oepz-epz-omz-t)�from�to�cc�bcc�datez: r)rrr r rzFrom: z
rzNo recipients specified.zTo: {}
z, r!zDate: )%r
rr�sender�printr�
SystemExit�_unsupportedOption�index�remove�
background�printErrors�recipientsFromHeaders�excludeAddresses�exludeAddressesr�sys�stdin�readline�strip�split�lower�extend�email�utils�	parseaddr�append�write�format�joinr�
rfc822dater�seek�getvalue�read�body)	�argv�o�requiredHeaders�bufferr8�line�hdrs�hdr�arrr�parseOptionsBs�
�
�
�



�rHc@seZdZdZdd�ZdS)�
Configurationa�

    @ivar allowUIDs: A list of UIDs which are allowed to send mail.
    @ivar allowGIDs: A list of GIDs which are allowed to send mail.
    @ivar denyUIDs: A list of UIDs which are not allowed to send mail.
    @ivar denyGIDs: A list of GIDs which are not allowed to send mail.

    @type defaultAccess: L{bool}
    @ivar defaultAccess: L{True} if access will be allowed when no other access
    control rule matches or L{False} if it will be denied in that case.

    @ivar useraccess: Either C{'allow'} to check C{allowUID} first
    or C{'deny'} to check C{denyUID} first.

    @ivar groupaccess: Either C{'allow'} to check C{allowGID} first or
    C{'deny'} to check C{denyGID} first.

    @ivar identities: A L{dict} mapping hostnames to credentials to use when
    sending mail to that host.

    @ivar smarthost: L{None} or a hostname through which all outgoing mail will
    be sent.

    @ivar domain: L{None} or the hostname with which to identify ourselves when
    connecting to an MTA.
    cCs@g|_g|_g|_g|_d|_d|_i|_d|_d|_d|_	dS)N�denyT)
�	allowUIDs�denyUIDs�	allowGIDs�denyGIDs�
useraccess�groupaccess�
identities�	smarthost�domain�
defaultAccess)�selfrrr�__init__�s
zConfiguration.__init__N)rrr
rrVrrrrrI�srIcCs�t�}t�|tj�s|St�}|�|�|j}|j}|j}|j	}d||fd||ffD]y\}}}	|�
|�r�d|fd|	ffD]>\}
}|�||
�rz|�||
�rz|�||
��
d�D]$}zt|�}Wntystjd|d��||d�YqUw|�|�qUq<|�|d	�}
d
d�dd�|
�
d�D�D�}
|
ddkr�t||d�q*t||d�q*|�
d
�r�|�d
�D]\}}|�
dd�}t|�dkr�tjd|d�q�||j|<q�|�
d�r�|�dd�r�|�dd�|_|�dd�r�|�dd�|_|S)NrOrP�allowrJ�,z6Illegal {prefix}ID in [{section}] section: {sectionID}r)�prefix�section�	sectionID�ordercS�g|]}|���qSr)r1�r�srrrr�zloadConfig.<locals>.<listcomp>cSr]r)r2r^rrrrr`�identity�:r�z.Illegal entry in [identity] section: {section})rZ�	addressesrR�default_domain)rIr�access�R_OKrr>rKrLrMrN�has_section�
has_option�getr1�int�
ValueError�_log�error�upperr7�setattr�items�lenrQrRrS)�path�c�p�au�du�ag�dgrZrG�d�mode�Lr[r\�host�up�partsrrr�
loadConfig�sZ



��	��

r�cCst��dSr�r�stop)�resultrrr�success,sr�cCst��|adSr)rr��failed)�frrr�failure3sr�cCs.t�||j|j|j�}|�tt�t�	�dSr)
r�sendmailr"rr?�addCallbacksr�r�r�run)r}�options�identrzrrrr�9sr�cCsf|jg}d�tjdtj�d��}t�}|j|d�tt	|�
��}t�d|||�}|�dd��dS)Nz2"Internally Generated Message ({})"<postmaster@{}>r�ascii��file�	localhostcSst��Srr�)�_rrr�<lambda>Hszsenderror.<locals>.<lambda>)
r"r9r-r@r�DNSNAME�decoder�printTraceback�	ERROR_FMTr=r��addBoth)r�r��	recipientr"rnr?rzrrr�	senderror?s�r�cCs�t��}t��}|jdkr||jvrdS||jvrdSn||jvr#dS||jvr*dS|jdkrA||jvr6dS||jvr=dS|j	S||jvrHdS||jvrOdS|j	S)NrJTF)
r�getuid�getgidrOrLrKrPrNrMrT)�conf�uid�gidrrrrJKs.


�





�
rJcCs�ttjdd��}tt�}tt�}t|�st|�r t�d�dS|j	p'|j	p't
}|j��}|�
|j�|jr;|jt_n|jrB|jt_t|||�tr_|jrXtjtjd�td��tt|�dSdS)NrzPermission deniedr�)rHr-r@r��
GLOBAL_CFG�	LOCAL_CFGrJrmrnrR�	SMARTHOSTrQ�copy�updaterSrr�r�r�r)r��stderrr$r�)rA�gConf�lConfr}r�rrrr�hs(


�r�)*r�email.utilsr4rrr-�configparserr�ior�twisted.copyrightr�twisted.internetr�twisted.loggerrr�twisted.mailrr�rs�
expanduserr�r�r�r��_logObserverrmr
rr$r%rHrIr�r�r�r�r�r�rJr�rrrr�<module>s<


z+E
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY