选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´iŒ„ã@sVdZdZddlmZmZmZddlmZddlZddl Z ddl Z ddl m Z ddlmZddlZddlZddlZgd¢Zd adad d „Zd d „Zdd„Zdd„Zeadade jdddfdd„Zd2dd„Zdd„Zdd„Z Gdd„dƒZ!Gdd „d ƒZ"e jfd!d"„Z#d3d#d$„Z$e jfd%d&„Z%d'd(„Z&d)d*„Z'd+d,„Z(d-d.„Z)d/d0„Z*e+d1k�rRe#ƒdS)4z�Support module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. z2.6é)ÚStringIOÚBytesIOÚ TextIOWrapper)ÚMappingN)Ú FeedParser)ÚMessage) ÚMiniFieldStorageÚ FieldStorageÚparseÚparse_multipartÚ parse_headerÚtestÚprint_exceptionÚ print_environÚ print_formÚprint_directoryÚprint_argumentsÚprint_environ_usageÚcGsDtr*ts*zttdƒaWnty(Yn0ts4tantat|ŽdS)a„Write a log message, if there is a log file. Even though this function is called initlog(), you should always use log(); log is a variable that is set either to initlog (initially), to dolog (once the log file has been opened), or to nolog (when logging is disabled). The first argument is a format string; the remaining arguments (if any) are arguments to the % operator, so e.g. log("%s: %s", "a", "b") will write "a: b" to the log file, followed by a newline. If the global logfp is not None, it should be a file object to which log data is written. If the global logfp is None, the global logfile may be a string giving a filename to open, in append mode. This file should be world writable!!! If the file can't be opened, logging is silently disabled (since there is no safe place where we could send an error message). ÚaN)ÚlogfileÚlogfpÚopenÚOSErrorÚnologÚlogÚdolog©Zallargs©rú/usr/lib64/python3.9/cgi.pyÚinitlog8s r cGst ||d¡dS)z=Write a log message to the log file. See initlog() for docs.Ú N)rÚwrite)ÚfmtÚargsrrrr[srcGsdS)z9Dummy function, assigned to log when logging is disabled.Nrrrrrr_srcCsdatrt ¡datadS)zClose the log file.rN)rrÚcloser rrrrrÚcloselogcs r&ú&c Cs^|durtj}t|dƒr |j}nd}t|tƒr4|j}d|vrDd|d<|ddk�r t|dƒ\}}|dkrxt|||d �S|d kr²t |d ƒ}t r |t kr t d ƒ‚|  |¡  |¡} nd } d|vrØ| rÊ| d} | |d} n*tjdd…�r| rô| d} | tjd} | |d<nÕóz#parse_multipart..)r<ÚformatrZset_typeÚKeyErrorr )r@rEr(rLr-rIrDrKrrPrr ¼s    ÿr ccs˜|dd…dkr”|dd…}| d¡}|dkr`| dd|¡| dd|¡dr`| d|d¡}q&|dkrpt|ƒ}|d|…}| ¡V||d…}qdS)Nr2ú;rú"ú\"é)ÚfindÚcountÚlenÚstrip)ÚsÚendÚfrrrÚ _parseparam×s  (  racCs¸td|ƒ}| ¡}i}|D]’}| d¡}|dkr|d|… ¡ ¡}||dd… ¡}t|ƒdkr¦|d|dkr‚dkr¦nn |dd…}| d d ¡ d d¡}|||<q||fS) zfParse a Content-type like header. Return the main content-type and a dictionary of options. rVú=rNr2rYéÿÿÿÿrWz\\ú\rX)raÚ__next__rZr]Úlowerr\rH)ÚlineÚpartsÚkeyrEÚpÚiÚnameÚvaluerrrr ãs  ,  r c@s@eZdZdZdZdZdZdZiZdZ iZ iZ dd„Z dd„Z dS)rz=Like FieldStorage, for use when no file uploads are possible.NcCs||_||_dS)z&Constructor from field name and value.N©rlrm©ÚselfrlrmrrrÚ__init__ szMiniFieldStorage.__init__cCsd|j|jfS)z Return printable representation.zMiniFieldStorage(%r, %r)rn©rprrrÚ__repr__szMiniFieldStorage.__repr__)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚfilenameÚlistÚtypeÚfileÚ type_optionsÚ dispositionÚdisposition_optionsrKrqrsrrrrrûsrc @sþeZdZdZdddejdddddddf dd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z d;dd„ZdrSz)FieldStorage.getvalue..N©r6ryrm©rpriÚdefaultrmrrrÚgetvalues  zFieldStorage.getvaluecCs4||vr,||}t|tƒr$|djS|jSn|SdS)z! Return the first value received.rNr©rªrrrÚgetfirsts   zFieldStorage.getfirstcCs:||vr2||}t|tƒr(dd„|DƒS|jgSngSdS)z Return list of received values.cSsg|] }|j‘qSrr¥r¦rrrr¨.rSz(FieldStorage.getlist..Nr©)rprirmrrrrM)s   zFieldStorage.getlistcCs*|jdurtdƒ‚ttdd„|jDƒƒƒS)zDictionary style keys() method.Nr css|] }|jVqdSr–©rl©rNr£rrrÚ 8rSz$FieldStorage.keys..)ryr‰Úsetrrrrrrœ4s zFieldStorage.keyscs*|jdurtdƒ‚t‡fdd„|jDƒƒS)z%Dictionary style __contains__ method.Nr c3s|]}|jˆkVqdSr–r®r¯©rirrr°>rSz,FieldStorage.__contains__..)ryr‰Úany)rprirr²rÚ __contains__:s zFieldStorage.__contains__cCs t| ¡ƒS)z Dictionary style len(x) support.)r\rœrrrrrÚ__len__@szFieldStorage.__len__cCs|jdurtdƒ‚t|jƒS)NzCannot be converted to bool.)ryr‰ÚboolrrrrrÚ__bool__Ds zFieldStorage.__bool__c Cs–|j |j¡}t|tƒs0td|jt|ƒjfƒ‚| |j |j ¡}|j rT|d|j 7}t j j||j|j|j |j |j|jd�}dd„|Dƒ|_| ¡dS)z+Internal: read data in query string format.ú%s should return bytes, got %sr'©r(rLrƒr-cSsg|]\}}t||ƒ‘qSr©r©rNrirmrrrr¨VrSz0FieldStorage.read_urlencoded..N)r@r;r�r6rŠr:rzrtr<r(rLr…r>r Ú parse_qslrBrCrƒr-ryÚ skip_lines)rprFÚqueryrrrr’Is ÿ ýzFieldStorage.read_urlencodedc CsL|j}t|ƒstd|fƒ‚g|_|jrftjj|j|j|j |j |j |j |j d�}|j dd„|Dƒ¡|jpp|j}|j ¡}t|tƒsžtd|jt|ƒjfƒ‚|jt|ƒ7_| ¡d|jkrä|rä|j ¡}|jt|ƒ7_q°|j }|du�r|t|jƒ8}tƒ} d} |j ¡} | | 7} |  ¡�s �q0�q | �s:�q@|jt| ƒ7_|  |  |j |j ¡¡|  ¡} d | v�rz| d =|jdu�rŠdn |j|j} ||j| ||||| |j |j ||j ƒ }|du�rô|d 8}|j�râ|t|jƒ8}|d k�rôtd ƒ‚|j|j7_|j |¡|j �s@|j|j!k�r4d k�rnn�q@�q| "¡dS) z/Internal: read a part that is itself multipart.z&Invalid boundary in multipart form: %rr¹css|]\}}t||ƒVqdSr–rºr»rrrr°frSz*FieldStorage.read_multi..r¸ó--NrSr€r2rzMax number of fields exceeded)#r�Úvalid_boundaryr:ryr…r>r r¼rBrCr(rLrƒr-ÚextendÚFieldStorageClassÚ __class__r@r�r6rŠrzrtrŒr\r]rZfeedr<r%r�r¡r‘r�r½)rprArBrCZibr¾ÚklassZ first_linerƒÚparserZhdr_textÚdatarKr�Úpartrrrr“[sr ý   ÿÿ      ÿþ   (zFieldStorage.read_multicCs4|jdkr| ¡| ¡n| ¡|j d¡dS)zInternal: read an atomic part.rN)r�Ú read_binaryr½Ú read_linesr{ržrrrrrr” s   zFieldStorage.read_singlei cCs’| ¡|_|j}|dkrŽ|dkrŽ|j t||jƒ¡}t|tƒsVt d|jt |ƒj fƒ‚|j t |ƒ7_ |std|_qŽ|j |¡|t |ƒ}qdS)zInternal: read binary data.rr¸rcN)Ú make_filer{r�r@r;ÚminÚbufsizer6rŠr:rzrtrŒr\r‘r")rpZtodorÆrrrrÈ«s  ÿ zFieldStorage.read_binarycCs@|jrtƒ|_|_ntƒ|_|_|jr4| ¡n| ¡dS)z0Internal: read lines until EOF or outerboundary.N)rŽrr{Ú_FieldStorage__filerr‹Úread_lines_to_outerboundaryÚread_lines_to_eofrrrrrrɼs  zFieldStorage.read_linescCsv|jdurF|j ¡t|ƒdkrF| ¡|_|j ¡}|j |¡d|_|jrZ|j |¡n|j | |j |j ¡¡dS)z line is always bytes, not stringNiè) rÍÚtellr\rÊr{r¬r"rŽr<r(rL)rprgrÆrrrZ__writeÇs    zFieldStorage.__writecCs:|j d¡}|jt|ƒ7_|s*d|_q6| |¡qdS)zInternal: read lines until EOF.ércN)r@r�rŒr\r‘Ú_FieldStorage__write)rprgrrrrÏÖs  zFieldStorage.read_lines_to_eofc CsJd|j}|d}d}d}d}|jdurFd|jkr>|krFnn�qF|j d¡}|jt|ƒ7_|t|ƒ7}|s~d|_�qF|dkr’||}d}| d¡rÆ|rÆ| ¡}||kr´�qF||krÆd |_�qF|}|  d ¡rêd }|dd …}d}nL|  d ¡�r d }|dd…}d}n*|  d¡�r.d}|dd…}d }nd}d }|  ||¡qdS)zžInternal: read lines until outerboundary. Data is read as bytes: boundaries and line ends must be converted to bytes for comparisons. r¿rSTrNrÑrcó r2s éþÿÿÿó F) r‹r�r@r�rŒr\r‘Ú startswithÚrstripÚendswithrÒ) rpÚ next_boundaryÚ last_boundaryÚdelimÚlast_line_lfendÚ_readrgÚ strippedlineZodelimrrrrÎàsN $        z(FieldStorage.read_lines_to_outerboundarycCs�|jr |jrdSd|j}|d}d}|j d¡}|jt|ƒ7_|sPd|_qŒ| d¡r€|r€| ¡}||krpqŒ||kr€d|_qŒ| d¡}q&dS)z5Internal: skip lines until outer boundary if defined.Nr¿TrÑrcr2rÕ)r‹r‘r@r�rŒr\rØr])rprÙrÚrÜrgrÞrrrr½s$   zFieldStorage.skip_linescCs&|jrt d¡Stjd|jdd�SdS)a¯Overridable: return a readable & writable file. The file will be used as follows: - data is written to it - seek(0) - data is read from it The file is opened in binary mode for files, in text mode for other fields This version opens a temporary file for reading and writing, and immediately deletes (unlinks) it. The trick (on Unix!) is that the file can still be used, but it can't be opened by another process, and it will automatically be deleted when it is closed or when the current process terminates. If you want a more permanent file, you derive a class which overrides this method. If you want a visible temporary file that is nevertheless automatically deleted when the script terminates, try defining a __del__ method in a derived class which unlinks the temporary files you have created. zwb+zw+r!)r(ÚnewlineN)rŽÚtempfileÚ TemporaryFiler(rrrrrrÊ(s  ÿzFieldStorage.make_file)N)N)!rtrurvrwÚosrArqr˜r™ršrsr�rŸr¤r¬r­rMrœr´rµr·r’rÂr“r”rÌrÈrÉrÒrÏrÎr½rÊrrrrr sB)ý &   E   2r cCsÂtdƒtƒtjt_zNtƒ}tƒtƒt|ƒt|ƒt ƒdd„}|fdd„}tdƒ|ƒWnt ƒYn0tdƒda z&tƒ}tƒtƒt|ƒt|ƒWnt ƒYn0d S) z—Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. zContent-type: text/htmlcSs tdƒdS)Nz,testing print_exception() -- italics?)Úexecrrrrr`[sztest..fcSs |ƒdSr–r)r`rrrÚg]sztest..gz9

