Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/http/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/http/__pycache__/server.cpython-311.opt-2.pyc
�

�,d1���x�	dZgd�ZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlmZdZdZGd�dej��ZGd	�d
eje��ZGd�dej��ZGd
�de��Zd�Z da!d�Z"d�Z#Gd�de��Z$d�Z%eedddfd�Z&e'dkr�ddl(Z(ddl)Z)e(j*��Z+e+�,ddd���e+�,dddd �!��e+�,d"d#ej-��d$�%��e+�,d&d'd(dd)�*��e+�,d+de.d,d-�.��e+�/��Z0e0j1re$Z2neZ2Gd/�d0e��Z3e&e2e3e0j4e0j5e0j6�1��dSdS)2z0.6)�
HTTPServer�ThreadingHTTPServer�BaseHTTPRequestHandler�SimpleHTTPRequestHandler�CGIHTTPRequestHandler�N)�
HTTPStatusaD<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Error response</title>
    </head>
    <body>
        <h1>Error response</h1>
        <p>Error code: %(code)d</p>
        <p>Message: %(message)s.</p>
        <p>Error code explanation: %(code)s - %(explain)s.</p>
    </body>
</html>
ztext/html;charset=utf-8c��eZdZdZd�ZdS)r�c��	tj�|��|jdd�\}}t	j|��|_||_dS)N�)�socketserver�	TCPServer�server_bind�server_address�socket�getfqdn�server_name�server_port)�self�host�ports   �2/opt/alt/python311/lib64/python3.11/http/server.pyrzHTTPServer.server_bind�sQ��<���*�*�4�0�0�0��(��!��,�
��d�!�>�$�/�/��������N)�__name__�
__module__�__qualname__�allow_reuse_addressr�rrrr�s)�������� � � � � rrc��eZdZdZdS)rTN)rrr�daemon_threadsrrrrr�s�������N�N�Nrrc
���eZdZ	dej���dzZdezZe	Z
eZdZ
d�Zd�Zd�Zd�Zd"d
�Zd#d�Zd#d�Zd
�Zd�Zd�Zd$d�Zd�Ze�d�ejed��edd����D����Zdee d��<d�Z!d�Z"d#d�Z#d�Z$gd�Z%gd�Z&d�Z'd Z(e)j*j+Z,d!�e-j.�/��D��Z0d	S)%rzPython/rz	BaseHTTP/�HTTP/0.9c�:�	d|_|jx|_}d|_t	|jd��}|�d��}||_|���}t|��dkrdSt|��dk�r |d}	|�
d��st�|�d	d
��d
}|�d��}t|��dkrt�t|d��t|d
��f}n;#ttf$r'|�tjd
|z��YdSwxYw|dkr|jdkrd|_|dkr%|�tjd|z��dS||_dt|��cxkrdks'n|�tjd|z��dS|dd�\}}t|��dkr2d|_|dkr%|�tjd|z��dS||c|_|_|j�
d��r"d	|j�d	��z|_	t*j�|j|j���|_n�#t*jj$r9}|�tjdt	|����Yd}~dSd}~wt*jj$r9}|�tjdt	|����Yd}~dSd}~wwxYw|j�dd��}	|	���dkrd|_n*|	���dkr|jdkrd|_|j�dd��}
|
���dkr,|jdkr!|jdkr|� ��sdSdS)NTz
iso-8859-1�
rF����zHTTP/�/r
�.rzBad request version (%r))r
r
zHTTP/1.1)rrzInvalid HTTP version (%s)zBad request syntax (%r)�GETzBad HTTP/0.9 request type (%r)z//)�_classz
Line too longzToo many headers�
Connection��close�
keep-alive�Expectz100-continue)!�command�default_request_version�request_version�close_connection�str�raw_requestline�rstrip�requestline�split�len�
startswith�
ValueError�int�
IndexError�
send_errorr�BAD_REQUEST�protocol_version�HTTP_VERSION_NOT_SUPPORTED�path�lstrip�http�client�
parse_headers�rfile�MessageClass�headers�LineTooLong�REQUEST_HEADER_FIELDS_TOO_LARGE�
HTTPException�get�lower�handle_expect_100)r�versionr7�words�base_version_number�version_numberr0rB�err�conntype�expects           r�
parse_requestz$BaseHTTPRequestHandler.parse_requestsn��		����)-�)E�E���w� $����$�.��=�=��!�(�(��0�0��&����!�!�#�#���u�:�:��?�?��5��u�:�:��?�?��B�i�G�
��)�)�'�2�2�%�$�$�&-�m�m�C��&;�&;�A�&>�#�!4�!:�!:�3�!?�!?���~�&�&�!�+�+�$�$�!$�^�A�%6�!7�!7��^�A�=N�9O�9O�!O�����
�+�
�
�
�����*�.��8�:�:�:��u�u�	
����
��'�'�D�,A�Z�,O�,O�(-��%���'�'�����9�/�2E�E�G�G�G��u�#*�D� ��C��J�J�#�#�#�#�!�#�#�#�#��O�O��&�)�K�7�
9�
9�
9��5��b�q�b�	�
����u�:�:��?�?�$(�D�!��%�������*�4�w�>�@�@�@��u�")�4����d�i��9����%�%�	4��d�i�.�.�s�3�3�3�D�I�	��;�4�4�T�Z�<@�<M�5�O�O�D�L�L���{�&�	�	�	��O�O��:���C���
�
�
��5�5�5�5�5������{�(�	�	�	��O�O��:�"��C���
�
�
�
�5�5�5�5�5�����
	�����<�#�#�L�"�5�5���>�>���w�&�&�$(�D�!�!��n�n���,�.�.��#�z�1�1�$)�D�!���!�!�(�B�/�/���L�L�N�N�n�,�,��%��3�3��$�
�2�2��)�)�+�+�
��u��ts7�BD'�'4E�E�0J<�<M�.L�M�.M�Mc�n�	|�tj��|���dS�NT)�send_response_onlyr�CONTINUE�end_headers�rs rrOz(BaseHTTPRequestHandler.handle_expect_100us7��	�	
���
� 3�4�4�4��������trc��		|j�d��|_t|j��dkr6d|_d|_d|_|�tj	��dS|js	d|_
dS|���sdSd|jz}t||��s*|�tj
d|jz��dSt||��}|��|j���dS#t"$r(}|�d|��d|_
Yd}~dSd}~wwxYw)Niir,T�do_zUnsupported method (%r)zRequest timed out: %r)rG�readliner5r9r7r2r0r>r�REQUEST_URI_TOO_LONGr3rW�hasattr�NOT_IMPLEMENTED�getattr�wfile�flush�TimeoutError�	log_error)r�mname�method�es    r�handle_one_requestz)BaseHTTPRequestHandler.handle_one_request�sd��	�	�#'�:�#6�#6�u�#=�#=�D� ��4�'�(�(�5�0�0�#%�� �')��$�!������
� ?�@�@�@����'�
�(,��%����%�%�'�'�
����D�L�(�E��4��'�'�
�����.�-���<�>�>�>����T�5�)�)�F��F�H�H�H��J����������	�	�	��N�N�2�A�6�6�6�$(�D�!��F�F�F�F�F�����		���s1�A+D�0D�D�AD�3D�
E�D<�<Ec��	d|_|���|js|���|j�dSdSrY)r3rlr]s r�handlezBaseHTTPRequestHandler.handle�s]��4� $������!�!�!��'�	&��#�#�%�%�%��'�	&�	&�	&�	&�	&rNc���		|j|\}}n#t$rd\}}YnwxYw|�|}|�|}|�d||��|�||��|�dd��d}|dkr�|t
jt
jt
jfvr�|j	|tj|d���tj|d���d�z}|�d	d
��}|�d|j
��|�dtt|������|���|jd
kr|r|j�|��dSdSdS)N)�???rpzcode %d, message %sr+r-��F��quote)�code�message�explainzUTF-8�replacezContent-Type�Content-Length�HEAD)�	responses�KeyErrorrh�
send_response�send_headerr�
NO_CONTENT�
RESET_CONTENT�NOT_MODIFIED�error_message_format�html�escape�encode�error_content_typer4r9r\r0re�write)rrtrurv�shortmsg�longmsg�body�contents        rr>z!BaseHTTPRequestHandler.send_error�s���	�"	-� $��t� 4��H�g�g���	-�	-�	-� ,��H�g�g�g�	-�����?��G��?��G����,�d�G�<�<�<����4��)�)�)�����w�/�/�/�
���C�K�K���.�#�1�#�0�2�
2�
2�
�0���;�w�e�<�<�<��;�w�e�<�<�<�4�4��G�
�>�>�'�9�5�5�D����^�T�-D�E�E�E����-�s�3�t�9�9�~�~�>�>�>��������<�6�!�!�d�!��J���T�"�"�"�"�"�"�!�!�!s��&�&c��	|�|��|�||��|�d|�����|�d|�����dS)N�Server�Date)�log_requestrZr}�version_string�date_time_string�rrtrus   rr|z$BaseHTTPRequestHandler.send_response�s}��	�	
�����������g�.�.�.�����4�#6�#6�#8�#8�9�9�9������!6�!6�!8�!8�9�9�9�9�9rc��	|jdkrs|�||jvr|j|d}nd}t|d��sg|_|j�d|j||fz�dd����dSdS)Nr"rr,�_headers_bufferz
%s %d %s
�latin-1�strict)r2rzrbr��appendr@r�r�s   rrZz)BaseHTTPRequestHandler.send_response_only�s���,���:�-�-����4�>�)�)�"�n�T�2�1�5�G�G� �G��4�!2�3�3�
*�')��$�� �'�'���*�D�'�:�*;�<B�F�!�8�=-�=-�
.�
.�
.�
.�
.�.�-rc�l�	|jdkrKt|d��sg|_|j�|�d|�d��dd����|���dkrB|���dkr	d	|_dS|���d
krd|_dSdSdS)Nr"r�z: r$r�r��
connectionr-Tr.F)r2rbr�r�r�rNr3)r�keyword�values   rr}z"BaseHTTPRequestHandler.send_headers���7���:�-�-��4�!2�3�3�
*�')��$�� �'�'�!(���%�%�%�0�8�8��H�M�M�
O�
O�
O��=�=�?�?�l�*�*��{�{�}�}��'�'�(,��%�%�%������,�.�.�(-��%�%�%�	+�*�/�.rc�~�	|jdkr0|j�d��|���dSdS)Nr"s
)r2r�r��
flush_headersr]s rr\z"BaseHTTPRequestHandler.end_headerssJ��:���:�-�-�� �'�'��0�0�0���� � � � � �.�-rc��t|d��r;|j�d�|j����g|_dSdS)Nr�r)rbrer��joinr�r]s rr�z$BaseHTTPRequestHandler.flush_headerssR���4�*�+�+�	&��J���S�X�X�d�&:�;�;�<�<�<�#%�D� � � �	&�	&r�-c��	t|t��r|j}|�d|jt|��t|����dS)Nz
"%s" %s %s)�
isinstancerr��log_messager7r4)rrt�sizes   rr�z"BaseHTTPRequestHandler.log_requestsa��	�
�d�J�'�'�	��:�D������)�3�t�9�9�c�$�i�i�	A�	A�	A�	A�	Arc�$�	|j|g|�R�dS�N)r�)r�format�argss   rrhz BaseHTTPRequestHandler.log_error(s*��		�	����'�$�'�'�'�'�'�'rc��i|]	}|d|d����
S)z\x�02xr)�.0�cs  r�
<dictcomp>z!BaseHTTPRequestHandler.<dictcomp>8s"��V�V�V�!�Q�
�a�
�
�
�V�V�Vr� ��z\\�\c	���	||z}tj�|����d|����d|�|j���d���dS)Nz - - [z] �
)�sys�stderrr��address_string�log_date_time_string�	translate�_control_char_table)rr�r�rus    rr�z"BaseHTTPRequestHandler.log_message;s���	�&�4�-���
����-�-�/�/�/�/��3�3�5�5�5�5�!�+�+�D�,D�E�E�E�E�G�	H�	H�	H�	H�	Hrc�(�	|jdz|jzS)N� )�server_version�sys_versionr]s rr�z%BaseHTTPRequestHandler.version_stringUs��8��"�S�(�4�+;�;�;rc�p�	|�tj��}tj�|d���S)NT)�usegmt)�time�email�utils�
formatdate)r�	timestamps  rr�z'BaseHTTPRequestHandler.date_time_stringYs1��N����	���I��{�%�%�i��%�=�=�=rc	��	tj��}tj|��\	}}}}}}}}	}
d||j|||||fz}|S)Nz%02d/%3s/%04d %02d:%02d:%02d)r��	localtime�	monthname)r�now�year�month�day�hh�mm�ss�x�y�z�ss            rr�z+BaseHTTPRequestHandler.log_date_time_string_sZ��<��i�k�k��04��s�0C�0C�-��e�S�"�b�"�a��A�*��T�^�E�*�D�"�b�"�.>�
>���r)�Mon�Tue�Wed�Thu�Fri�Sat�Sun)
N�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�Decc��	|jdS�Nr)�client_addressr]s rr�z%BaseHTTPRequestHandler.address_stringms��(��"�1�%�%r�HTTP/1.0c�,�i|]}||j|jf��Sr)�phrase�description)r��vs  rr�z!BaseHTTPRequestHandler.<dictcomp>|s3�����
�	
�A�H�a�m�$���r)NNr�)r�r�)1rrrr�rPr8r��__version__r��DEFAULT_ERROR_MESSAGEr��DEFAULT_ERROR_CONTENT_TYPEr�r1rWrOrlrnr>r|rZr}r\r�r�rhr4�	maketrans�	itertools�chain�ranger��ordr�r�r�r��weekdaynamer�r�r@rDrE�HTTPMessagerHr�__members__�valuesrzrrrrr�s7������d�N�c�k�/�/�1�1�!�4�4�K�
!�;�.�N�0��3��)��h�h�h�T���$#�#�#�J&�&�&�3#�3#�3#�3#�j:�:�:�:�.�.�.�.�.�.�.�!�!�!�&�&�&�
	A�	A�	A�	A�(�(�(��-�-�V�V��y��u�u�T�{�{�E�E�$�t�DT�DT�'U�'U�V�V�V�X�X��%*����D�	�	�"�H�H�H�4<�<�<�>�>�>�>����D�C�C�K�;�;�;�I�&�&�&�"���;�*�L����'�.�.�0�0����I�I�Irrc�l��eZdZ	dezZddddd�xZZdd��fd	�
Zd
�Zd�Z	d�Z
d
�Zd�Zd�Z
d�Z�xZS)rzSimpleHTTP/zapplication/gzip�application/octet-streamzapplication/x-bzip2zapplication/x-xz)z.gzz.Zz.bz2z.xzN��	directoryc���|�tj��}tj|��|_t	��j|i|��dSr�)�os�getcwd�fspathr��super�__init__)rr�r��kwargs�	__class__s    �rrz!SimpleHTTPRequestHandler.__init__�sG������	���I���9�-�-��������$�)�&�)�)�)�)�)rc���	|���}|rK	|�||j��|���dS#|���wxYwdSr�)�	send_head�copyfilerer-�r�fs  r�do_GETzSimpleHTTPRequestHandler.do_GET�sd��"��N�N�����	�
��
�
�a���,�,�,����	�	�	�	�	�����	�	�	�	����		�	s�A
�
A c�`�	|���}|r|���dSdSr�)rr-rs  r�do_HEADz SimpleHTTPRequestHandler.do_HEAD�s7��#��N�N�����	�
�G�G�I�I�I�I�I�	�	rc�f�	|�|j��}d}tj�|���rCtj�|j��}|j�d��s�|�tj
��|d|d|ddz|d|df}tj�|��}|�d|��|�dd	��|�
��dSd
D]E}tj�||��}tj�|��r|}n�F|�|��S|�|��}|�d��r"|�tjd��dS	t)|d��}n1#t*$r$|�tjd��YdSwxYw	tj|�����}d
|jv�r6d|jv�r,	t2j�|jd
��}	|	j�%|	�t<jj ���}	|	jt<jj ur�t<j�!|j"t<jj ��}
|
�d���}
|
|	krI|�tj#��|�
��|�$��dSn##tJtLtNtPf$rYnwxYw|�tj)��|�d|��|�dtU|d����|�d|�+|j"����|�
��|S#|�$���xYw)Nr'rr
rr%��Locationrx�0)z
index.htmlz	index.htmzFile not found�rbzIf-Modified-Sincez
If-None-Match)�tzinfo)�microsecond�Content-type�z
Last-Modified),�translate_pathrBr��isdir�urllib�parse�urlsplit�endswithr|r�MOVED_PERMANENTLY�
urlunsplitr}r\r��isfile�list_directory�
guess_typer>�	NOT_FOUND�open�OSError�fstat�filenorIr�r��parsedate_to_datetimerrw�datetime�timezone�utc�
fromtimestamp�st_mtimer�r-�	TypeErrorr=�
OverflowErrorr;�OKr4r�)rrBr	�parts�	new_parts�new_url�index�ctype�fs�ims�
last_modifs           rrz"SimpleHTTPRequestHandler.send_head�s���		��"�"�4�9�-�-����
�7�=�=����	1��L�)�)�$�)�4�4�E��:�&�&�s�+�+�	
��"�"�:�#?�@�@�@�"�1�X�u�Q�x��q��C��"�1�X�u�Q�x�1�	� �,�1�1�)�<�<��� � ��W�5�5�5�� � �!1�3�7�7�7�� � �"�"�"��t�2�
1�
1������T�5�1�1���7�>�>�%�(�(�� �D��E���*�*�4�0�0�0�����%�%���=�=����	��O�O�J�0�2B�C�C�C��4�	��T�4� � �A�A���	�	�	��O�O�J�0�2B�C�C�C��4�4�	����'	���!�(�(�*�*�%�%�B�#�t�|�3�3�'�t�|�;�;�(��+�;�;���%8�9�;�;�C��z�)�"�k�k��1B�1F�k�G�G���z�X�%6�%:�:�:�%-�%6�%D�%D��K��):�)>�&@�&@�
�&0�%7�%7�A�%7�%F�%F�
�%��,�,� �.�.�z�/F�G�G�G� �,�,�.�.�.��G�G�I�I�I�#'�4���'"�:�}�j�I�����D�����*
���z�}�-�-�-����^�U�3�3�3����-�s�2�a�5�z�z�:�:�:����_��%�%�b�k�2�2�
4�
4�
4��������H��	�
�G�G�I�I�I����sJ�G�*H
�H
�:P�*M�6CP�P�M4�1P�3M4�4B$P�P0c
��		tj|��}n1#t$r$|�tjd��YdSwxYw|�d����g}	tj�	|j
d���}n/#t$r"tj�	|��}YnwxYwtj
|d���}tj��}d|��}|�d	��|�d
��|�d��|�d|�d
���|�d|�d���|�d|�d���|�d��|D]�}tj
�||��}|x}	}
tj
�|��r
|dz}	|dz}
tj
�|��r|dz}	|�dtj�|
d����d
tj
|	d����d�����|�d��d�|���|d��}t-j��}|�|��|�d��|�tj��|�dd|z��|�dt;t=|������|���|S)NzNo permission to list directoryc�*�|���Sr�)rN)�as r�<lambda>z9SimpleHTTPRequestHandler.list_directory.<locals>.<lambda>s�����	�	�r)�key�
surrogatepass��errorsFrrzDirectory listing for z<!DOCTYPE HTML>z<html lang="en">z<head>z<meta charset="z">z<title>z</title>
</head>z<body>
<h1>z</h1>z	<hr>
<ul>r'�@z
<li><a href="z	</a></li>z</ul>
<hr>
</body>
</html>
r��surrogateescaperrztext/html; charset=%srx) r��listdirr#r>rr!�sortrr�unquoterB�UnicodeDecodeErrorr�r�r��getfilesystemencodingr�r�r�islinkrsr��io�BytesIOr��seekr|r.r}r4r9r\)
rrB�list�r�displaypath�enc�title�name�fullname�displayname�linkname�encodedr	s
             rrz'SimpleHTTPRequestHandler.list_directorys]��	�	��:�d�#�#�D�D���	�	�	��O�O��$�1�
3�
3�
3��4�4�		����
	
�	�	�)�)�	�*�*�*���	5� �,�.�.�t�y�6E�/�G�G�K�K��!�	5�	5�	5� �,�.�.�t�4�4�K�K�K�	5�����k�+�U�;�;�;���'�)�)��6��6�6��	���"�#�#�#�	���#�$�$�$�	�������	���*�3�*�*�*�+�+�+�	���3�5�3�3�3�4�4�4�	���,��,�,�,�-�-�-�	��������
	?�
	?�D��w�|�|�D�$�/�/�H�%)�)�K�(��w�}�}�X�&�&�
&�"�S�j���#�:���w�~�~�h�'�'�
)�"�S�j��
�H�H�H��|�)�)�(�1@�*�B�B�B�B��{�;�e�<�<�<�<�<�>�
?�
?�
?�
?�	
���2�3�3�3��)�)�A�,�,�%�%�c�+<�=�=���J�L�L��	�������	���q�	�	�	����:�=�)�)�)�����)@�3�)F�G�G�G����)�3�s�7�|�|�+<�+<�=�=�=��������s!��*A�A�#&B
�
)B6�5B6c��	|�dd��d}|�dd��d}|����d��}	tj�|d���}n/#t$r"tj�|��}YnwxYwtj|��}|�d��}td|��}|j
}|D]\}tj�
|��s|tjtjfvr�<tj�||��}�]|r|dz
}|S)N�?r
r�#r'r<r=)r8r6rrrrCrD�	posixpath�normpath�filterr�r�rB�dirname�curdir�pardirr�)rrB�trailing_slashrQ�words     rrz'SimpleHTTPRequestHandler.translate_path=sF��	��z�z�#�a� � ��#���z�z�#�a� � ��#�������/�/��4�4��	.��<�'�'��_�'�E�E�D�D��!�	.�	.�	.��<�'�'��-�-�D�D�D�	.�����!�$�'�'���
�
�3�����t�U�#�#���~���	,�	,�D��w���t�$�$�
����B�I�0F�(F�(F���7�<�<��d�+�+�D�D��	��C�K�D��s�"!B�)B0�/B0c�2�	tj||��dSr�)�shutil�copyfileobj)r�source�
outputfiles   rrz!SimpleHTTPRequestHandler.copyfile[s"��	�	��6�:�.�.�.�.�.rc���	tj|��\}}||jvr
|j|S|���}||jvr
|j|St	j|��\}}|r|SdS)Nr�)rW�splitext�extensions_maprN�	mimetypesr )rrB�base�ext�guess�_s      rr z#SimpleHTTPRequestHandler.guess_typeks���	��&�t�,�,�	��c��$�%�%�%��&�s�+�+��i�i�k�k���$�%�%�%��&�s�+�+��'��-�-���q��	��L�)�)r)rrrr�r�rf�_encodings_map_defaultrr
rrrrrr �
__classcell__�rs@rrr�s��������	�#�[�0�N�!�(�%�!�	/�/��N�+�)-�*�*�*�*�*�*�*�������V�V�V�p7�7�7�r���</�/�/� *�*�*�*�*�*�*rrc�@�	|�d��\}}}tj�|��}|�d��}g}|dd�D]:}|dkr|����|r|dkr|�|���;|r<|���}|r%|dkr|���d}n|dkrd}nd}|rd�||f��}dd�|��z|f}d�|��}|S)NrUr'r&z..r(r,)�	partitionrrrCr8�popr�r�)	rBrk�query�
path_parts�
head_parts�part�	tail_part�	splitpath�collapsed_paths	         r�_url_collapse_pathry�sJ����^�^�C�(�(�N�D�!�U��<����%�%�D����C���J��J��3�B�3��&�&���4�<�<��N�N�����
�	&�d�c�k�k����t�%�%�%���	��N�N�$�$�	��	��D� � ���� � � ��	�	��c�!�!��	���	��1��H�H�i��/�0�0�	��s�x�x�
�+�+�+�Y�7�I��X�X�i�(�(�N��rc��	trtS	ddl}n#t$rYdSwxYw	|�d��dan>#t$r1dtd�|���D����zaYnwxYwtS)Nrr&�nobodyrr
c3�&K�|]}|dV��
dS)rNr)r�r�s  r�	<genexpr>znobody_uid.<locals>.<genexpr>�s&����6�6�!��1��6�6�6�6�6�6r)r{�pwd�ImportError�getpwnamr{�max�getpwall)r~s r�
nobody_uidr��s���.�
���
���
�
�
�
�������r�r�����7����h�'�'��*�����7�7�7��S�6�6�s�|�|�~�~�6�6�6�6�6�6����7�����Ms��
$�$�A�8A?�>A?c�B�	tj|tj��Sr�)r��access�X_OK)rBs r�
executabler��s��#�
�9�T�2�7�#�#�#rc�X�eZdZ	eed��ZdZd�Zd�Zd�Z	ddgZ
d�Zd	�Zd
�Z
dS)r�forkrc��	|���r|���dS|�tjd��dS)NzCan only POST to CGI scripts)�is_cgi�run_cgir>rrcr]s r�do_POSTzCGIHTTPRequestHandler.do_POST�sS��	��;�;�=�=�	0��L�L�N�N�N�N�N��O�O��*�.�
0�
0�
0�
0�
0rc��	|���r|���St�|��Sr�)r�r�rrr]s rrzCGIHTTPRequestHandler.send_head�s7��;��;�;�=�=�	<��<�<�>�>�!�+�5�5�d�;�;�;rc�:�	t|j��}|�dd��}|dkrA|d|�|jvr0|�d|dz��}|dkr|d|�|jv�0|dkr"|d|�||dzd�}}||f|_dSdS)Nr'r
rTF)ryrB�find�cgi_directories�cgi_info)rrx�dir_sep�head�tails     rr�zCGIHTTPRequestHandler.is_cgi�s���
	�,�D�I�6�6�� �%�%�c�1�-�-����k�k�.��'��":�d�>R�"R�"R�$�)�)�#�w�q�y�9�9�G���k�k�.��'��":�d�>R�"R�"R��Q�;�;�'����1�>�'�!�)�*�*�3M�$�D� �$�J�D�M��4��urz/cgi-binz/htbinc�"�	t|��Sr�)r�)rrBs  r�
is_executablez#CGIHTTPRequestHandler.is_executables��?��$���rc�t�	tj�|��\}}|���dvS)N)z.pyz.pyw)r�rBrerN)rrBr�r�s    r�	is_pythonzCGIHTTPRequestHandler.is_pythons1��<��W�%�%�d�+�+�
��d��z�z�|�|��.�.rc�R�	|j\}}|dz|z}|�dt|��dz��}|dkr}|d|�}||dzd�}|�|��}tj�|��r+||}}|�dt|��dz��}nn|dk�}|�d��\}}}	|�d��}|dkr|d|�||d�}}
n|d}}
|dz|
z}|�|��}tj�|��s%|�	tjd|z��dStj�|��s%|�	tj
d|z��dS|�|��}
|js|
s:|�|��s%|�	tj
d|z��dSt#jtj��}|���|d	<|jj|d
<d|d<|j|d
<t1|jj��|d<|j|d<t6j�|��}||d<|�|��|d<||d<|	|d<|jd|d<|j� d��}|r�|�!��}t|��dkr�ddl"}ddl#}|d|d<|d�$��dkr�	|d�%d��}|�&|���'d��}|�!d��}t|��dkr|d|d<n#|j(tRf$rYnwxYw|j� d���|j�*��|d<n|jd|d<|j� d��}|r||d<|j� d ��}|r||d!<|j�+d"d#��}d$�,|��|d%<|j� d&��}|r||d'<t[d|j�+d(g����}d)�,|��}|r||d*<d+D]}|�.|d���|�/tj0d,��|�1��|	�2d-d.��}|j�r�|
g}d/|vr|�3|��ti��}|j5�6��t	j7��}|dkr�t	j8|d��\}}tsj9|j:gggd��dr>|j:�;d��sn#tsj9|j:gggd��d�>t	j<|��}|r|�=d0|����dS		t	j>|��n#t~$rYnwxYwt	j@|j:�A��d��t	j@|j5�A��d��t	jB|||��dS#|j�C|jD|j��t	jEd1��YdSxYwddlF} |g}!|�|��rOt�jH}"|"�$���Id2��r|"dd3�|"d4d�z}"|"d5g|!z}!d/|	vr|!�3|	��|�Jd6| �K|!����	t�|��}#n#t�t�f$rd}#YnwxYw| �O|!| jP| jP| jP|�7��}$|j�$��d8kr!|#dkr|j:�;|#��}%nd}%tsj9|j:jQgggd��drH|j:jQ�Rd��sn(tsj9|j:jQgggd��d�H|$�S|%��\}&}'|j5�T|&��|'r|�=d9|'��|$jU�V��|$jW�V��|$jX}(|(r|�=d:|(��dS|�Jd;��dS)<Nr'r
rrUr,zNo such CGI script (%r)z#CGI script is not a plain file (%r)z!CGI script is not executable (%r)�SERVER_SOFTWARE�SERVER_NAMEzCGI/1.1�GATEWAY_INTERFACE�SERVER_PROTOCOL�SERVER_PORT�REQUEST_METHOD�	PATH_INFO�PATH_TRANSLATED�SCRIPT_NAME�QUERY_STRING�REMOTE_ADDR�
authorizationr�	AUTH_TYPE�basic�ascii�:�REMOTE_USERzcontent-type�CONTENT_TYPEzcontent-length�CONTENT_LENGTH�referer�HTTP_REFERER�acceptr�,�HTTP_ACCEPTz
user-agent�HTTP_USER_AGENT�cookiez, �HTTP_COOKIE)r��REMOTE_HOSTr�r�r�r�zScript output follows�+r��=zCGI script exit code r�zw.exe������z-uzcommand: %s)�stdin�stdoutr��env�postz%szCGI script exit status %#xzCGI script exited OK)Yr�r�r9rr�rBrrp�existsr>rr!r�	FORBIDDENr��	have_forkr��copy�deepcopy�environr��serverrr@r4rr0rrrCr�rIrMr8�base64�binasciirNr��decodebytes�decode�Error�UnicodeError�get_content_type�get_allr�rY�
setdefaultr|r.r�rwr�r�rerfr��waitpid�selectrG�read�waitstatus_to_exitcoderh�setuidr#�dup2r%�execve�handle_error�request�_exit�
subprocessr�r�rr��list2cmdliner<r,r;�Popen�PIPE�_sock�recv�communicater�r�r-r��
returncode))r�dir�restrB�i�nextdir�nextrest�	scriptdirrkrr�script�
scriptname�
scriptfile�ispyr��uqrestr�r�r��lengthr�r��ua�co�
cookie_str�k�
decoded_queryr�r{�pid�sts�exitcoder��cmdline�interp�nbytes�p�datar�r��statuss)                                         rr�zCGIHTTPRequestHandler.run_cgis
��#��M�	��T��S�y�4����I�I�c�3�s�8�8�A�:�&�&���1�f�f��2�A�2�h�G��A�a�C�D�D�z�H��+�+�G�4�4�I��w�}�}�Y�'�'�
�#�X�T���I�I�c�3�s�8�8�A�:�.�.�����1�f�f�����,�,���a��
�I�I�c�N�N����6�6�����8�T�!�"�"�X�D�F�F���D�F��3�Y��'�
��(�(��4�4�
��w�~�~�j�)�)�	��O�O��$�)�J�6�
8�
8�
8�
�F��w�~�~�j�)�)�	��O�O��$�5�
�B�
D�
D�
D�
�F��~�~�j�)�)���>�	��	��%�%�j�1�1�
�����(�7�*�D�F�F�F����m�B�J�'�'��!%�!4�!4�!6�!6����!�[�4��M��#,��� �!%�!6���� ���!8�9�9��M�� $�������%�%�d�+�+��!��K��!%�!4�!4�V�!<�!<����'��M��#��N��!�0��3��M����(�(��9�9�
��	B�)�/�/�1�1�M��=�!�!�Q�&�&�'�'�'�'�'�'�'�'�#0��#3��K� � ��#�)�)�+�+�w�6�6�	B�(5�a�(8�(?�(?��(H�(H�
�(.�(:�(:�=�(I�(I�(.��w���&�
)6�(;�(;�C�(@�(@�
��}�-�-��2�2�1>�q�1A�C�
�.���%�N�L�9�����������<���N�+�+�3�"&�,�"?�"?�"A�"A�C����"&�,�~�">�C�����!�!�"2�3�3���	+�$*�C� �!��,�"�"�9�-�-���	*�")�C�����%�%�h��3�3�� �X�X�f�-�-��M��
�\�
�
�l�
+�
+��
�	(�%'�C�!�"�
�D�$�,�.�.�x��<�<�
=�
=���Y�Y�r�]�]�
��	,�!+�C�
��D�	"�	"�A��N�N�1�b�!�!�!�!����:�=�*A�B�B�B��������
�
�c�3�/�/�
��>�I	9��8�D��-�'�'����M�*�*�*��\�\�F��J�������'�)�)�C��a�x�x��:�c�1�-�-���S��m�T�Z�L�"�b�!�<�<�Q�?���:�?�?�1�-�-����m�T�Z�L�"�b�!�<�<�Q�?���4�S�9�9���G��N�N�#E�8�#E�#E�F�F�F���

���I�f�%�%�%�%�������D��������
�)�)�+�+�Q�/�/�/����
�)�)�+�+�Q�/�/�/��	�*�d�C�0�0�0�0�0��
���(�(���t�7J�K�K�K����
�
�
�
�
�
����
����!�l�G��~�~�j�)�)�
3�����<�<�>�>�*�*�7�3�3�7�#�C�R�C�[�6�"�#�#�;�6�F�!�4�.�7�2���%������u�%�%�%����]�J�,C�,C�G�,L�,L�M�M�M�
��V�������z�*�
�
�
�����
����� � ��'1��(2��(2��'*�	!�#�#�A��|�!�!�#�#�v�-�-�&�1�*�*��z���v�.�.������-���!1� 2�B��A�>�>�q�A�
��z�'�,�,�Q�/�/����-���!1� 2�B��A�>�>�q�A�
��]�]�4�0�0�N�F�F��J���V�$�$�$��
-����t�V�,�,�,�
�H�N�N����
�H�N�N�����\�F��
9����;�V�D�D�D�D�D�� � �!7�8�8�8�8�8sP�AO�O�O�/Z�\�
Z�\�Z�A1\�;]�3`�`�`N)rrrrbr�r��rbufsizer�rr�r�r�r�r�rrrrr�s�����������F�#�#�I��H�0�0�0�<�<�<����4"�8�,�O� � � �/�/�/�
x9�x9�x9�x9�x9rrc��tj|tjtjd��}t	t|����\}}}}}||fS)N)�type�flags)r�getaddrinfo�SOCK_STREAM�
AI_PASSIVE�next�iter)�address�infos�familyr��proto�	canonname�sockaddrs       r�_get_best_familyr
�sS����	�
�
���
�
�
�E�
04�D��K�K�/@�/@�,�F�D�%��H��8��rr�i@c��	t||��\|_}||_|||��5}|j���dd�\}}d|vrd|�d�n|}td|�d|�d|�d|�d�	��	|���n3#t$r&td	��tj	d
��YnwxYwddd��dS#1swxYwYdS)Nrr��[�]zServing HTTP on z port z	 (http://z/) ...z&
Keyboard interrupt received, exiting.r)
r
�address_familyr@r�getsockname�print�
serve_forever�KeyboardInterruptr��exit)	�HandlerClass�ServerClass�protocolr�bind�addr�httpdr�url_hosts	         r�testr�sw���
(8��d�'C�'C�$�K���$,�L�!�	��T�<�	(�	(��E��\�-�-�/�/����3�
��d�"%��+�+�;�t�;�;�;�;�4��
�
/�t�
/�
/�4�
/�
/��
/�
/�"&�
/�
/�
/�	
�	
�	
�	����!�!�!�!�� �	�	�	��;�<�<�<��H�Q�K�K�K�K�K�	������������������������s6�A
C�;B�C�-C�=C�?C�C�C�C�__main__z--cgi�
store_truezrun as CGI server)�action�helpz-bz--bind�ADDRESSz.bind to this address (default: all interfaces))�metavarrz-dz--directoryz1serve this directory (default: current directory))�defaultrz-pz
--protocol�VERSIONz3conform to this HTTP version (default: %(default)s))r!r"rrrUz(bind to this port (default: %(default)s))r"r��nargsrc�$��eZdZ�fd�Zd�Z�xZS)�DualStackServerc���tjt��5|j�tjtjd��ddd��n#1swxYwYt�����Sr�)	�
contextlib�suppress�	Exceptionr�
setsockopt�IPPROTO_IPV6�IPV6_V6ONLYrr)rrs �rrzDualStackServer.server_binds�����$�Y�/�/�
@�
@���&�&��'��);�Q�@�@�@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@�
@����
@�
@�
@�
@��7�7�&�&�(�(�(s�1A�A�Ac�L�|�|||tj���dS)Nr�)�RequestHandlerClassr�r�)rr�r�s   r�finish_requestzDualStackServer.finish_requests4���$�$�W�n�d�/3�~�
%�
?�
?�
?�
?�
?r)rrrrr0rmrns@rr&r&sG�������	)�	)�	)�	)�	)�	?�	?�	?�	?�	?�	?�	?rr&)rrrrr)7r��__all__r�r'�email.utilsr�r��http.clientrDrGr�rgr�rWr�r`rr
r�r��urllib.parserrr�r�rr�ThreadingMixInr�StreamRequestHandlerrrryr{r�r�rr
rr�argparser(�ArgumentParser�parser�add_argumentr�r<�
parse_argsr��cgi�
handler_classr&rrrrrr�<module>r>s����d������
��������������������	�	�	�	���������	�	�	�	�����
�
�
�
�
�
�
�
�
�
�
�
�����
�
�
�
����������������� 7��	 �	 �	 �	 �	 ��'�	 �	 �	 ������,�5�z����m�m�m�m�m�\�>�m�m�m�`@*�@*�@*�@*�@*�5�@*�@*�@*�J,�,�,�`
��
�
�
� $�$�$�
C9�C9�C9�C9�C9�4�C9�C9�C9�L���-�(��4�d�����.�z����O�O�O�����
$�X�
$�
&�
&�F�
�����0��2�2�2�
����h�	�9��:�:�:�����m�Y�R�Y�[�[�<��=�=�=�����l�I� *�6��7�7�7������3�c�6��7�7�7������D��x�1�-�
�
�0�
�?�?�?�?�?�-�?�?�?�	�D�"�#�
�Y�
�Y���������Q�r

ZeroDay Forums Mini