403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/flup/server/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/flup/server/__pycache__/scgi_base.cpython-311.pyc
�

#H\a�H���dZdZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZdgZGd�de��ZdZej��Ze�ej��e�ejdd	����eje���e��[Gd
�de��Zd�Zd
�ZGd�de��ZGd�de��Z Gd�de��Z!Gd�de��Z"dS)zAllan Saddi <allan@saddi.com>z
$Revision$�N�BaseSCGIServerc��eZdZdS)�	NoDefaultN)�__name__�
__module__�__qualname__���7/usr/lib/python3/dist-packages/flup/server/scgi_base.pyrr0s�������Dr
rz	scgi-wsgiz%(asctime)s : %(message)sz%Y-%m-%d %H:%M:%Sc��eZdZdZdS)�
ProtocolErrorz�
    Exception raised when the server does something unexpected or
    sends garbled data. Usually leads to a Connection closing.
    N)rrr�__doc__r	r
rr
r
>s��������	�Dr
r
c�b�g}d}|r�	|�|��}nI#tj$r7}|jtjkrtj|ggg��Yd}~�Y�d}~wwxYw|sn0|�|��t|��}||z
}||z}|��d�|��|fS)z~
    Attempts to receive length bytes from a socket, blocking if necessary.
    (Socket may be blocking or non-blocking.)
    rN�)	�recv�socket�error�errno�EAGAIN�select�append�len�join)�sock�length�dataList�recvLen�data�e�dataLens       r�recvallr!Es���
�H��G�
��	��9�9�V�$�$�D�D���|�	�	�	��w�%�,�&�&��
�t�f�b�"�-�-�-�����������	�����	����������d�)�)���7����'������7�7�8���g�%�%s��A$�,A�A�A$c��d}		|�d��}nI#tj$r7}|jtjkrtj|ggg��Yd}~�X�d}~wwxYw|dkrn|st�||z
}�v	t|��}|dkrt�n#t$rtd���wxYwt||��\}}||krt�t|d��\}}|dkrt�|dkrtd	���|S)
z4
    Attempt to read a netstring from a socket.
    rT�N�:rzinvalid netstring length�,zinvalid netstring trailer)rrrrrr�EOFError�int�
ValueErrorr
r!)r�size�cr�sr�trailers       r�
readNetstringr-]sR��
�D�
�	��	�	�!���A�A���|�	�	�	��w�%�,�&�&��
�t�f�b�"�-�-�-�����������	����
��8�8���	��N���	��
� 8��4�y�y���!�8�8������8�8�8��6�7�7�7�8������d�#�#�I�A�v�
��}�}����d�A�&�&�O�G�V�
��z�z����#�~�~��7�8�8�8��Hs&��A!�,A�A�A!�;B�B2c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�
StdoutWrapperzN
    Wrapper for sys.stdout so we know if data has actually been written.
    c�"�||_d|_dS)NF)�_file�dataWritten)�self�stdouts  r�__init__zStdoutWrapper.__init__�s����
� ����r
c�L�|rd|_|j�|��dS)NT)r2r1�write)r3rs  rr7zStdoutWrapper.write�s.���	$�#�D���
��������r
c�:�|D]}|�|���dS�N)r7)r3�lines�lines   r�
writelineszStdoutWrapper.writelines�s0���	�	�D��J�J�t�����	�	r
c�,�t|j|��Sr9)�getattrr1)r3�names  r�__getattr__zStdoutWrapper.__getattr__�s���t�z�4�(�(�(r
N)rrrrr5r7r<r@r	r
rr/r/�sZ��������!�!�!����
���)�)�)�)�)r
r/c��eZdZdZd�Zd�ZdS)�Requestz�
    Encapsulates data related to a single request.

    Public attributes:
      environ - Environment variables from web server.
      stdin - File-like object representing the request body.
      stdout - File-like object for writing the response.
    c��||_||_||_t|��|_tjt��|_dSr9)	�_conn�environ�stdinr/r4�logging�	getLogger�
