403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.221.83.23
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/clselect/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/clselect/__pycache__/clselectctlpython.cpython-37.pyc
B

��dy��@sTddlmZddlmZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmmmZddlmZddlmZddlmZdd	lmZdd
lmZddlZddlmZm Z m!Z!m"Z"ddl#m$Z$m%Z%dd
l&m'Z'ddl(m)Z)m*Z*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2m3Z3m4Z4ddl5m6Z6m7Z7dZ8dZ9dZ:dZ;dZ<e�=d�Z>dd�Z?dKdd�Z@dLdd�ZAdMd d!�ZBd"d#�ZCdNd$d%�ZDdOd&d'�ZEdPd(d)�ZFd*d+�ZGdQd-d.�ZHd/d0�ZIdRd1d2�ZJdSd3d4�ZKdTd5d6�ZLdUd7d8�ZMd9d:�ZNd;d<�ZOd=d>�ZPd?d@�ZQdAdB�ZRdCdD�ZSdVdFdG�ZTdWdIdJ�ZUdS)X�)�print_function)�absolute_import)�divisionN)�ConnectionError)�	iteritems�)�clpassenger)�clselectctl)�utils)�userdomains�docroot�cpusers�CP_NAME)�NoDomain�NotSupported)�mod_makedirs)�ApplicationsManager�PythonAppFormatVersion�get_venv_rel_path)�ClSelectExcept�BaseClSelectException)�clprint)�
extensions�environments�interpreters)�APP_STARTED_CONST�APP_STOPPED_CONSTzpassenger_wsgi.py�started�applicationz�import imp
import os
import sys


sys.path.insert(0, os.path.dirname(__file__))

wsgi = imp.load_source('wsgi', '%s')
application = wsgi.%s
aHimport os
import sys


sys.path.insert(0, os.path.dirname(__file__))


def %s(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    message = 'It works!\n'
    version = 'Python v' + sys.version.split()[0] + '\n'
    response = '\n'.join([message, version])
    return [response.encode()]
zJimp\.load_source\(.+, '(?P<script>.+)'\)\s+application.+\.(?P<callable>.+)cCs�td�td�td�td�td�td�td�td�td	�td
�td�td�td
�td�td�td�td�td�td�td�td�td�td�td�td�td�td�td�td�td�td�dS)Nz�Warning: selectorctl utility for --interpreter python is deprecated. Only update-interpreter option is still possible to use. 
Please, use cloudlinux-selector utility to manage your python applicationszF -v | --version VERSION                  : Specify alternative versionz3 -u | --user USERNAME                    : Usernamez^      --domain DOMAIN                    : Domain (or subdomain); users main domain as defaultzL -l | --list                             : List alternatives for interpreterzF -G | --list-extensions                  : List global set of packageszG -K | --list-extensions-version          : List version set of packageszG -s | --user-summary                     : List user summary of webappsz= -y | --create-webapp                    : Create user webappzi    | --update-interpreter               : Update binary python in virtual environment; you can use with zj                                           --user=* for all users; application name as default * (all app)z> -n | --destroy-webapp                   : Destroy user webappza -f | --relocate-webapp                  : Change webapp directory (files must be moved manually)zE -F | --transit-webapp                   : Change webapp domain/aliasz9 -Z | --restart-webapp                   : Restart webappz6 -t | --stop-webapp                      : Stop webappz^ -c | --user-current                     : Show currently selected alternative for user webappzQ -b | --set-user-current                 : Set alternative as user webapp defaultzc -e | --enable-user-extensions PACKAGES  : Install comma-separated list of packages for user webappze -d | --disable-user-extensions PACKAGES : Uninstall comma-separated list of packages for user webappzK                                         : Use '-' (minus) for all packageszb -r | --replace-user-extensions PACKAGES : Update comma-separated list of packages for user webappzN      --recreate-virtualenv              : Recreate python virtual environmentzX      --freeze-requirements              : Freeze virtual environment installed packageszR -g | --list-user-extensions             : List installed packages for user webappz5 -o | --setup-wsgi WSGI[:CALLABLE]       : Setup wsgizZ -p | --print-summary                    : If specified along with setting an alternative z>                                           prints user summaryz= -j | --json                             : Print data as JSONzO    | --verbose                          : show detail information about action)�print�r r �K/opt/alt/python37/lib/python3.7/site-packages/clselect/clselectctlpython.py�usageRs>r"Tc	Cs�t||�\}}|s|}t�|||�}|��r<|s<t�|j��|��s�ytjdd�|}Wntk
rvt�	|��YnX|�
|�|S)a#
    Create new environment (or use existing if use_existing=True)
    :param user: unix user name that app belongs to
    :param directory: app root
    :param version: python version
    :param env_name: DEPRECATED
    :param use_existing: do not raise exception if env already exists
    �version)�key)rr�Environment�existsr�EnvironmentAlreadyExists�pathr�KeyError�NoSuchAlternativeVersion�create)	�user�	directoryr#�env_name�use_existing�_�prefix�environment�interpreterr r r!�_create_environmentvs	
