403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.216.1.197
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/paste/auth/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/paste/auth/__pycache__/grantip.cpython-37.pyc
B

a�N��@s.dZddlmZGdd�de�Zd	dd�ZdS)
z-
Grant roles and logins based on IP address.
�)�ip4c@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
�GrantIPMiddlewarea
    On each request, ``ip_map`` is checked against ``REMOTE_ADDR``
    and logins and roles are assigned based on that.

    ``ip_map`` is a map of {ip_mask: (username, roles)}.  Either
    ``username`` or ``roles`` may be None.  Roles may also be prefixed
    with ``-``, like ``'-system'`` meaning that role should be
    revoked.  ``'__remove__'`` for a username will remove the username.

    If ``clobber_username`` is true (default) then any user
    specification will override the current value of ``REMOTE_USER``.
    ``'__remove__'`` will always clobber the username.

    ``ip_mask`` is something that `paste.util.ip4:IP4Range
    <class-paste.util.ip4.IP4Range.html>`_ can parse.  Simple IP
    addresses, IP/mask, ip<->ip ranges, and hostnames are allowed.
    Tc	CsR||_g|_x:|��D].\}}|j�t�|�|�|d|d�f�qW||_dS)Nr�)�app�ip_map�items�appendrZIP4Range�_convert_user_role�clobber_username)�selfrrr
�key�value�r�C/opt/alt/python37/lib/python3.7/site-packages/paste/auth/grantip.py�__init__szGrantIPMiddleware.__init__cCs |rt|t�r|�d�}||fS)N�,)�
isinstance�
basestring�split)r�username�rolesrrrr	$s
z$GrantIPMiddleware._convert_user_rolec	Cs�t�|dd�}d}g}xV|jD]L\}\}}||kr |rB|�|�|dkrPd}q |r |�d�rd|jr ||d<q W|r�d|kr�|d=|r�|�||�|�||�S)NZREMOTE_ADDRFZ
__remove__TZREMOTE_USER)rZip2intr�extend�getr
�
_set_rolesr)	r�environZstart_response�addrZremove_userZ	add_roles�rangerrrrr�__call__)s$

zGrantIPMiddleware.__call__cCs�|�dd��d�}td|�}g}x<|D]4}|�d�rH|�|dd��q&||kr&|�|�q&Wx|D]}||krd|�|�qdWd�|�|d<dS)NZREMOTE_USER_TOKENS�r�-r)rr�filter�
startswithr�remove�join)rrrZ	cur_rolesZremove_roles�rolerrrr=s



zGrantIPMiddleware._set_rolesN)T)�__name__�
__module__�__qualname__�__doc__rr	rrrrrrrs

rFc
Ks|ddlm}||�}i}xV|��D]J\}}d|krD|�dd�\}}	n|}d}	|dkrXd}|	dkrdd}	|||<q"Wt|||�S)a�
    Grant roles or usernames based on IP addresses.

    Config looks like this::

      [filter:grant]
      use = egg:Paste#grantip
      clobber_username = true
      # Give localhost system role (no username):
      127.0.0.1 = -:system
      # Give everyone in 192.168.0.* editor role:
      192.168.0.0/24 = -:editor
      # Give one IP the username joe:
      192.168.0.7 = joe
      # And one IP is should not be logged in:
      192.168.0.10 = __remove__:-editor
      
    r)�asbool�:rrr)Zpaste.deploy.convertersr)rrr)
rZglobal_confr
�kwr)rrr
rr$rrr�make_grantipNsr,N)F)r(Z
paste.utilr�objectrr,rrrr�<module>sF

Youez - 2016 - github.com/yon3zu
LinuXploit