/snap/core18/2999/usr/lib/python3.6/__pycache__
NameSizeModeActions
abc.cpython-36.pyc75150644editdlrm
aifc.cpython-36.pyc259430644editdlrm
antigravity.cpython-36.pyc7790644editdlrm
argparse.cpython-36.pyc604560644editdlrm
ast.cpython-36.pyc117040644editdlrm
asynchat.cpython-36.pyc68150644editdlrm
asyncore.cpython-36.pyc158380644editdlrm
base64.cpython-36.pyc170590644editdlrm
bdb.cpython-36.pyc170330644editdlrm
binhex.cpython-36.pyc120860644editdlrm
bisect.cpython-36.pyc26760644editdlrm
bz2.cpython-36.pyc112820644editdlrm
calendar.cpython-36.pyc258820644editdlrm
cgi.cpython-36.pyc284160644editdlrm
cgitb.cpython-36.pyc100800644editdlrm
chunk.cpython-36.pyc49000644editdlrm
cmd.cpython-36.pyc125750644editdlrm
code.cpython-36.pyc98360644editdlrm
codecs.cpython-36.pyc339000644editdlrm
codeop.cpython-36.pyc62700644editdlrm
colorsys.cpython-36.pyc33110644editdlrm
compileall.cpython-36.pyc82780644editdlrm
configparser.cpython-36.pyc452440644editdlrm
contextlib.cpython-36.pyc111580644editdlrm
copy.cpython-36.pyc70790644editdlrm
copyreg.cpython-36.pyc42440644editdlrm
cProfile.cpython-36.pyc42940644editdlrm
crypt.cpython-36.pyc22420644editdlrm
csv.cpython-36.pyc118550644editdlrm
datetime.cpython-36.pyc545110644editdlrm
decimal.cpython-36.pyc3510644editdlrm
difflib.cpython-36.pyc596420644editdlrm
dis.cpython-36.pyc141810644editdlrm
doctest.cpython-36.pyc755890644editdlrm
dummy_threading.cpython-36.pyc11020644editdlrm
enum.cpython-36.pyc234530644editdlrm
filecmp.cpython-36.pyc83050644editdlrm
fileinput.cpython-36.pyc131520644editdlrm
fnmatch.cpython-36.pyc28740644editdlrm
formatter.cpython-36.pyc175790644editdlrm
fractions.cpython-36.pyc184260644editdlrm
ftplib.cpython-36.pyc283570644editdlrm
functools.cpython-36.pyc240620644editdlrm
genericpath.cpython-36.pyc37260644editdlrm
getopt.cpython-36.pyc62170644editdlrm
getpass.cpython-36.pyc41770644editdlrm
gettext.cpython-36.pyc143060644editdlrm
glob.cpython-36.pyc42590644editdlrm
gzip.cpython-36.pyc162260644editdlrm
hashlib.cpython-36.pyc66920644editdlrm
heapq.cpython-36.pyc142920644editdlrm
hmac.cpython-36.pyc48360644editdlrm
imaplib.cpython-36.pyc421380644editdlrm
imghdr.cpython-36.pyc41500644editdlrm
imp.cpython-36.pyc96960644editdlrm
inspect.cpython-36.pyc797390644editdlrm
io.cpython-36.pyc33870644editdlrm
ipaddress.cpython-36.pyc623860644editdlrm
keyword.cpython-36.pyc17650644editdlrm
linecache.cpython-36.pyc37780644editdlrm
locale.cpython-36.pyc340300644editdlrm
lzma.cpython-36.pyc119920644editdlrm
macpath.cpython-36.pyc56410644editdlrm
macurl2path.cpython-36.pyc18670644editdlrm
mailbox.cpython-36.pyc637520644editdlrm
mailcap.cpython-36.pyc72090644editdlrm
mimetypes.cpython-36.pyc155530644editdlrm
modulefinder.cpython-36.pyc153660644editdlrm
netrc.cpython-36.pyc38360644editdlrm
nntplib.cpython-36.pyc337800644editdlrm
ntpath.cpython-36.pyc131900644editdlrm
nturl2path.cpython-36.pyc14990644editdlrm
numbers.cpython-36.pyc121420644editdlrm
opcode.cpython-36.pyc54130644editdlrm
operator.cpython-36.pyc139130644editdlrm
optparse.cpython-36.pyc480540644editdlrm
os.cpython-36.pyc296280644editdlrm
pathlib.cpython-36.pyc420070644editdlrm
pdb.cpython-36.pyc460940644editdlrm
pickle.cpython-36.pyc426910644editdlrm
pickletools.cpython-36.pyc660200644editdlrm
pipes.cpython-36.pyc78080644editdlrm
pkgutil.cpython-36.pyc162610644editdlrm
platform.cpython-36.pyc291970644editdlrm
plistlib.cpython-36.pyc280550644editdlrm
poplib.cpython-36.pyc133290644editdlrm
posixpath.cpython-36.pyc104560644editdlrm
pprint.cpython-36.pyc158240644editdlrm
profile.cpython-36.pyc139010644editdlrm
pstats.cpython-36.pyc218570644editdlrm
pty.cpython-36.pyc38610644editdlrm
pyclbr.cpython-36.pyc83650644editdlrm
pydoc.cpython-36.pyc837750644editdlrm
py_compile.cpython-36.pyc65440644editdlrm
queue.cpython-36.pyc87550644editdlrm
quopri.cpython-36.pyc57730644editdlrm
random.cpython-36.pyc193300644editdlrm
re.cpython-36.pyc140580644editdlrm
reprlib.cpython-36.pyc54000644editdlrm
rlcompleter.cpython-36.pyc57800644editdlrm
runpy.cpython-36.pyc79820644editdlrm
sched.cpython-36.pyc65640644editdlrm
secrets.cpython-36.pyc21620644editdlrm
selectors.cpython-36.pyc176970644editdlrm
shelve.cpython-36.pyc94580644editdlrm
shlex.cpython-36.pyc69700644editdlrm
shutil.cpython-36.pyc307040644editdlrm
signal.cpython-36.pyc25150644editdlrm
site.cpython-36.pyc165600644editdlrm
sitecustomize.cpython-36.pyc2120644editdlrm
smtpd.cpython-36.pyc266830644editdlrm
smtplib.cpython-36.pyc353400644editdlrm
sndhdr.cpython-36.pyc69130644editdlrm
socket.cpython-36.pyc220130644editdlrm
socketserver.cpython-36.pyc242500644editdlrm
sre_compile.cpython-36.pyc102780644editdlrm
sre_constants.cpython-36.pyc59720644editdlrm
sre_parse.cpython-36.pyc203580644editdlrm
ssl.cpython-36.pyc369390644editdlrm
stat.cpython-36.pyc38510644editdlrm
statistics.cpython-36.pyc181740644editdlrm
string.cpython-36.pyc79640644editdlrm
stringprep.cpython-36.pyc100300644editdlrm
struct.cpython-36.pyc3120644editdlrm
subprocess.cpython-36.pyc354850644editdlrm
sunau.cpython-36.pyc169380644editdlrm
symbol.cpython-36.pyc25170644editdlrm
symtable.cpython-36.pyc104280644editdlrm
sysconfig.cpython-36.pyc159160644editdlrm
tabnanny.cpython-36.pyc69750644editdlrm
tarfile.cpython-36.pyc630850644editdlrm
telnetlib.cpython-36.pyc180970644editdlrm
tempfile.cpython-36.pyc253090644editdlrm
textwrap.cpython-36.pyc136840644editdlrm
this.cpython-36.pyc12650644editdlrm
threading.cpython-36.pyc372340644editdlrm
timeit.cpython-36.pyc116030644editdlrm
token.cpython-36.pyc33200644editdlrm
tokenize.cpython-36.pyc186470644editdlrm
trace.cpython-36.pyc194950644editdlrm
traceback.cpython-36.pyc196460644editdlrm
tracemalloc.cpython-36.pyc172290644editdlrm
tty.cpython-36.pyc10720644editdlrm
turtle.cpython-36.pyc1317510644editdlrm
types.cpython-36.pyc82010644editdlrm
typing.cpython-36.pyc733060644editdlrm
uu.cpython-36.pyc34980644editdlrm
uuid.cpython-36.pyc209180644editdlrm
warnings.cpython-36.pyc132580644editdlrm
wave.cpython-36.pyc178850644editdlrm
weakref.cpython-36.pyc191430644editdlrm
webbrowser.cpython-36.pyc157970644editdlrm
xdrlib.cpython-36.pyc83020644editdlrm
zipapp.cpython-36.pyc55340644editdlrm
zipfile.cpython-36.pyc497280644editdlrm
_bootlocale.cpython-36.pyc9800644editdlrm
_collections_abc.cpython-36.pyc287970644editdlrm
_compat_pickle.cpython-36.pyc65660644editdlrm
_compression.cpython-36.pyc41040644editdlrm
_dummy_thread.cpython-36.pyc48510644editdlrm
_markupbase.cpython-36.pyc79910644editdlrm
_osx_support.cpython-36.pyc96840644editdlrm
_pydecimal.cpython-36.pyc1634020644editdlrm
_pyio.cpython-36.pyc713860644editdlrm
_sitebuiltins.cpython-36.pyc34350644editdlrm
_strptime.cpython-36.pyc159630644editdlrm
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc187790644editdlrm
_threading_local.cpython-36.pyc64250644editdlrm
_weakrefset.cpython-36.pyc78280644editdlrm
__future__.cpython-36.pyc41670644editdlrm
__phello__.foo.cpython-36.pyc1190644editdlrm
Edit: /snap/core18/2999/usr/lib/python3.6/__pycache__/smtpd.cpython-36.pyc (26683B)
3 Nqi@s^dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZddddd gZejdZd ZGd d d Zead ZdZdZd%ddZGdddejZGdddejZGdddeZGdddeZGdd d eZGdddZ ddZ!e"dkrZe!Z#e#j$Z$de$krpe$j%dZ&e'e$de&e(e)dgZ*e$e&ddZ$nddl+Z*e,e*e$Z-e-e#j.e#j/fe#j0e#j1fe#j2e#j3dZ4e#j5r6y ddl6Z6Wn.e7k re8d ej9d!ej:dYnXe6j;d"d#ZWne?k rXYnXdS)&aAn RFC 5321 smtp proxy with optional RFC 1870 and RFC 6531 extensions. Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]] Options: --nosetuid -n This program generally tries to setuid `nobody', unless this flag is set. The setuid call will fail if this program is not run as root (in which case, use this flag). --version -V Print the version number and exit. --class classname -c classname Use `classname' as the concrete SMTP proxy class. Uses `PureProxy' by default. --size limit -s limit Restrict the total size of the incoming message to "limit" number of bytes via the RFC 1870 SIZE extension. Defaults to 33554432 bytes. --smtputf8 -u Enable the SMTPUTF8 extension and behave as an RFC 6531 smtp proxy. --debug -d Turn on debugging prints. --help -h Print this message and exit. Version: %(__version__)s If localhost is not given then `localhost' is used, and if localport is not given then 8025 is used. If remotehost is not given then `localhost' is used, and if remoteport is not given, then 25 is used. N)warn) get_addr_specget_angle_addr SMTPChannel SMTPServerDebuggingServer PureProxy MailmanProxyzPython SMTP proxy version 0.3c@seZdZddZddZdS)DevnullcCsdS)N)selfmsgr r /usr/lib/python3.6/smtpd.pywritefsz Devnull.writecCsdS)Nr )r r r rflushgsz Devnull.flushN)__name__ __module__ __qualname__rrr r r rr esr  z, icCs4ttttjd|r&t|tjdtj|dS)N)file)print__doc__globalssysstderrexit)coder r r rusagepsrc@seZdZdZdZdZejefddZe ddZ e dd d fd d Z d d Z ddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe ddZejddZe dd Zejd!d Ze d"d#Zejd$d#Ze d%d&Zejd'd&Ze d(d)Zejd*d)Ze d+d,Zejd-d,Ze d.d/Zejd0d/Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dS)SrricCs|S)Nr )xr r r|szSMTPChannel.c Cs*yt|jjStk r$|jSXdS)N)maxcommand_size_limitsvalues ValueErrorcommand_size_limit)r r r rmax_command_size_limit~sz"SMTPChannel.max_command_size_limitNFc Cstjj|||d||_||_||_||_||_||_|rF|rFt d|rdd|_ d|_ d|_ t |_nd|_ d|_ td|_ d |_|jd|_d |_|jjtj|_y|j|_Wn:tk r}z|j|jd tjkrdSd}~XnXtd t |jt!d |j"d|jt#fdS)N)mapzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same timerz .s . FrzPeer:)rz 220 %s %s)$asynchat async_chat__init__ smtp_serverconnaddrdata_size_limitenable_SMTPUTF8 _decode_datar% _emptystring_linesep_dotsepNEWLINE_newlineord_set_rset_state seen_greeting extended_smtpr#clearsocketZgetfqdnfqdnZ getpeernamepeerOSErrorcloseargserrnoZENOTCONNrrepr DEBUGSTREAMpush __version__) r Zserverr1r2r3r(r4 decode_dataerrr r rr/s@   zSMTPChannel.__init__cCs.|j|_d|_g|_d|_d|_|jddS)z/Reset state variables to their post-DATA state.NFrs )COMMAND smtp_statemailfromrcpttosrequire_SMTPUTF8 num_bytesset_terminator)r r r r_set_post_data_states z SMTPChannel._set_post_data_statecCs|jd|_g|_dS)z.Reset all state variables except the greeting.rN)rT received_datareceived_lines)r r r rr<szSMTPChannel._set_rset_statecCstdtd|jS)NzTAccess to __server attribute on SMTPChannel is deprecated, use 'smtp_server' instead)rDeprecationWarningr0)r r r r__serverszSMTPChannel.__servercCstdtd||_dS)NzRSetting __server attribute on SMTPChannel is deprecated, set 'smtp_server' insteadrW)rrXr0)r valuer r rrYscCstdtd|jS)NzUAccess to __line attribute on SMTPChannel is deprecated, use 'received_lines' insteadrW)rrXrV)r r r r__lineszSMTPChannel.__linecCstdtd||_dS)NzSSetting __line attribute on SMTPChannel is deprecated, set 'received_lines' insteadrW)rrXrV)r rZr r rr[scCstdtd|jS)NzRAccess to __state attribute on SMTPChannel is deprecated, use 'smtp_state' insteadrW)rrXrN)r r r r__stateszSMTPChannel.__statecCstdtd||_dS)NzPSetting __state attribute on SMTPChannel is deprecated, set 'smtp_state' insteadrW)rrXrN)r rZr r rr\scCstdtd|jS)NzXAccess to __greeting attribute on SMTPChannel is deprecated, use 'seen_greeting' insteadrW)rrXr=)r r r r __greetingszSMTPChannel.__greetingcCstdtd||_dS)NzVSetting __greeting attribute on SMTPChannel is deprecated, set 'seen_greeting' insteadrW)rrXr=)r rZr r rr]scCstdtd|jS)NzSAccess to __mailfrom attribute on SMTPChannel is deprecated, use 'mailfrom' insteadrW)rrXrO)r r r r __mailfromszSMTPChannel.__mailfromcCstdtd||_dS)NzQSetting __mailfrom attribute on SMTPChannel is deprecated, set 'mailfrom' insteadrW)rrXrO)r rZr r rr^scCstdtd|jS)NzQAccess to __rcpttos attribute on SMTPChannel is deprecated, use 'rcpttos' insteadrW)rrXrP)r r r r __rcpttosszSMTPChannel.__rcpttoscCstdtd||_dS)NzOSetting __rcpttos attribute on SMTPChannel is deprecated, set 'rcpttos' insteadrW)rrXrP)r rZr r rr_scCstdtd|jS)NzTAccess to __data attribute on SMTPChannel is deprecated, use 'received_data' insteadrW)rrXrU)r r r r__dataszSMTPChannel.__datacCstdtd||_dS)NzRSetting __data attribute on SMTPChannel is deprecated, set 'received_data' insteadrW)rrXrU)r rZr r rr`scCstdtd|jS)NzKAccess to __fqdn attribute on SMTPChannel is deprecated, use 'fqdn' insteadrW)rrXrA)r r r r__fqdn szSMTPChannel.__fqdncCstdtd||_dS)NzISetting __fqdn attribute on SMTPChannel is deprecated, set 'fqdn' insteadrW)rrXrA)r rZr r rrascCstdtd|jS)NzKAccess to __peer attribute on SMTPChannel is deprecated, use 'peer' insteadrW)rrXrB)r r r r__peerszSMTPChannel.__peercCstdtd||_dS)NzISetting __peer attribute on SMTPChannel is deprecated, set 'peer' insteadrW)rrXrB)r rZr r rrbscCstdtd|jS)NzKAccess to __conn attribute on SMTPChannel is deprecated, use 'conn' insteadrW)rrXr1)r r r r__conn szSMTPChannel.__conncCstdtd||_dS)NzISetting __conn attribute on SMTPChannel is deprecated, set 'conn' insteadrW)rrXr1)r rZr r rrc%scCstdtd|jS)NzKAccess to __addr attribute on SMTPChannel is deprecated, use 'addr' insteadrW)rrXr2)r r r r__addr+szSMTPChannel.__addrcCstdtd||_dS)NzISetting __addr attribute on SMTPChannel is deprecated, set 'addr' insteadrW)rrXr2)r rZr r rrd0scCs&tjj|t|d|jrdnddS)Nz zutf-8ascii)r-r.rIbytesrQ)r r r r rrI7s zSMTPChannel.pushcCs|d}|j|jkr|j}n|j|jkr*|j}|r<|j|krr#r&getattrrgr3splitr7r8rir:rUrBrOrProrpr0process_messagerT) r lineZszicommandargZmax_szmethodrktextrEkwargsZstatusr r rfound_terminatorLsd        zSMTPChannel.found_terminatorcCsH|s|jddS|jr&|jddS|j||_|jd|jdS)Nz501 Syntax: HELO hostnamez503 Duplicate HELO/EHLOz250 %s)rIr=r<rA)r r{r r r smtp_HELOs  zSMTPChannel.smtp_HELOcCs|s|jddS|jr&|jddS|j||_d|_|jd|j|jrr|jd|j|jdd7<|js|jd|jr|jd |jdd 7<|jd dS) Nz501 Syntax: EHLO hostnamez503 Duplicate HELO/EHLOTz250-%sz 250-SIZE %sMAILz 250-8BITMIMEz 250-SMTPUTF8 z250 HELP) rIr=r<r>rAr3r#r5r4)r r{r r r smtp_EHLOs&    zSMTPChannel.smtp_EHLOcCs|r|jdn |jddS)Nz501 Syntax: NOOPz250 OK)rI)r r{r r r smtp_NOOPs zSMTPChannel.smtp_NOOPcCs|jd|jdS)Nz221 Bye)rIZclose_when_done)r r{r r r smtp_QUITs zSMTPChannel.smtp_QUITcCs0t|}|d|j|kr,||djSdS)Nr)rhrsrt)r keywordr{Zkeylenr r r_strip_command_keywordsz"SMTPChannel._strip_command_keywordcCsF|sdS|jjdr$t|\}}n t|\}}|s<||fS|j|fS)Nr<)rr)lstrip startswithrrZ addr_spec)r r{addressrestr r r_getaddrs zSMTPChannel._getaddrcCsNi}xD|D]<}|jd\}}}|j s2|r6| r6dS|r>|nd||<q W|S)N=T) partitionisalnum)r paramsresultZparameqrZr r r _getparamss zSMTPChannel._getparamscCs|rd}|j}|dkr$|jdq|dkr8|jdq|dkr^d}|jrR||7}|j|q|dkrd }|jrx||7}|j|q|d kr|jd q|d kr|jd q|dkr|jdq|dkr|jdq|dkr|jdq|jdn |jddS)Nz [SP ]ZEHLOz250 Syntax: EHLO hostnameZHELOz250 Syntax: HELO hostnamerz 250 Syntax: MAIL FROM:
ZRCPTz250 Syntax: RCPT TO:
rgz250 Syntax: DATAZRSETz250 Syntax: RSETZNOOPz250 Syntax: NOOPZQUITz250 Syntax: QUITZVRFYz250 Syntax: VRFY
zD501 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFYzD250 Supported commands: EHLO HELO MAIL RCPT DATA RSET NOOP QUIT VRFY)rsrIr>)r r{ZextendedZlc_argr r r r smtp_HELPs:          zSMTPChannel.smtp_HELPcCs@|r2|j|\}}|r"|jdq<|jd|n |jddS)NzB252 Cannot VRFY user, but will accept message and attempt deliveryz502 Could not VRFY %sz501 Syntax: VRFY
)rrI)r r{rrr r r smtp_VRFYs  zSMTPChannel.smtp_VRFYcCs|js|jddStd|tdd}|jr4|d7}|dkrJ|j|dS|jd|}|j|\}}|sv|j|dS|j r|r|j|dS|jr|jddS|jj |_ |j |j }|dkr|j|dS|j s|j dd }|dkr|jd dS|jr>|j d d }|dkr&d|_n|d k r>|jddS|j dd}|r|jsh|j|dS|jrt||jkr|jddSt|jdkr|jddS||_td|jtd|jddS)Nz503 Error: send HELO firstz ===> MAIL)rz 501 Syntax: MAIL FROM:
z [SP ]zFROM:z503 Error: nested MAIL commandZBODY7BIT8BITMIMEz1501 Error: BODY can only be one of 7BIT, 8BITMIMEZSMTPUTF8FTz&501 Error: SMTPUTF8 takes no argumentsZSIZEz:552 Error: message size exceeds fixed maximum message sizerz:555 MAIL FROM parameters not recognized or not implementedzsender:z250 OK)rr)r=rIrrHr>rrrOrsrvrorr5popr4rQisdigitr3intrhkeys)r r{ syntaxerrrrZbodysmtputf8sizer r r smtp_MAILsh                     zSMTPChannel.smtp_MAILcCs|js|jddStd|td|js6|jddSd}|jrH|d7}|dkr^|j|dS|jd|}|j|\}}|s|j|dS|j r|r|j|dS|jj |_ |j |j }|dkr|j|dSt |j dkr|jd dS|jj|td |jtd|jd dS) Nz503 Error: send HELO firstz ===> RCPT)rz503 Error: need MAIL commandz501 Syntax: RCPT TO:
z [SP ]zTO:rz8555 RCPT TO parameters not recognized or not implementedzrecips:z250 OK)r=rIrrHrOr>rrrsrvrprrhrrPri)r r{rrrr r r smtp_RCPT7s@           zSMTPChannel.smtp_RCPTcCs(|r|jddS|j|jddS)Nz501 Syntax: RSETz250 OK)rIr<)r r{r r r smtp_RSETZs  zSMTPChannel.smtp_RSETcCsZ|js|jddS|js(|jddS|r:|jddS|j|_|jd|jddS)Nz503 Error: send HELO firstz503 Error: need RCPT commandz501 Syntax: DATAs . z#354 End data with .)r=rIrPrgrNrS)r r{r r r smtp_DATAas    zSMTPChannel.smtp_DATAcCs|jddS)Nz502 EXPN not implemented)rI)r r{r r r smtp_EXPNpszSMTPChannel.smtp_EXPN),rrrrMrgr& collections defaultdictr#propertyr'DATA_SIZE_DEFAULTr/rTr<Z_SMTPChannel__serversetterZ_SMTPChannel__lineZ_SMTPChannel__stateZ_SMTPChannel__greetingZ_SMTPChannel__mailfromZ_SMTPChannel__rcpttosZ_SMTPChannel__dataZ_SMTPChannel__fqdnZ_SMTPChannel__peerZ_SMTPChannel__connZ_SMTPChannel__addrrIrmrrrrrrrrrrrrrrrr r r rrws` &            >   # 6#c@s2eZdZeZedddfddZddZddZdS) rNFc Cs||_||_||_||_||_|r.|r.tdtjj||dyNt j |dt j i}|j |dd|dd|j |j||jdWn|jYn(Xtd|jjtjtj||ftddS) NzFdecode_data and enable_SMTPUTF8 cannot be set to True at the same time)r(typerrz0%s started at %s Local addr: %s Remote addr:%s)r)Z _localaddr _remoteaddrr3r4r5r%asyncore dispatcherr/r@Z getaddrinfoZ SOCK_STREAMZ create_socketZset_reuse_addrZbindZlistenrDr __class__rtimectimerH)r Z localaddrZ remoteaddrr3r(r4rKZ gai_resultsr r rr/xs*  zSMTPServer.__init__cCs6tdt|td|j||||j|j|j|j}dS)NzIncoming connection from %s)r)rrGrH channel_classr3Z_mapr4r5)r r1r2Zchannelr r rhandle_acceptedszSMTPServer.handle_acceptedcKstdS)aOverride this abstract method to handle messages from the client. peer is a tuple containing (ipaddr, port) of the client that made the socket connection to our smtp port. mailfrom is the raw address the client claims the message is coming from. rcpttos is a list of raw addresses the client wishes to deliver the message to. data is a string containing the entire full text of the message, headers (if supplied) and all. It has been `de-transparencied' according to RFC 821, Section 4.5.2. In other words, a line containing a `.' followed by other text has had the leading dot removed. kwargs is a dictionary containing additional information. It is empty if decode_data=True was given as init parameter, otherwise it will contain the following keys: 'mail_options': list of parameters to the mail command. All elements are uppercase strings. Example: ['BODY=8BITMIME', 'SMTPUTF8']. 'rcpt_options': same, for the rcpt command. This function should return None for a normal `250 Ok' response; otherwise, it should return the desired response string in RFC 821 format. N)NotImplementedError)r rBrOrPrkr~r r rrwszSMTPServer.process_message) rrrrrrr/rrwr r r rrts  c@seZdZddZddZdS)rcCsrd}|j}x`|D]X}|rP| rPd|d}t|tsDt|jd}t|d}t|tsbt|}t|qWdS)NrzX-Peer: rzutf-8) splitlines isinstancerjrGencoder)r rBrkZ inheaderslinesrxZ peerheaderr r r_print_message_contents     z&DebuggingServer._print_message_contentcKsXtd|r@|jdr&td|d|jdr@td|d|j||tddS)Nz%---------- MESSAGE FOLLOWS ----------rozmail options: %srpzrcpt options: %s z%------------ END MESSAGE ------------)rgetr)r rBrOrPrkr~r r rrws   zDebuggingServer.process_messageN)rrrrrwr r r rrscs,eZdZfddZddZddZZS)rcs.d|kr|drtdtt|j||dS)Nr4z$PureProxy does not support SMTPUTF8.)r%superrr/)r rEr~)rr rr/szPureProxy.__init__c Csh|jd}d}x|D]}|sP|d7}qW|j|d|dtj|}|j|||}td|tddS)Nrrrz X-Peer: %szwe got some refusals:)r)rvinsertr9rq_deliverrrH) r rBrOrPrkrryrxrefusedr r rrws    zPureProxy.process_messagec Csddl}i}yB|j}|j|jd|jdz|j|||}Wd|jXWn|jk r}ztdtd|j }WYdd}~Xnjt |j fk r}zHtd|j tdt |dd }t |dd} x|D]} || f|| <qWWYdd}~XnX|S) Nrrzgot SMTPRecipientsRefused)rZgotZ smtp_codeZ smtp_errorignore)smtplibZSMTPZconnectrZsendmailZquitZSMTPRecipientsRefusedrrHZ recipientsrCZ SMTPExceptionrru) r rOrPrkrrseZerrcodeerrmsgrr r rrs$    "zPureProxy._deliver)rrrr/rwr __classcell__r r )rrrs cs$eZdZfddZddZZS)r cs.d|kr|drtdtt|j||dS)Nr4z'MailmanProxy does not support SMTPUTF8.)r%rrr/)r rEr~)rr rr/ szMailmanProxy.__init__cCs:ddlm}ddlm}ddlm}ddlm}g} x~|D]v} | jjdd} | jd} t| dkrhq:| d} t| dkr| d }nd }|j |  s:|d!krq:| j | | |fq:Wx| D]\} } }|j | qWt ddj |td|r|j|||}t d|tdi}||}|j|}|jds2||d<|jdsPtjtj|d<x| D]\} } }t d| td|j| }|s|j| dd}||| <|d kr|j|d dn|d kr|j|d dnh|d kr|j|d dnN|d kr|j|d dn4|d"krV|dkrd|d<nd |d<|j|d dqVWdS)#Nr)StringIO)Utils)Message)MailList@-rWrradminownerrequestrqleavezforwarding recips:rn)rzwe got refusals:fromZFromZdateZDatezsending message to)lock)tolist)Ztoadmin)Ztoowner)Z torequestZ subscribeZSubjectZ unsubscribe)rrrrrqr)rqr)iorZMailmanrrrlowerrvrhZ list_existsriremoverrqrHrrrrZEnqueue)r rBrOrPrkrrrrZ listnamesZrcptZlocalpartsZlistnamerzrZmlistsrr Zmlistr r rrwsd                    zMailmanProxy.process_message)rrrr/rwrr r )rrr s c@seZdZdZdZdZdZdS)OptionsTrNF)rrrsetuid classname size_limitr4r r r rr_src !Csty.tjtjdddddddddd g\}}Wn.tjk r\}ztd|WYdd}~XnXt}x|D]\}}|d'krtd qj|d(krtttjd qj|d)krd|_ qj|d*kr||_ qj|d+krtj a qj|d,krd|_ qj|d-krjyt|}||_Wqjtd|tj dtjdYqjXqjWt|dkr@d}d}nPt|dkr\|d }d}n4t|d kr||d }|d}ntdd!tj||jd"} | d krtdd#||d| |_yt|| dd|_Wn$tk rtdd$|YnX|jd"} | d kr"tdd%||d| |_yt|| dd|_Wn$tk rntdd&|YnX|S).Nrz nVhc:s:duzclass=Znosetuidversionhelpzsize=debugr-h--helpr-V --version-n --nosetuidF-c--class-d--debug-u --smtputf8T-s--sizezInvalid size: )rzlocalhost:8025z localhost:25rWzInvalid arguments: %s:zBad local spec: %szBad local port: %szBad remote spec: %szBad remote port: %s)rr)rr)rr)rr)rr)rr)rr)getoptrargverrorrrrrJrrrrrHr4rrrh COMMASPACErqrr localhost localportr% remotehost remoteport) ZoptsrEroptionsZoptr{Zint_sizeZ localspecZ remotespecryr r r parseargsfsp         r__main__r)r)r4z7Cannot import module "pwd"; try running with -n option.)rnobodyrWz3Cannot setuid "nobody"; try running with -n option.)r)@rrosrFrrr@rr-rwarningsrZemail._header_value_parserrr__all__rZprogramrJr rHr9rrrr.rrrrrr rrrrrrfindZlastdot __import__rlocalsmodrruZclass_rrrrrr4proxyrpwd ImportErrorrrrgetpwnamrPermissionErrorZloopKeyboardInterruptr r r r-sx#   M-SB