r4c	Cs�|dkrt�}y(|r|d}n|�||t�|�j�}WnDtjk
rzt�|��	|�}|dkrnt�
d|��|d}YnXtj�
tj�tj�|���}t||�\}}t�|||�}|S)N�binaryz8No such application (or application not configured) "%s")r�get_binary_path�pwd�getpwnam�pw_dirr�ConfigMissingErrorr�summary�get�WebAppError�osr(�basename�dirnamerrr%)	r,r-�app_summary�apps_managerr5r.r0r1r2r r r!�_get_environment�s
rCc
Cs|	dkrt�}	|dkr t�d��t�|�}t�|�}yt�|||�}Wnt	k
rZYnXt�
|d��t|||dd�}
|
��j
}tj||||	j|||
d�t�||�|r�t|}ntj}|�r|tk�rt|||�}tj�|�}tj�|�s�t|d�t�||�|�rNt||||�n0t}t|||�}t�||�|�rNt||||�|�sXi}|�sbt}|�s�t�|�}t�|||�}|d}|tj||t|g||d	�	}|
�r�|
|d
<|	� |||�y|	�!||||�Wn:t"k
�r}zt#�$ddt%|�d
��Wdd}~XYnXdS)a�
    Create new python application
    :param user: unix user name
    :param directory: application path in user's home (app-root)
    :param alias: alias (app-uri)
    :param version: version of interpreter
    :param doc_root: doc_root
    :param env_vars: dict with environment variables
    :param startup_file: main application file
    :param domain_name: domain name
    :param entry_point: application entry point
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :param passenger_log_file: Passenger log filename to write to app's .htaccess
    :return: None
    NzNot passed version as argumentr-F)r/)�doc_root�passenger_log_filei��domain)	�python_version�app_versionrF�app_uri�
app_status�startup_file�config_files�env_vars�entry_pointrE�text�ERROR)�status�message)&rr�	WrongDatar	�	get_aliasrr;r
�get_using_realpath_keysr)�AppRootBusyr4r3r5�	configure�INTERPRETER�restart�_CONFIGURABLE_WSGI_TEMPLATE�
WSGI_TEMPLATE�DEFAULT_STARTUP_FILE�_get_full_path_to_startup_filer>r(r@r&r�
file_write�
setup_wsgi�DEFAULT_APP_ENTRYPOINTrZSTABLE�DEFAULT_APP_STATE�add_app_to_config�add_env_vars_for_htaccess�	Exceptionr�
print_diag�str)r,r-�aliasr#rDrMrK�domain_namerNrBrE�user_summaryrAr2r5�contentZstartup_file_name�dir_name�summary_data�app_data�errr r r!r+�sp






r+cCs,ddlm}|���|�s(t�||d��dS)z�
    Check whether particular interpreter version is enabled and raises
    exception if not
    :param user: user to include in exception
    r)�python_managerzversion is not enabledN)�clselectpythonro�
PythonManager�is_version_enabledr�UnableToSetAlternative)r#r,ror r r!�_ensure_version_enabledsrtcCs~d}d}d}tjj�tj�t|�s.t�d��dj	||d�}ytj
|dd�}WnVtk
r�|�d	d
�}ytj
|dd�}Wn"tk
r�t�
||��YnXYnX|j�
d�}|j�
d�}	|�ytj
|dd�}Wn"tk
r�t�
||��YnX|j�
d�}
|j�
d�}|��|
��k�sf|	|k�rJ|	d
k	�rJ|	d
d�dk�sf|d
k	�rz|d
d�dk�rzt�
||||
f��d
S)a@
    Check response from user's webapp before and after calling action.
    Also compare both responses
    :param domain: domain associated with webapp
    :param alias: URI associated with webapp
    :param action: called action, that make something with webapp: install modules, transit it, etc
    :return: None
    zTWeb application is inaccessible by its address "%s". The operation wasn't performed.z�The operation was performed, but check availability of application has failed. Web application is inaccessible by its address "%s" after the operation.z�The operation was performed, but check availability of application has failed. Web application responds, but its return code "%s" or content type before operation "%s" doesn't equal to contet type after operation "%s".z+Wrong action for calling in checking webappzhttps://{domain}/{alias})rFrgF)�verifyzhttps://zhttp://zContent-Type�StatusN��500)�requests�packages�urllib3�disable_warnings�urllib_exceptions�InsecureRequestWarning�callablerrS�formatr<r�replacer=�headers�lower)rFrg�action�app_is_inaccessible_before�app_is_inaccessible_after�
app_is_broken�
webapp_url�request�before_mime_type�
before_status�after_mime_type�after_statusr r r!�check_response_from_webapps<

&r�csn�dkrt�d���dkr$t�d���d}t��}��fdd�|D�}t|�dkr^t�d��|d}||fS)	z�
    Get info (alias and domain) about user's web application
    :param app_summary: dict -> summary info about user's web application
    :param user: str -> name of unix user
    :return: tuple -> (alias, domain)
    Nz3Was passed incorrect summary info about applicationz!Was passed incorrect name of userrgcs&g|]\}}t��|�d�r|�qS)r)r
�realpaths_are_equal)�.0rFrD)rAr,r r!�
<listcomp>[sz*_get_info_about_webapp.<locals>.<listcomp>rz-Can not found suitable domain for application)rrSr�len)rAr,rg�user_domains�
found_domains�
app_domainr )rAr,r!�_get_info_about_webappLs


r�c
Cs�|dkrt�}|�||�}y|dk	r4|�||d|�Wn8tk
rn}zt�ddt|�d��Wdd}~XYnX|dk	�r|�d�tk�rt	�
|�j}tj
�|t||�d�}yt�|�Wntk
r�YnX|dk	r�|�|||�}t�|�|�||�t�||�dSt||�\}	}
t�||
�\}}	yt�|�Wntk
�rPYnXt�|�}|�||�}
yt�|||�Wn.tk
�r�|
�r�dSt�d|��YnXt�||�yt�||�Wntj k
�r�YnXdS)aa
    Destroy web app with specified directory for specified user
    :param user: username
    :param app_directory: application directory
    :param doc_root: Document root for selected domain
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :return: None
    NrOrP)rQrRrJrz8No such application (or application not configured) "%s")!r�get_app_configrcrdrrerfr<rr7r8r9r>r(�joinr�shutil�rmtree�OSError�get_htaccess_by_appdirr�$remove_passenger_lines_from_htaccess�remove_app_from_configrYr
�get_abs_relr;rUr)rrS�unconfigure�MissingApprootDirectory)r,�
app_directoryrDrB�
app_configrn�	user_homeZvirtual_env_path�htaccess_filenamer0r1�abs_dirri�
app_in_configr r r!�destroydsT(

r�c	st�|�}t�|tj�\}}x�t�tj�	|dd��D]�}x�t�tj�	|dd��D]�}tj�
|�rbqPt�|d�}g}|���d|kr�xX|�
�D],}d|kr�t�d�fdd�|�}|�|�q�Wn|�d�r�|�
�}d	�|d
<|rPt�|dd�|D�d
�qPWq4WdS)N�*�bin�rbsVIRTUAL_ENVs+VIRTUAL_ENV[^\\]([\"\'])(?P<old_path>.+)\1$cs|�d��|�d���S)NrZold_path)�groupr�)�m)�encoded_envr r!�<lambda>��zfix_homedir.<locals>.<lambda>s#!s#!%s/bin/pythonrcss|]}d|VqdS)s%s
Nr )r��liner r r!�	<genexpr>�szfix_homedir.<locals>.<genexpr>�wb)r	�get_userr
r�r�DEFAULT_PREFIX�globr>r(r��islink�	file_read�encode�
splitlines�re�sub�append�
startswith�file_writelines)r,�envsr0�env�scriptZ
old_scriptZ
new_scriptr�r )r�r!�fix_homedir�s,