LoggerName�logger)r3�connrE�input�outputs     rr5zRequest.__init__�s<����
������
�#�F�+�+����'�
�3�3����r
c	���|j�d|jd|j�dd��|j�dd����tj���}	|jj�|��nL#|j�	d��|j
js|jj�|��YnxYwtj���}||z
}|j�
d|jd|j�dd��|j�dd��|j|jdzz��dS)	Nz%s %s%s�REQUEST_METHOD�SCRIPT_NAMEr�	PATH_INFOzException caught from handlerz%s %s%s done (%.3f secs)g��.A)rJ�inforE�get�datetime�nowrD�server�handler�	exceptionr4r2r�debug�seconds�microseconds)r3�start�end�handlerTimes    r�runzRequest.run�sf���������&6�7���)�)�-��<�<���)�)�+�r�:�:�	<�	<�	<�
�!�%�%�'�'��	.��J��%�%�d�+�+�+�+��	.��K�!�!�"A�B�B�B��;�*�
.��
�!�'�'��-�-�-��������#�#�%�%���E�k������4��,�'7�8��,�*�*�=�"�=�=��,�*�*�;��;�;�%�-�%�2�Y�>�?�		@�	@�	@�	@�	@s
�:B�AC#N)rrrrr5r_r	r
rrBrB�sA��������4�4�4�@�@�@�@�@r
rBc�$�eZdZdZd�Zd�Zd�ZdS)�
Connectionz�
    Represents a single client (web server) connection. A single request
    is handled, after which the socket is closed.
    c�l�||_||_||_tjt
��|_dSr9)�_sock�_addrrVrGrHrIrJ)r3r�addrrVs    rr5zConnection.__init__�s-����
���
�����'�
�3�3����r
c�f�t|j��dkr2|j�d|jd|jd��	|���nm#t
tf$rYnZt$r2}|j�dt|����Yd}~n$d}~w|j�
d��YnxYwt|j��dkr2|j�d|jd|jd��|j���dS)N�zConnection starting up (%s:%d)rr#zProtocol error '%s'zException caught in Connectionz Connection shutting down (%s:%d))
rrdrJrY�processInputr&�KeyboardInterruptr
r�strrXrc�close)r3rs  rr_zConnection.run�sC���t�z�?�?�a����K���>�"�j��m�T�Z��]�
<�
<�
<�	D����������+�,�	�	�	��D��	=�	=�	=��K���3�S��V�V�<�<�<�<�<�<�<�<�����	D��K�!�!�"B�C�C�C�C�C�����t�z�?�?�a����K���@�"�j��m�T�Z��]�
<�
<�
<�	
�
�������s�A!�!C�4	C�=(B*�*Cc�T�t|j��}|�d��dd�}t|��dzdkrt	d���i}tt|��dz��D]}|d|zdz||d|z<�|�d��}|�t	d���	t|��}|dkrt�n#t$rt	d	���wxYw|j�	d��|r|j�
d
��}ntj��}|j�
d��}t||||��}|�
��|���|���dS)N����rgrzinvalid headersr#�CONTENT_LENGTHzmissing CONTENT_LENGTHzinvalid CONTENT_LENGTH�r�w)r-rc�splitrr
�rangerSr'r(�setblocking�makefile�StringIOrBr_rk)r3�headersrE�i�clenrLrM�reqs        rrhzConnection.processInput�s�����
�+�+���-�-��'�'����,���w�<�<�!��q� � �� 1�2�2�2����s�7�|�|�a�'�(�(�	3�	3�A�$+�A�a�C��E�N�G�G�A�a�C�L�!�!��{�{�+�,�,���<�� 8�9�9�9�	:��t�9�9�D��a�x�x� � ����	:�	:�	:�� 8�9�9�9�	:����	
�
���q�!�!�!��	(��J�'�'��,�,�E�E��%�'�'�E���$�$�S�)�)���d�G�U�F�3�3��	���	�	�	�������
���
�
�
�
�
s�<C�C3N)rrrrr5r_rhr	r
rrara�sK��������4�4�4����*%�%�%�%�%r
rac	�Z�eZdZeZedddddeejdf	d�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�ZdS)rNTF)�	localhosti�c�D�|�i}||_||_||_||_||_|
|_||_||_|turdg}||_	tj��|_tjt��|_|j�|	��dS)a$
        scriptName is the initial portion of the URL path that "belongs"
        to your application. It is used to determine PATH_INFO (which doesn't
        seem to be passed in). An empty scriptName means your application
        is mounted at the root of your virtual host.

        environ, which must be a dictionary, can contain any additional
        environment variables you want to pass to your application.

        Set multithreaded to False if your application is not thread-safe.

        Set multiprocess to True to explicitly set wsgi.multiprocess to
        True. (Only makes sense with threaded servers.)

        bindAddress is the address to bind to, which must be a string or
        a tuple of length 2. If a tuple, the first element must be a string,
        which is the host name or IPv4 address of a local interface. The
        2nd element of the tuple is the port number. If a string, it will
        be interpreted as a filename and a UNIX socket will be opened.

        If binding to a UNIX socket, umask may be set to specify what
        the umask is to be changed to before the socket is created in the
        filesystem. After the socket is created, the previous umask is
        restored.
        
        allowedServers must be None or a list of strings representing the
        IPv4 addresses of servers allowed to connect. None means accept
        connections from anywhere. By default, it is a list containing
        the single item '127.0.0.1'.

        loggingLevel sets the logging level of the module-level logger.
        Nz	127.0.0.1)�application�
scriptNamerE�
multithreaded�multiprocessrY�_bindAddress�_umaskr�_allowedServers�thread�
allocate_lock�_appLockrGrHrIrJ�setLevel)r3r~rrEr�r��bindAddress�umask�allowedServers�loggingLevelrYs           rr5zBaseSCGIServer.__init__s���J�?��G�&���$������*���(�����
�'�������Y�&�&�)�]�N�-����,�.�.��
��'�
�3�3�������\�*�*�*�*�*r
c���d}t|j��turutjtjtj��}	t
j|j��n#t$rYnwxYw|j	�t
j
|j	��}n�t|j��tusJ�t|j��dksJ�tjtj
tj��}|�tjtjd��|�|j��|�tj��|�t
j
|��|S)z?Creates and binds the socket for communication with the server.Nrgr#)�typer�rjr�AF_UNIX�SOCK_STREAM�os�unlink�OSErrorr�r��tupler�AF_INET�
setsockopt�
SOL_SOCKET�SO_REUSEADDR�bind�listen�	SOMAXCONN)r3�oldUmaskrs   r�_setupSocketzBaseSCGIServer._setupSocketOs9������!�"�"�c�)�)��=����1C�D�D�D�
��	�$�+�,�,�,�,���
�
�
���
�����{�&��8�D�K�0�0�����)�*�*�e�3�3�3�3��t�(�)�)�Q�.�.�.�.��=����1C�D�D�D��O�O�F�-�v�/B�A�F�F�F��	�	�$�#�$�$�$����F�$�%�%�%����H�X�����s�A"�"
A/�.A/c�.�|���dS)zCloses the main socket.N)rk)r3rs  r�_cleanupSocketzBaseSCGIServer._cleanupSocketjs���
�
�����r
c���|jdup4t|��dkp!t|��dko|d|jv}|s!|j�d|d��|S)Nrgrz$Server connection from %s disallowed)r�rrJ�warning)r3re�rets   r�_isClientAllowedzBaseSCGIServer._isClientAllowedns|���"�d�*�C��$�i�i�1�n�C��4�y�y�A�~�A�$�q�'�T�-A�"A�	��	)��K��� F� $�Q��
)�
)�
)��
r
c������	��j}|�|j��d|d<�j|d<tj|d<|j|d<|j|d<d|d<|�d	d
��dvrd|d
<nd|d
<|�|��g�g�d�����fd��	d���	fd�	}|js|j	�
��		|�||���	�D]}|r�	|����s�	d��t�d��r��
��n*#t�d��r��
��wwxYwn2#tj$r }|jt jkr�Yd}~nd}~wwxYw|js|j	���dSdS#|js|j	���wwxYw)z~
        WSGI handler. Sets up WSGI environment, calls the application,
        and sends the application's response.
        )r#rzwsgi.versionz
