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__/hgwebdir_mod.cpython-39.opt-1.pyc
a

�+�bBP�@sddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ m!Z!ddlm"Z"m#Z$m%Z%m&Z&dd	l'm(Z(d
d�Z)dd
�Z*dd�Z+dd�Z,ddd�Z-dd�Z.ddd�Z/Gdd�de0�Z1dS)�)�absolute_importN�)�_�)	�
ErrorResponse�HTTP_SERVER_ERROR�	cspvalues�get_contact�	get_mtime�ismember�	paritygen�
staticfile�
statusmessage)�configitems�encoding�error�
extensions�hg�pathutil�	profiling�pycompat�rcutil�	registrar�scmutil�	templater�templateutil�ui�util)�	hgweb_mod�request�webutil�wsgicgi)�dateutilcCsdd�|D�S)NcSs$g|]\}}t�|��d�|f�qS)�/)r�pconvert�strip)�.0�name�path�r)�B/usr/lib64/python3.9/site-packages/mercurial/hgweb/hgwebdir_mod.py�
<listcomp>9�zcleannames.<locals>.<listcomp>r))�itemsr)r)r*�
cleannames8sr.c	Cs�g}t|�D]�\}}tj�|�\}}zddd�|}Wn$tyZ|�||f�YqYn0tj�t�|��}t	j
|d|d�}|�t|||��q|S)NFT)�*s**)�	followsym�recurse)
r.�osr(�split�KeyError�append�normpathr�abspathr�	walkrepos�extend�urlrepos)�paths�repos�prefix�root�rootheadZroottailr1r)r)r*�	findrepos<s
r@ccsJ|D]@}tj�|�}|dt�|t|�d���d��d�|fVqdS)a�yield url paths and filesystem paths from a list of repo paths

    >>> conv = lambda seq: [(v, util.pconvert(p)) for v,p in seq]
    >>> conv(urlrepos(b'hg', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt']))
    [('hg/r', '/opt/r'), ('hg/r/r', '/opt/r/r'), ('hg', '/opt')]
    >>> conv(urlrepos(b'', b'/opt', [b'/opt/r', b'/opt/r/r', b'/opt']))
    [('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')]
    r#N)r2r(r6rr$�len�lstripr%)r=r?r;r(r)r)r*r:Os	"���r:cCsV|j}|jdddd�}|r.|r*t|||�r.dS|jdddd�}|rNt|||�rRdSdS)a�Check allow_read and deny_read config options of a repo's ui object
    to determine user permissions.  By default, with neither option set (or
    both empty), allow all users to read the repo.  There are two ways a
    user can be denied read access:  (1) deny_read is not empty, and the
    user is unauthenticated or deny_read contains user (or *), and (2)
    allow_read is not empty and the user is not in allow_read.  Return True
    if user is allowed to read the repo, else return False.�webs	deny_readT��	untrustedFs
allow_read)Z
remoteuser�
configlistr)r�req�userZ	deny_readZ
allow_readr)r)r*�readallowed_s	rIr,c#s�|�dd�}|�dd�}t�}t�}|D�]d\}}	|�|�s>q(|t|�d�}d}
d|vr�|s`q(|�d�}|d}|sxnt||vr�q(nh||vr�n^d}
|}d�|dd��}
|	dt|
�d�}	zt�||	�d}
Wntt	j
fy�Yn0|j�d�|�d�|�d�g}dd�d	d
�|D��d}|
�r�zt
|	�t��df}Wnt�y\Yq(Yn0dd|d||dd||d|dt�g�dtjgdd
�d�}|�|�|Vq(|���t���r$z��tj�|	dd��WnHt�y"}z.��td�|	|f�WYd}~q(WYd}~n
d}~00tjf�fdd�	}�jdddd��rJq(t �|��sXq(zt�||	�}WnTt�y���td�|	�Yq(Yn,t	j
�y���td�|	�Yq(Yn0zt
|j!�t��df}Wnt�y�Yq(Yn0t"|�}|dd�}|�|�|dd|�}�j#dddd�}|�p2d|�$��p>d||||�pLd|�$��pXd||d|dt%�&�d|�dtj|dd
�d�}|Vq(dS)NrCsdescendscollapseFr#rTrcss|]}|r|VqdS�Nr))r&�pr)r)r*�	<genexpr>�r,z"rawindexentries.<locals>.<genexpr>r,slabel)r')�contactscontact_sort�names	name_sort�url�descriptionsdescription_sort�
lastchangeslastchange_sortsarchivessisdirectory�labelss.hgshgrcserror reading %s/.hg/hgrc: %s
cs�j|||dd�S)NTrD)�config)�sectionr'�default��ur)r*�get�szrawindexentries.<locals>.getshiddenrDs!error accessing repository at %s
rPrNrRsunknownstip)'�
configbool�set�
startswithrAr3�joinr�
repository�IOErrorr�	RepoError�apppathr%r
r"Zmakedate�OSErrorrZmappinglistZ
hybridlist�add�copyrZ
use_repo_hgrc�
readconfigr2r(�	Exception�warnr�uimodZ_unsetrIZspathr	rF�upperr Zarchivelist)rr<rG�subdirZdescendZcollapseZ	seenreposZseendirsr'r(Z	directoryZ	namepartsZrootnameZ	discarded�parts�url�d�row�erX�rZcontact�description�labelsr)rVr*�rawindexentriesvs�


�
�

"



�rrc#slt||||d�}d}	|rB|	||fkrBd|�t|�fdd�|d�}t|t|��D]\}
}||
d<|
VqPdS)N�ri�NFs%s_sortcs|�SrJr))�x�Zsortkeyr)r*�<lambda>r,z"_indexentriesgen.<locals>.<lambda>)�key�reversesparity)rr�sorted�zipr)�contextrr<rG�stripecount�
sortcolumn�
descendingriZrowsZsortdefaultrmZparityr)rvr*�_indexentriesgen�sr�FcCs |||||||f}tjt|d�S)N)�args)rZmappinggeneratorr�)rr<rGr}r~rrir�r)r)r*�indexentries	sr�c@sTeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	ddd�Z
dd�ZdS)�hgwebdirz�HTTP server for multiple repositories.

    Given a configuration, different repositories will be served depending
    on the request path.

    Instances are typically used as WSGI applications.
    NcCsL||_||_d|_d|_d|_|��d|_|sHt�|j�t�	|j�dS)Nr)
�conf�baseuir�lastrefresh�motd�refresh�requests_countrZloadall�
populateui)�selfr�r�r)r)r*�__init__szhgwebdir.__init__c
Cs�|jr|j�dd�}ntjdd}|j}|dkrH|j|t��krHdS|jrZ|j��}n:t	j�
�}|�dddd�|�ddd	d�|�d
dd	d�t|j
tttf��s d
di}tj�|j
�s�t�td�|j
��|j|j
|dd�g}|�d�D]*\}}|�d|�D]}|�||f��qq�n2t|j
ttf��r:|j
}nt|j
t��rR|j
��}t�|�t|�}	|�d�D]p\}
}t�|
�}
t j!|dd�D]L}tj�"|�}t�|�}|�#|
��r�|t$|
�d�}|	�|�%d�|f��q��qn|	|_&||_|j�dd�|_'d|_(|j�)dd�t*_*|j�)dd�|_+|jj)dddd�|_,|j�)dd�|_-|j-�rZt.|j-�|_-|j�)dd�}
|
�#d��r�|
dd�}
|
�/d��r�|
dd�}
|
|_0t��|_dS) NrCsrefreshintervalrsuisreport_untrustedsoffshgwebdirsnonttystruesprogresssdisableshgwebspathsshgweb-pathssconfig file %s not found!T)ZremapZtrustscollections)r0r#sexperimentals web.full-garbage-collection-rate�encoding�styles	templatesFrDsstripessprefixr���)1rZ	configintrZ	coreitemsrUr��timer�rcrg�loadZ	setconfig�
isinstancer��dict�list�tupler2r(�existsrZAbortrrdrFr5r-rr�r@rr$rr8r6r[rArBr<�gc_full_collect_rate�gc_full_collections_donerSr�style�templatepathr}�int�endswithr=)
r�Zrefreshinterval�itemrW�mapr;r'Zignoredr(r<r=r>�repor)r)r*r�&sv��




��zhgwebdir.refreshcCs*tj�dd��d�std��t�|�dS)NsGATEWAY_INTERFACEr,sCGI/1.sJThis function is only intended to be called while running as a CGI script.)r�environrXr[�RuntimeErrorr!Zlaunch�r�r)r)r*�runms��zhgwebdir.runcCs4|j�dd�}tj||d�}t�||�}|�||�S)NrC�baseurl)�
altbaseurl)rrS�
requestmod�parserequestfromenvZwsgiresponse�run_wsgi)r��envZrespondZbaseurlrG�resr)r)r*�__call__wszhgwebdir.__call__c
cs�|j�dd�}tj|j|d���zj|�||�D]
}|Vq.W|j}|jd7_|dkr~|j|dkr~t��|j	d7_	q�tjdd�nP|j}|jd7_|dkr�|j|dkr�t��|j	d7_	ntjdd�0Wd�n1s�0YdS)Ns	profilingsenabled)Zenabledrr)Z
generation)
rrYr�profile�_runwsgir�r��gcZcollectr�)r�rGr�r�roZrater)r)r*r�~s"

�zhgwebdir.run_wsgics.�z"�z�|��t|j�\}}|r,||jd<|j�d��|�||�}|�ddtji�}d|_	||jd<��
d�szd|jvr̈�
d�r��d	d�}n
|jd}|jjd
ddd�}t
|j|||�|��WW~St|j�}	�r�d
kr��|	vr�|�|||�WW~S��d��rT�|	v�rT�dtd
���t�fdd�|	D���rT|�|||��WW~S�fdd�}
|
�D]�}|	�|�}|�rf|j}
tj�r�dd�t�|
�D�}
tj|
||j�d
d�|jd�}z0t�|j� �|�}t!�"|��#||�WWW~St$�y&}z"t�%|j&�}t't(|��WYd}~n>d}~0t)j*�yZ}zt't(t+|���WYd}~n
d}~00�qf�d��fdd�|	D��r�|�|||��WW~Sd|_	|�,|�-dd�i��|��WW~St'�y}zJt.|j/t�0|��|_	|�,|�-dd|j1�p�di��|��WYd}~W~Sd}~00W~n~0dS)NsContent-Security-Policyr#smimetyper�s200 Script output followssContent-Typesstatic/sstatic�rCFrD�indexs/indexc3s|]}|���VqdSrJ�r[�r&rorsr)r*rL�r,z$hgwebdir._runwsgi.<locals>.<genexpr>c3s �Vt���D]
}|VqdSrJ)rZfinddirs)rK)�virtualr)r*�_virtualdirs�sz'hgwebdir._runwsgi.<locals>._virtualdirscSsi|]\}}|�d�|�qS)�latin1)�decode)r&�k�vr)r)r*�
<dictcomp>�s�z%hgwebdir._runwsgi.<locals>.<dictcomp>r�)Zreponamer��bodyfhcsg|]}|���r|�qSr)r�r�rsr)r*r+�r,z%hgwebdir._runwsgi.<locals>.<listcomp>s
404 Not Foundsnotfoundsreposerrorr,)2r�rrZheadersZdispatchpathr%rZrenderr�statusr[�qsparamsrSr
r��sendresponser�r<�	makeindexr�rA�anyrXZrawenvrZispy3Z	iteritemsr�r�r�rr]rcrZhgwebr�r^Z
strtolocal�strerrorrrrr_�bytes�
setbodygen�generater�codeZbytestr�message)r�rGr�Zcsp�nonce�tmplZctype�fnameZstaticr<r�Zvirtualrepo�realZuenvr��inst�msgrnr))rir�r*r��s�




D�
=�6�

���(�
	���zhgwebdir._runwsgir,c		s�|��gd�}d\��d|jvrR|jd���d���rF�dd���|vrRd���fdd�|D�}|��t|j|j||j��|d	�}||t�d
||j	���d�}|�
|�|�|�d|��|�
�S)
N)rNrPrMrQrtssort�-rr,cs2g|]*}d|d�r"|�kr"dp$d|ff�qS)ssort_%ss%s%sr�r,r))r&�column�rr~r)r*r+s	����z&hgwebdir.makeindex.<locals>.<listcomp>)r~rrir#)sentriesssubdirspathdefs
sortcolumns
descendingr�)r�r�r[r�rr<r}rZmakebreadcrumbr=�updater�r�r�)	r�rGr�r�riZsortable�sort�entries�mappingr)r�r*r��s@


	���
zhgwebdir.makeindexc	s��fdd��i}t�|��j�\}\}}}||dkr>||d<t�|d�}�dd�}	�dd�}
�dd	�pv|j�d
�d}|�d
�s�|d
7}tj|jd
|	|
||||d�}t	�
|�}
|
d
dd���fdd��}tjj|||d�S)Ncs|�dd��jj|i|��S)NrET)�
setdefaultrrS)r��kwargsr�r)r*rS+sz"hgwebdir.templater.<locals>.configrr��?rC�logourl�logoimg�	staticurlr#s/static/)r�rOr�r�r�ssessionvarsr�snonce�motdr))Zrequiresc3s$�jdur�jVn�dd�VdS)NrCr�)r�)r|r��rSr�r)r*r�Ls

z hgwebdir.templater.<locals>.motd)�fp�defaults)
rZgetstyler�r �sessionvarsr`�rstripr�rr�templatekeywordrZfrommapfile)r�rGr��varsZstylesr�Zmapfiler�r�ZlogourlZlogoimgZ	staticurlr�r�r�r)r�r*r*s<�


�
�


�zhgwebdir.templater)N)r,)�__name__�
__module__�__qualname__�__doc__r�r�r�r�r�r�r�rr)r)r)r*r�s

G
^
/r�)r,)r,Fr,)2Z
__future__rr�r2r�Zi18nr�commonrrrr	r
rrr
r�rrrrrrrrrrrrrrrgrrrr�r r!Zutilsr"r.r@r:rIrrr�r��objectr�r)r)r)r*�<module>	s$,D
�


Youez - 2016 - github.com/yon3zu
LinuXploit