r�Fc

s�|dkrt�}t�|�}|�|�}yt�|�|�}Wn$tk
rXt�d�	����YnX|dt
krjd}t|�|d������fdd�}|s�yt|d|d	|d
�Wq�tj
k
r�}	zt�
d|	��Wdd}	~	XYq�Xn|�dS)a
    Install defined extension to python web application
    :param requirements_path: path to the text file with list of python modules for installation
    :param user: name of owner of web application
    :param directory: application's root
    :param extension: name of installed module
    :param skip_web_check: skip check web application after change it's properties
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :return: None
    Nz%Record about application {} is absentrJT)rBcs4�dk	r����n�dk	r0��tj�����dS)N)�extension_installZextension_install_requirementsr>r(r�r )r-r2�	extension�requirements_pathr r!r��szinstall.<locals>.actionrFrI)rFrgr�z3An error occured during installation of modules. %s)rr	r��get_user_config_datar
rUr)rrSr�rrCr�r=)
r,r-r�r��skip_web_checkrB�user_configrmr�rnr )r-r2r�r�r!�install�s*


"r�cCst�|�}t||�}|��S)N)r	r�rCr)r,r-r2r r r!�list_extensionss

r�cCsv|dkrt�}|�||�}|dk	rF|�d�tkrF|dk	rft|||�n t�|�}||krft�d|��t�	||�dS)ab
    Restarts web app with specified directory for specified user
    :param user: username
    :param app_directory: application directory
    :param doc_root: Document root for selected domain
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :return: None
    NrJz8No such application (or application not configured) "%s")
rr�r<r�startrr;rrSrY)r,r�rDrBr��apps_summaryr r r!rYs

rYcCsz|dkrt�}|�||�}|dkr0t�d|��|�d�tkrBdS|�||||�}t�|�|�	||t�t�
||�dS)a_
    Stops web app with specified directory for specified user
    :param user: username
    :param app_directory: application directory
    :param doc_root: Document root for selected domain
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :return: None
    Nz8No such application (or application not configured) "%s"rJ)rr�rrSr<rr�rr��set_app_statusrY)r,r�rDrBr�r�r r r!�stop"s