wsgi.inputzwsgi.errorszwsgi.multithreadzwsgi.multiprocessFz
wsgi.run_once�HTTPS�off)�on�1�httpszwsgi.url_scheme�httpNc�2��t|��tus
Jd����s
Jd����s��x\}}�dd�<d}|D]!\}}|���dkrd}n�"|sO�
�M	t�
��dkr1|�dtt|����f��n#YnxYwd|z}|D]
}|d	|zz
}�|d
z
}�	j�|���	j�|���	j���dS)Nzwrite() argument must be stringzwrite() before start_response()Fzcontent-lengthTr#zContent-LengthzStatus: %s
z%s: %s
z
)r�rj�lowerrrr4r7�flush)r�status�responseHeaders�found�header�valuer+�headers_sent�headers_set�request�results       ����rr7z%BaseSCGIServer.handler.<locals>.write�sr�����:�:��$�$�$�&G�$�$�$��A�A� A�A�A�A��
(�<G�G�'���,�q�q�q�/���$3���L�F�5��|�|�~�~�)9�9�9� $����:����!3���v�;�;�!�+�+�+�2�2�4D�47��D�	�	�N�N�4D�E�E�E���������$�v�-��-�/�/�F����.�.�A�A��V�����$�$�Q�'�'�'��N� � ��&�&�&��N� � �"�"�"�"�"s
�'AB,�,B0c�x��|r>	�r0|d|d���|d���	d}n#d}wxYw�r
Jd���t|��tus
Jd���t|��dks
Jd���t	|dd���s
Jd	���|dd
ks
Jd���t|��t
us
Jd���	|D]K\}}t|��tus
Jd|z���t|��tus
Jd|z����L||g�dd�<�S)Nrr#rgzHeaders already set!zStatus must be a string�z$Status must be at least 4 characters�z#Status must begin with 3-digit code� z#Status must have a space after codezHeaders must be a listTz!Header name "%s" must be a stringz%Value of header "%s" must be a string)�with_tracebackr�rjrr'�list)r��response_headers�exc_infor?�valr�r�r7s     ���r�start_responsez.BaseSCGIServer.handler.<locals>.start_response�s�����
?�$�#�S�)�h�q�k�(�1�+�6�6�E�E�h�q�k�R�R�R�S� $�H�H��t�H�O�O�O�O�&�>�>�(>�>�>�>���<�<�3�&�&�&�(A�&�&�&��v�;�;�!�#�#�#�%K�#�#�#��v�b�q�b�z�?�?�I�I�$I�I�I�I��!�9��#�#�#�%J�#�#�#��(�)�)�T�1�1�1�3K�1�1�1�
\� 0�\�\�H�D����:�:��,�,�,�.Q�TX�.X�,�,�,���9�9��+�+�+�-T�W[�-[�+�+�+�+�$�&6�7�K����N��Ls�2;�?rrkr9)rE�updaterF�sys�stderrr�r�rS�_sanitizeEnvr��acquirer~�hasattrrkrrr�EPIPE�release)
r3r�rEr�rrr�r�r�r7s
 `    @@@@rrWzBaseSCGIServer.handlerws|�������
�/�����t�|�$�$�$�"'���� '�
����!$���
��&*�&8��"�#�'+�'8��#�$�#(��� ��;�;�w��&�&�+�5�5�)0�G�%�&�&�)/�G�%�&����'�"�"�"�������	#�	#�	#�	#�	#�	#�	#�	#�6	�	�	�	�	�	�	�	�0�!�	$��M�!�!�#�#�#�	(�

��)�)�'�>�B�B��'� &�(�(���(�!�E�$�K�K�K��'�"���b�	�	�	��v�w�/�/�'����������v�w�/�/�'��������'�������<�
�
�
��7�e�k�)�)��*�)�)�)�)�����
�����%�
(��
�%�%�'�'�'�'�'�
(�
(��4�%�
(��
�%�%�'�'�'�'�
(���sH�E�%D)�%E�)'E�E�F*�F�#E>�9F*�>F�F*�*#G
c���d}d|vr|d�dd��}d|vs|ds&|�t|��dkr|d|d<nd|d<|�d��}|�|j}n4t	jdt��|���d	krd}|�dS|tur-d
|vrd|d<d|vs|ds|�
|d
|d<dSd|d<dSdSt	jdt��|d
}||�dd��z
}|�	|��s|j
�d��|t|��d�|d<||d
<dS)z)Fill-in/deduce missing values in environ.N�REQUEST_URI�?r#�QUERY_STRINGr�WSGI_SCRIPT_NAMEzDWSGI_SCRIPT_NAME environment variable for scgi servers is deprecated�nonerP�SCRIPT_INFOrQrzConfigured SCRIPT_NAME is deprecated
Do not use WSGI_SCRIPT_NAME or the scriptName
keyword parameter -- they will be going awayz%scriptName does not match request URI)rrrrSr�warnings�warn�DeprecationWarningr�r�
startswithrJr�)r3rE�reqUrirr�s     rr�zBaseSCGIServer._sanitizeEnv�s������G�#�#��]�+�1�1�#�q�9�9�F���(�(���0G�(��!�c�&�k�k�A�o�o�*0��)���'�'�*,���'��[�[�!3�4�4�
�����J�J��M�2�,�
.�
.�
.����!�!�V�+�+�!�
����F���"�"� �G�+�+�)+��
�&��'�)�)���1E�)��%�+1�!�9�G�K�(�(�(�+-�G�K�(�(�(�	*�)�
�M�I�-�
.�
.�
.�
�M�*�E��W�[�[��b�1�1�1�E��#�#�J�/�/�
M���#�#�$K�L�L�L�#(��Z���)9�)9�#:�G�K� �%/�G�M�"�"�"r
c���|jrGddl}|j�d|�tj����z��dSd}|j�d|z��dS)z�
        Override to provide custom error handling. Ideally, however,
        all errors should be caught at the application level.
        rNzContent-Type: text/html

z�<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>Unhandled Exception</title>
</head><body>
<h1>Unhandled Exception</h1>
<p>An unhandled exception was thrown by the application.</p>
</body></html>
)rY�cgitbr4r7�htmlr�r�)r3r�r��	errorpages    rrzBaseSCGIServer.error
s���
�:�	,��L�L�L��N� � �!B�!&���C�L�N�N�!;�!;�"<�
=�
=�
=�
=�
=��I�
�N� � �!B�!*�"+�
,�
,�
,�
,�
,r
)rrrrB�requestClassrrG�INFOr5r�r�r�rWr�rr	r
rrrs��������L�/8�$�#�%�0�� )�%�l�$�	8+�8+�8+�8+�t���6������`(�`(�`(�D20�20�20�h,�,�,�,�,r
)#�
__author__�__version__r�rGrrr�	cStringIOrv�signalrTr�r�r��	threading�__all__�objectrrI�
StreamHandler�consoler��DEBUG�setFormatter�	FormatterrH�
addHandler�	Exceptionr
r!r-r/rBrarr	r
r�<module>r�sQ��6-�
���
�
�
�
�����
�
�
�
�
�
�
�
���������
�
�
�
�����	�	�	�	������
�
�
������
��	�	�	�	�	��	�	�	��
� �'�
�
!�
!�������������&�W�&�'B�':�<�<�=�=�=����*���(�(��1�1�1��	�	�	�	�	�I�	�	�	�&�&�&�0,
�,
�,
�\)�)�)�)�)�F�)�)�)�((@�(@�(@�(@�(@�f�(@�(@�(@�TF�F�F�F�F��F�F�F�PO,�O,�O,�O,�O,�V�O,�O,�O,�O,�O,r

Youez - 2016 - github.com/yon3zu
LinuXploit