403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib64/python3.9/site-packages/mercurial/hgweb/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib64/python3.9/site-packages/mercurial/hgweb/__pycache__/common.cpython-39.opt-1.pyc
a

�+�b�#�@sddlmZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZmZmZm
Z
e
jZdZdZdZd	Zd
ZdZdZd
ZdZdZdZdd�Zdd�ZegZGdd�de�ZGdd�de�Z dd�Z!d+dd�Z"dd�Z#dd �Z$d!d"�Z%d#d$�Z&d,d%d&�Z'd'd(�Z(d)d*�Z)dS)-�)�absolute_importN�)�getattr�open)�encoding�pycompat�	templater�util����i0i�i�i�i�i�i�i�i�cCs|dgkp||vS)z�Check if username is a member of userlist.

    If userlist has a single '*' member, all users are considered members.
    Can be overridden by extensions to provide more complex authorization
    schemes.
    �*�)�ui�usernameZuserlistr
r
�</usr/lib64/python3.9/site-packages/mercurial/hgweb/common.py�ismember+src	CsL|j}|�dd�}|r4|r*t|jj||�r4ttd��|�dd�}|r^t|jj||�s^ttd��|dkrx|jsxttd��n|dks�|dur�dS|dkr�|jd	kr�d
}tt	|��n|jdkr�d}tt	|��|�
dd
�r�|jdkr�ttd��|�dd�}|�r|�rt|jj||��rttd��|�dd�}|�r>t|jj||��sHttd��dS)z�Check permission for operation based on request data (including
    authentication info). Return if op allowed, else raise an ErrorResponse
    exception.�webs	deny_readsread not authorizeds
allow_readspullspull not authorizedNsuploadsPUTsupload requires PUT requestsPOSTspush requires POST requestspush_sslshttpssssl requireds	deny_pushspush not authorizeds
allow-push)
Z
remoteuserZ
configlistrZrepor�
ErrorResponse�HTTP_UNAUTHORIZEDZ	allowpull�method�HTTP_METHOD_NOT_ALLOWEDZ
configboolZ	urlscheme�HTTP_FORBIDDEN)	ZhgwebZreq�op�userZ	deny_readZ
allow_read�msgZdenyZallowr
r
r�
checkauthz5s4






rc@seZdZddd�ZdS)rNcCsD|durt|�}t�|t�|��||_|dur4g}||_||_dS)N)�_statusmessage�	Exception�__init__rZsysstr�code�headers�message)�selfrr!r r
r
rrlszErrorResponse.__init__)NN)�__name__�
__module__�__qualname__rr
r
r
rrksrc@s*eZdZdZdd�Zd
dd�Zdd�Zd	S)�continuereadera.File object wrapper to handle HTTP 100-continue.

    This is used by servers so they automatically handle Expect: 100-continue
    request headers. On first read of the request body, the 100 Continue
    response is sent. This should trigger the client into actually sending
    the request body.
    cCs||_||_d|_dS)NF)�f�_write�	continued)r"r'�writer
r
rr�szcontinuereader.__init__���cCs"|jsd|_|�d�|j�|�S)NTsHTTP/1.1 100 Continue

)r)r(r'�read)r"Zamtr
r
rr,�s
zcontinuereader.readcCs|dvrt|j|�St�dS)N)sclosesreadlines	readliness__iter__)rr'�AttributeError)r"�attrr
r
r�__getattr__�szcontinuereader.__getattr__N)r+)r#r$r%�__doc__rr,r/r
r
r
rr&ws
r&cCstjj}t�|�|d�d�S)N)�Errorz
Unknown errorr)�
httpserverZbasehttprequesthandler�	responsesrZbytesurl�get)rr3r
r
rr�srcCsd||pt|�fS)Ns%d %s)r)rr!r
r
r�
statusmessage�sr5cCs2tj�||�}tj�|�r$t�|�St�|�SdS)z%stat fn if it exists, spath otherwiseN)�os�path�join�exists�stat)�spath�fnZcl_pathr
r
r�get_stat�s
r=cCst|d�tjS)Ns
00changelog.i)r=r:�ST_MTIME)r;r
r
r�	get_mtime�sr?cCsN|�d�}|D]:}|dtjtjfvsBtj|vsBtjdurtj|vrdSqdS)z9Determine if a path is safe to use for filesystem access.�/�NFT)�splitrZoscurdirZospardirZossepZosaltsep)r7�parts�partr
r
r�
ispathsafe�s
����rEc
Cs2t|�sdS|s2|pt��}|dur2tj�|d�}tjj|�d��}t�t	�
t�|��dp^d�}tj�||�}z@t�|�t
|d��}|��}	Wd�n1s�0YWnhty�ttd��YnNt�y}
z4|
jtjkr�tt��nttt�|
j���WYd}
~
n
d}
~
00||jd<|�|	�|S)	a+return a file inside directory with guessed Content-Type header

    fname always uses '/' as directory separator and isn't allowed to
    contain unusual path components.
    Content-Type is guessed using the mimetypes module.
    Return an empty string if fname is illegal or file not found.

    Nsstaticr@rz
text/plainsrbsillegal filenamesContent-Type)rErZtemplatedirr6r7r8rBrZsysbytes�	mimetypesZ
guess_type�fsdecoder:rr,�	TypeErrorr�HTTP_SERVER_ERROR�OSError�errno�ENOENT�HTTP_NOT_FOUNDrZ
strtolocal�strerrorr Zsetbodybytes)ZtemplatepathZ	directory�fname�res�tpZfpathZctr7Zfh�data�errr
r
r�
staticfile�s4	�
*
�

rTccsZ|r&|r&|||}|||d@}nd}d}|V|d7}|r.||kr.d|}d}q.dS)z5count parity of horizontal stripes for easier reading�rNr
)Zstripecount�offset�countZparityr
r
r�	paritygen�srXcCs$|dd�p"|dd�p"tj�d�p"dS)z�Return repo contact information or empty string.

    web.contact is the primary source, but if that is not set, try
    ui.username or $EMAIL as a fallback to display something useful.
    rscontactsuisusernamesEMAILrA)r�environr4)�configr
r
r�get_contact�s
�
��r[cCsRddl}|jdddd�}d}|rJd|vrJt�|��j��d�}|�d|�}||fS)	aObtain the Content-Security-Policy header and nonce value.

    Returns a 2-tuple of the CSP header value and the nonce value.

    First value is ``None`` if CSP isn't enabled. Second value is ``None``
    if CSP isn't enabled or if the CSP header doesn't need a nonce.
    rNrscspF)Z	untrusteds%nonce%�=)�uuidrZ�base64Zurlsafe_b64encodeZuuid4�bytes�rstrip�replace)rr]ZcspZnoncer
r
r�	cspvalues�srb)N)r)*Z
__future__rr^rKrFr6r:rrr�rrr	r2ZHTTP_OKZHTTP_CREATEDZHTTP_NOT_MODIFIEDZHTTP_BAD_REQUESTrrrMrZHTTP_NOT_ACCEPTABLEZHTTP_UNSUPPORTED_MEDIA_TYPErIrrZ	permhooksrr�objectr&rr5r=r?rErTrXr[rbr
r
r
r�<module>	sB
3
	)


Youez - 2016 - github.com/yon3zu
LinuXploit