r�cCs�|dkrt�}|�||�}|dkr0t�d|��|�d�tkrBdS|�|||�|�||t�t�	||�|�d�}|t
kr�t|||�d��}t||||�d��dS)a`
    Starts web app with specified directory for specified user
    :param user: username
    :param app_directory: application directory
    :param doc_root: Document root for selected domain
    :param apps_manager: Application Manager. Class that responsible
           for gathering and writing information about applications
    :return: None
    Nz8No such application (or application not configured) "%s"rJrKrN)
rr�rrSr<r�update_htaccess_filer�rrYr\r]r_)r,r�rDrBr�rK�startup_file_full_pathr r r!r�@s$
r�cCs�t�|�}t�||�\}}t�|�}||kr:t�d|��tj	�
|�r�tj	�|�s`t�d|��t�||�d�
tj	j�}|s�t�d��n
t�d��tj	�|tj�}|s�t}t�|t||fd�t�||�dS)Nz8No such application (or application not configured) "%s"zNo such WSGI script "%s"�z&WSGI script is not in webapp directoryz$Path to WSGI script must be absolute�w)r	r�r
r�rr;rrSr>r(�isabs�isfile�s_partition�strip�sepr��	WSGI_PATHr`r^r[rY)r,r-�	wsgi_path�callable_objectr�r0r��app_wsgir r r!r_gs"


r_cCs&t�|�j}tj�|d�}tj�|�S)z9
    return True if user home dir has virtualenv dir
    �
virtualenv)r7r8r9r>r(r��isdir)r,�homedirr(r r r!�has_virtenv_dirsr�c
Cs:t�|�}i}t|�s|S�xtt�|��D�]\}}|dtjkrFq,y�t|||��	�}t
j�|dtj
�}t�|�}t�|�}|r�|��}|d}	|d}
nd}	}
|d|d|d|d|d	|	|
d
�d�}d|kr�t|d�d
kr�|d|d<Wn0tk
�r(}zdt|�i}Wdd}~XYnX|||<q,W|S)Nr3r-r�r�rgrF�namer)r�r)rgrFr2r3rZwsgi�domainsr�error)r	r�r�rrr;rrXrC�as_deepdictr>r(r�r�r
r��WSGI_PATTERN�search�	groupdictr�rdrf)
r,�summr-�datar2r�Z	wsgi_conf�matchr�r�r�Zenv_info�er r r!r;�s:



r;cCst�||�\}}tj�||�S)z�
    :param user: name of system user
    :param directory: name of dir with python applicatoin
    :param startup_file: name of startup file of python application
    Get full path to startup file of python application
    )r
r�r>r(r�)r,r-rKr��rel_dirr r r!r]�s	r]cCs"t�|�}t||�}|�|�dS)N)r	r�rC�extension_uninstall)r,r-r�r2r r r!�	uninstall�s

r�cCs"t�|�}t||�}|�|�dS)N)r	r�rC�extension_update)r,r-r�r2r r r!�update�s

r�c!!s

yZt�tjdd�dddddddd	d
ddd
ddddddddddddddddddg�\}}WnDtjk
r�}z$tj�t|��t�t�d�Wdd}~XYnXd }d!}d"}d"}d}d}d }	d}
|s�t�t�d�d#�t	�fd$d%�|D���st
�|d&d'd(��t�d��x4|D�]*\}}|d)k�r,�q|d*k�r>d}	�q|d+k�rPd}	�q|d,k�rbd}	�q|d-k�rtd
}	�q|d.k�r�d}	�q|d/k�r�d}	�q|d0k�r�d}	�q|d1k�r�d}	�q|d2k�r�d}	�q|d3k�r�d}	�q|d4k�r�d}	�q|d5k�rd}	�q|d6k�rd7}	|}�q|d8k�r0d}	|}�q|d9k�rDd}	|}n�|d:k�rTd
}	n�|d;k�rdd}n�|d<k�rtd=}n�|d>k�r�d?}	|}n�|d@k�r�dA}	|}n�|dBk�r�|}
n�|dCk�r�d	}	n�|dDk�r�|�dE�}nl|dFk�r�|}n\|dGk�rdH}	t
�|dI�\}
}}n:|dJk�rd=}n*|dKk�r(dL}	|}ntj�dM�t�d��qW|	d k�rdtj�dN�t�d�|	dOk�r�|�s�tj�dP�t�dQ�|dRk�r�|	d7k�r�tj�dS�t�dT�n|�r�dUdV�|�dW�D�}|�r�yt|�\}}Wnjtk
�rt
�|d&dX|d(��t�d�Yn6tk
�rPt
�|d&dYtd(��t�d�YnX|�s^|}n.||k�rLt
�|d&dZ||fd(��t�d�n�|	d[k�r�yt�|�}WnDtk
�r�}z$t
�|d&t|�d(��t�d�Wdd}~XYnX|�rL|	dk�sLyt|�}Wn6tk
�r>t
�|d&dYtd(��t�d�YnX|d\\}}�y8d\}d\}i}|	d	k�rvtd]|	���n|	dLk�r�t���|�}d }�n�|	dk�r�t�d^�}�n�|	d
k�r�t|�}�n�|	dk�r�t||d\|d|
|d_��n�|	dk�r,d`}t |�dk�r|d\�dE�}t!|||
f|da��nX|	d
k�rJt"||d\|��n:|	dk�rdtd]|	���n |	dk�r�d}|�r||}td]|	���n�|	dk�r�t#||d\|��n�|	dk�r�t$||d\|��n�|	dk�r�t%||d\|��n�|	dk�rtd]|	���n�|	dk�rtd]|	���nj|	dk�r6t&||d\�}�nN|	dHk�rVt'||d\|
|��n.|	dk�r�xt(�(�D]}|�)��qjW�n|	dk�r�x�t(�(�D]}|�*��q�Wn�|d\}|dRk�r�t&||�}x�|D]�}yd|	d7k�r�t+|||�n.|	dAk�rt,|||�n|	d?k�rt-|||�|�-|dbdcii�|d7}WnJtt.j/fk
�r|}z$|�-|d&t|�d(�i�|d7}Wdd}~XYnX�q�WWn�t0tj1fk
�r�}z$t
�|d&t|�d(��t�d�Wdd}~XYn|tk
�	rt
�|d&dYtd(��t�d�YnHt2k
�	rJ}z(t3�4�}t
�|d&|d(��t�d�Wdd}~XYnX|�	s`|�	r`t|�}|�	rv|�	rvdd}de}n\|�	r�d&}df}nL|�	r�|dek�	r�|�	r�t
�5|t|��nt
�5|i�nt
�5||�t�d\�dg�6dhd%�t7|�D��} t
�||| d(��t�|�dS)iNrzhi:v:u:lGsynfFZtcbe:d:r:go:pjK:�helpzinterpreter=zversion=zuser=zdomain=�listzlist-extensionszuser-summaryz
create-webappzupdate-interpreterzdestroy-webappzrelocate-webappztransit-webappzrestart-webappzstart-webappzstop-webappzuser-currentzset-user-currentzenable-user-extensions=zdisable-user-extensions=zreplace-user-extensions=zrecreate-virtualenvzfreeze-requirementszlist-user-extensionszsetup-wsgi=z
print-summary�json�verbosezlist-extensions-version=r�rOF)z--update-interpreterc3s|]}|d�kVqdS)rNr )r��item)�allowed_optsr r!r�szmain.<locals>.<genexpr>rPz�Unsupported option was passed. Currently, selectorctl utility supports only update-interpreter option. Please, use cloudlinux-selector utility for python interpreter)rQrR)z-iz
--interpreter)z-lz--list)z-yz--create-webappz--update-interpreter)z-nz--destroy-webapp)z-fz--relocate-webapp)z-Fz--transit-webapp)z-Zz--restart-webapp)z-Sz--start-webapp)z-tz
--stop-webapp)z-cz--user-current)z-bz--set-user-current)z-gz--list-user-extensions)z-ez--enable-user-extensionszenable-user-extensions)z--recreate-virtualenv)z--freeze-requirements)z-sz--user-summary)z-jz--jsonz	--verboseT)z-rz--replace-user-extensionszreplace-user-extensions)z-dz--disable-user-extensionszdisable-user-extensions)z-vz	--version)z-Gz--list-extensions)z-uz--userz'"z--domain)z-oz--setup-wsgiz
setup-wsgi�:)z-pz--print-summary)z-Kz--list-extensions-versionzlist-extensions-versionzunhandled optionz4ERROR:you must provide option for interpreter python)z
create-webappzdestroy-webappzrelocate-webappztransit-webappzrestart-webappzstart-webappzstop-webappzenable-user-extensionszlist-user-extensionszreplace-user-extensionszdisable-user-extensionsz
setup-wsgizuser-currentzset-user-currentzwebapp must be specifiedrw�-z.installation of all extensions is not possible�cSsg|]}|r|�qSr r )r�Z_fr r r!r�kszmain.<locals>.<listcomp>�,zNo such domain: "%s"z$Python selector not supported for %sz)domain "%s" is not owned by the user "%s")z
create-webappzdestroy-webappzrelocate-webappztransit-webappzrestart-webappzstart-webappzstop-webappzenable-user-extensionszlist-user-extensionszreplace-user-extensionszdisable-user-extensionsz
setup-wsgizuser-summaryzupdate-interpreterzuser-currentzset-user-currentrz'%s is deprecated in old python selectorr#)rDr�)r,�app_namer#r�rQ�OK�PARTIALr���
c
ss.|]&\}}d||�d|�dd��fVqdS)z%s: %srRrQr�N)r<)r��k�vr r r!r�s)8�getopt�sys�argvZGetoptError�stderr�writerfr"�exit�anyrrer�r
r��splitrrrrr	r��
ValueErrorr�DeprecationWarningrZ
ExtensionInfoZlist_extensions_versionr�interpreters_dictr;r+r��update_interpreterr�rYr�r�r�r_rZrecreateZ
pip_freezer�r�r�r�ExternalProgramFailedrZPyPIRpcApiErrorrd�	traceback�
format_exc�
print_datar�r)!�opts�argsrn�ext_list�fmtr�Z
print_summaryr,rFr�r#�o�ar�r0r�Z_extsrD�user_r�Zdomain_listr��ok�resultr��new_doc_rootr�rgr��msgrQZexit_statusrRr )r�r!�main�s




























