What follows is a test, not an actual exception:

z*

Second try with a small maxlen...

é2N) Úprintr3ÚstdoutÚstderrr rrrrrrr9)rAÚformr`rärrrr Js4    r c Csx|durt ¡\}}}ddl}tƒtdƒ| ||¡| ||¡}tdt d |dd…¡¡t |d¡fƒ~dS)Nrz+

Traceback (most recent call last):

z
%s%s
rrc) r3Úexc_infoÚ tracebackræÚ format_tbÚformat_exception_onlyÚhtmlÚescapeÚjoin)rzrmÚtbr�rëryrrrrqs  ÿ þrc Cs\t| ¡ƒ}tƒtdƒtdƒ|D]"}tdt |¡dt ||¡ƒq&tdƒtƒdS)z#Dump the shell environment as HTML.z

Shell Environment:

ú
ú
ú
ú
N)Úsortedrœrærîrï)rArœrirrrrs  rcCs t| ¡ƒ}tƒtdƒ|s&tdƒtdƒ|D]Z}tdt |¡ddd�||}tdt tt|ƒƒ¡d ƒtd t t|ƒ¡ƒq2td ƒtƒd S) z$Dump the contents of a form as HTML.z

Form Contents:

z

No form fields.ròróú:ú )r_zzrôrõN)rörœrærîrïÚreprrz)rérœrirmrrrrŠs rc Csltƒtdƒz t ¡}Wn8tyR}z tdt t|ƒ¡ƒWYd}~nd}~00tt |¡ƒtƒdS)z#Dump the current directory as HTML.z#

Current Working Directory:

zOSError:N)rærâÚgetcwdrrîrïÚstr)ÚpwdÚmsgrrrršs *rcCs(tƒtdƒtƒttjƒtƒdS)Nz

Command Line Arguments:

)rær3r=rrrrr¦s  rcCs tdƒdS)z9Dump a list of environment variables used by CGI as HTML.aØ

These environment variables could have been set:

  • AUTH_TYPE
  • CONTENT_LENGTH
  • CONTENT_TYPE
  • DATE_GMT
  • DATE_LOCAL
  • DOCUMENT_NAME
  • DOCUMENT_ROOT
  • DOCUMENT_URI
  • GATEWAY_INTERFACE
  • LAST_MODIFIED
  • PATH
  • PATH_INFO
  • PATH_TRANSLATED
  • QUERY_STRING
  • REMOTE_ADDR
  • REMOTE_HOST
  • REMOTE_IDENT
  • REMOTE_USER
  • REQUEST_METHOD
  • SCRIPT_NAME
  • SERVER_NAME
  • SERVER_PORT
  • SERVER_PROTOCOL
  • SERVER_ROOT
  • SERVER_SOFTWARE
In addition, HTTP headers sent by the server may be passed in the environment as well. Here are some common variable names:
  • HTTP_ACCEPT
  • HTTP_CONNECTION
  • HTTP_HOST
  • HTTP_PRAGMA
  • HTTP_REFERER
  • HTTP_USER_AGENT
N)rærrrrr­srcCs(ddl}t|tƒrd}nd}| ||¡S)Nrs^[ -~]{0,200}[!-~]$z^[ -~]{0,200}[!-~]$)Úrer6rŠÚmatch)r^rþZ _vb_patternrrrrÀÜs  rÀÚ__main__)rGrHr')NNNN),rwÚ __version__ÚiorrrÚcollections.abcrr3râÚ urllib.parser>Z email.parserrZ email.messagerrîr‡ràÚ__all__rrr rrr&rr9rAr r rar rr r rrrrrrrÀrtrrrrÚ sT   # ÿ F  :'   /