$
rr�cs�fdd�t�D�S)zL
    Return filtered control panels users
    :param user:
    :return:
    csg|]}t�|��r|�qSr )�fnmatch)r��	user_name)r,r r!r�sz_glob_users.<locals>.<listcomp>)r
)r,r )r,r!�_glob_users
sr!�z2.7z3.3z3.4cCs�t��rtj�dt�dStjdd�}t��}t�}�x�t	|�D�]�}|rXt
�|�rXqBt|�sbqBt
�|�}t��}	t��}
t�|j|	�t�|j|
�t���xt|�|��D�]\}}t�||�s�q�y�t|||d�}
|
��j}||kr�w�|�rtd||f�|
jd|d|d�}|�rnyt ||�WnBt!t"fk
�rl}z|�r\td	|t#|�f�Wdd}~XYnXWq�t$j%k
�r�}z |�r�td
||t#|�f�Wdd}~XYq�Xq�Wt�&|	�t�'|
�qBWdS)NzNWARNING: Update interpreter with Python selector not supported on %s, skipped
r#)r$)rBz)Updating user: "%s"; application: "%s"...TF)Zbackupr��forceZ_alt_interpreters_dictz&Failed to restart application "%s"; %sz1Failed updating user: "%s"; application: "%s"; %s)(�detect�is_pleskrrrrr�detect_DA_adminrr!r
�user_should_be_skippedr�r7r8r>�getuid�getgid�setregid�pw_gid�setreuid�pw_uid�secureio�set_capabilityrr�rrCr3r#rZupdate_python_interpreterrYr��IOErrorrfr�InterpreterError�setuid�setgid)r,r#r�r�Zalt_interpreters_dictZis_da_panelrBr �user_pwd�real_uidZreal_gidZ	app_name_r�r2Zenv_python_verZ
update_resultr�r r r!rsP


*,
r)NT)NN)NNNNNNNN)N)NN)N)NNFN)NN)N)N)N)r�)r�r"r�T)V�
__future__rrrrr�r>r�r�rr7rr.rryZ$requests.packages.urllib3.exceptionsrzr{�
exceptionsr}Zrequests.exceptionsr�future.utilsrr�rr	r
�cldetectlibr$�clcommon.cpapirrr
r�clcommon.cpapi.cpapiexceptionsrr�clcommon.utilsr�clselectpython.apps_managerrrr�clselectexceptrr�
clselectprintr�clselectpythonuserrrr�baseclselectrrr\rar`r[rZ�compiler�r"r4rCr+rtr�r�r�r�r�r�rYr�r�r_r�r;r]r�r�rr!rr r r r!�<module>sz
$


g
4

M!
.


'
	*
C
	

Youez - 2016 - github.com/yon3zu
LinuXploit