GRAYBYTE WORDPRESS FILE MANAGER7029

Server IP : 149.255.58.128 / Your IP : 216.73.216.211
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /usr/lib/python3.9/site-packages/tuned/utils/__pycache__/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /usr/lib/python3.9/site-packages/tuned/utils/__pycache__//commands.cpython-39.opt-1.pyc
a

��MgB�@stddlZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
TddlmZej
��ZGdd�d�ZdS)�N)�*)�TunedExceptionc@s�eZdZdbdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdcdd�Z	dddd�Z
dd�Zdd�Zdd�Z
dedd�Zdfdd�Zdgd d!�Zdhd#d$�Zdid%d&�Zdjd'd(�Zdkd)d*�Zdld+d,�Zd-d.�Zd/d0�Zdmd1d2�Zd3d4�Zd5d6�Zdnd7d8�Zddigdfd9d:�Zdod;d<�Zd=d>�Zd?d@�ZdAdB�Z dpdDdE�Z!dFdG�Z"dHdI�Z#dJdK�Z$dLdM�Z%dqdNdO�Z&dPdQ�Z'dRdS�Z(dTdU�Z)dVdW�Z*dXdY�Z+dZd[�Z,d\d]�Z-d^d_�Z.d`da�Z/dS)r�commandsTcCs
||_dS�N)�_logging)�selfZlogging�r�8/usr/lib/python3.9/site-packages/tuned/utils/commands.py�__init__szcommands.__init__cCs|jrt�|�dSr)r�log�error�r�msgrrr	�_errorszcommands._errorcCs|jrt�|�dSr)rr�debugr
rrr	�_debugszcommands._debugc	Cs.t|�����}ddddddddd��||�S)N�1�0)�YZYES�TZTRUE�NZNO�FZFALSE)�str�upper�strip�get)r�value�vrrr	�get_boolszcommands.get_boolcCst�ddt|����S)Nz\s+� )�re�subrr)r�srrr	�	remove_wsszcommands.remove_wscCst�dd|�S)Nz^"(.*)"$z\1)r r!)rrrrr	�unquote"szcommands.unquote�\cCs|�|d||f�S)Nz%s%s��replace)rr"Zwhat_escapeZ	escape_byrrr	�escape&szcommands.escapecCs|�|d�S)N�r&)rr"Zescape_charrrr	�unescape*szcommands.unescapecCs|d|t|�|S)Nr)�len)r�s1�pos�s2rrr	�	align_str.szcommands.align_strcCs.g}|dur*t|���D]}|t|�7}q|Sr)�sorted�items�list)r�d�l�irrr	�	dict2list4s
zcommands.dict2listcCs(|durdSt�dd�t|�����S)Nz(%s)z)|()r �compile�joinr2�keys)rr3rrr	�re_lookup_compile<szcommands.re_lookup_compileNrcsV�dur|dur.|Snt��dks*|dur.|S|dur@|���}|��fdd�||�S)Nrcst����|jdS)N�)r2�values�	lastindex)�mo�r3rr	�<lambda>M�z.commands.multiple_re_replace.<locals>.<lambda>)r+r:r!)rr3r"�r�flagsrr?r	�multiple_re_replaceDs
zcommands.multiple_re_replacecCsRt|�dks|durdS|dur*|�|�}|�|�}|rNt|���|jdSdS�Nrr;)r+r:�searchr2r<r=)rr3r"rBr>rrr	�	re_lookupSs

zcommands.re_lookupFc

Cs|�d||f�|r2tj�|�}tj�|�r2d}zh|rBt�|�|rt|j|dd���t|�krt|�d|�WdSt	|d�}|�
t|��|��d}Wn`tt
fy�}	zDd}t|t�r�|r�t|t�r�|	j|vr�|�d||	f�WYd}	~	n
d}	~	00|S)	ahWrite data to a file.

		Parameters:
		f -- filename where to write
		data -- data to write
		makedir -- if True and the path doesn't exist, it will be created
		no_error -- if True errors are silenced, it can be also list of ignored errnos
		ignore_same -- if True and the write would not change the file, it is skipped

		Return:
		bool -- True on success
		zWriting to file: '%s' < '%s'FT��no_errorz=Skipping the write to file '%s', the content would not change�wz Writing to file '%s' error: '%s'N)r�os�path�dirname�isdir�makedirs�	read_filerr�open�write�close�OSError�IOError�
isinstance�boolr2�errnor)
r�f�dataZmakedirrIZignore_samer3�fd�rc�errr	�
write_to_file]s0


��(zcommands.write_to_filer)c
Csx|}zt|d�}|��}|��Wn>ttfy`}z"|sL|�d||f�WYd}~n
d}~00|�d||f�|S)NrBz"Error when reading file '%s': '%s'z Read data from file: '%s' > '%s')rQ�readrSrTrUrr)rrYZerr_retrI�	old_valuer[r]rrr	rP�s
(zcommands.read_filec
Csp|�d|�tj�|�rlzt�||�Wn@tyj}z(|sTt�d|t	|�f�WYd}~dSd}~00dS)NzRemoving tree: '%s'zcannot remove tree '%s': '%s'FT)
rrKrL�exists�shutil�rmtreerTrrr�rrYrIrrrr	rc�szcommands.rmtreec
Csn|�d|�tj�|�rjzt�|�Wn@tyh}z(|sRt�d|t|�f�WYd}~dSd}~00dS)NzRemoving file: '%s'zcannot remove file '%s': '%s'FT)	rrKrLra�unlinkrTrrrrdrrr	re�szcommands.unlinkc
Csj|�d||f�zt�||�WnBtyd}z*|sNt�d||t|�f�WYd}~dSd}~00dS)NzRenaming file '%s' to '%s'z%cannot rename file '%s' to '%s': '%s'FT)rrK�renamerTrrr)r�src�dstrIrrrr	rf�szcommands.renamec
Cshz$t�d||f�t�||�WdStyb}z&|sLt�d|||f�WYd}~dSd}~00dS)Nzcopying file '%s' to '%s'Tz!cannot copy file '%s' to '%s': %sF)rrrb�copyrUr)rrgrhrIr]rrr	ri�sz
commands.copyc	Cs6|�|�}t|�dkrdS|�|tj|||tjd��S�NrF�rC)rPr+r^r r!�	MULTILINE)rrY�pattern�replrZrrr	�replace_in_file�s
zcommands.replace_in_filecCs4|�|�}t|�dkrdS|�||j||tjd��Srj)rPr+r^rDr rl)rrYr3rZrrr	�multiple_replace_in_file�s
z!commands.multiple_replace_in_filecCs�|�|�}|D]�}t|�}t||�}tjd|d|tjd�durz|r�t|�dkrh|ddkrh|d7}|d||f7}qtjd|d	d
|�|�d|tjd�}q|�||�S)Nz\bz\s*=.*$rkr����
z%s="%s"
z\b(z\s*=).*$z\1"�")	rPrr rFrlr+r!r(r^)rrYr3�addrZ�opt�orrrr	�add_modify_option_in_file�s
,z"commands.add_modify_option_in_filecCs"|�|�}t�t|��d����S�Nzutf-8)rP�hashlibZmd5r�encode�	hexdigest�rrYrZrrr	�md5sum�s
zcommands.md5sumcCs"|�|�}t�t|��d����Srx)rPryZsha256rrzr{r|rrr	�	sha256sum�s
zcommands.sha256sumcCs|�tj|���Sr)rP�constsZMACHINE_ID_FILEr)rrIrrr	�get_machine_id�szcommands.get_machine_idc
CsXd}tj��}d|d<|�|�|�dt|��d}	d}
z�t|tt|||ddd�}|��\}	}|j	}|r�||vr�d|vr�|dd�}
t
|
�dkr�|	dd�}
d	d
�|�|
f}
|s�|�|
�Wnzt
tf�y:}z\|jdur�|jnd}t|�|v�r&d|v�r&d	d
�|�|f}
|�s&|�|
�WYd}~n
d}~00|�rL||	|
fS||	fSdS)Nr�C�LC_ALLz
Executing %s.r)T)�stdout�stderr�env�shell�cwdZ	close_fdsZuniversal_newlinesrqzExecuting '%s' error: %sr)rK�environri�updaterr�Popen�PIPEZcommunicate�
returncoder+r8rrTrUrX�abs)r�argsr�r�r�Z	no_errorsZ
return_errZretcodeZ_environment�out�err_msg�proc�errZerr_outr]rrr	�execute�s@

� 
zcommands.executecCs.t�d|�}|r|�d�S|r*|��dS|S)Nz.*\[([^\]]+)\].*r;r)r �match�group�split)r�optionsZdosplit�mrrr	�get_active_options
zcommands.get_active_optioncCs*t|�}|dkp(|jd|dd���dkS)Nrz$/sys/devices/system/cpu/cpu%s/onlineTrHr)rrPr)r�cpuZscpurrr	�
is_cpu_onlineszcommands.is_cpu_onlinecCs^|durdSt|��dd�}zt|d�}Wn(tyRt�dt|��gYS0|�|�S)N�,r)�zinvalid hexadecimal mask '%s')rr'�int�
ValueErrorrr�bitmask2cpulist)r�maskr�rrr	�hex2cpulists
zcommands.hex2cpulistcCs8d}g}|dkr4|d@r"|�|�|dL}|d7}q|SrE)�append)rr�r��cpusrrr	r�*s

zcommands.bitmask2cpulist�'"c	Cs^g}|dur|S|}t|�turD|dur6t|��|�}t|��d�}g}g}d}d}|D�]}	t|	�}
|r�t|
�dkr�d}|�|�d}n||
7}qX|
dd���dkr�d}|
}qX|
�rT|
ddks�|
dd	k�rT|
d
d��d�}zPt|�d
k�r|ttt	|d�t	|d
�d
��7}n|�t	|
d
d���Wnt
�yPgYS0qXt|
�dkrX|�|
�qXt|�dk�r�|�|�|D]�}	|	�d�}|	dd���dk�r�||�|	�7}njzLt|�d
k�r�|ttt	|d�t	|d
�d
��7}n|�t	|d��Wnt
�y$gYS0�q�ttt
|���}
|D]}||
v�r>|
�|��q>|
S)Nr�Fr)r��0xT�^�!r;�-)�typer2rrr�r+r��lower�ranger�r�r�r0�set�remove)rr4Zstrip_chars�rlZllZll2Z
negation_listZhexmaskZhvr�sv�nlZvlZcpu_listr�rrr	�cpulist_unpack=sj


 
�


(
zcommands.cpulist_unpackcCs�|�|�}|dust|�dkr"|Sd}|}g}|dt|�kr�||d||dkr�||kr�|�t||�dt||��n|�t||��|d}|d7}q.|dt|�kr�|�t||�dt|d��n|�t|d��|S)Nrr;r�rq)r�r+r�r)rr4r5�jr�rrr	�cpulist_pack�s"
$
$zcommands.cpulist_packcCs.|�|�}|�|�d��}tt|�t|��S)Nz/sys/devices/system/cpu/online)r�rPr2r�)rr4r�Zonlinerrr	�cpulist_invert�s
zcommands.cpulist_invertcs�|durdS|�|�}|dur"dS|�|�}d|�t��}|ddkrX|d|d7}��|��d��fdd�tdt��d�D��S)Nz%x�rr�c3s|]}�||d�VqdS)r�Nr)�.0r5�r"rr	�	<genexpr>�rAz'commands.cpulist2hex.<locals>.<genexpr>)r��cpulist2bitmaskr+�zfillr8r�)rr4Zulr�Zlsrr�r	�cpulist2hex�s


zcommands.cpulist2hexcCs d}|D]}|td|�O}q|S)Nrr�)�pow)rr4r�rrrr	r��szcommands.cpulist2bitmaskcsd��fdd�|D��S)Nr�c3s|]}�t|�VqdSr�r�r�r��prefixrr	r��rAz*commands.cpulist2string.<locals>.<genexpr>)r8)rr4r�rr�r	�cpulist2string�szcommands.cpulist2stringcCsb|dd���dkrH|dd�}|dd���dkrHdd�|�|�D�St�d|�}dd�|D�S)Nrr�zcpulist:cSsg|]}dt|��qS)r�r�r�rrr	�
<listcomp>�rAz(commands.devstr2devs.<locals>.<listcomp>z\s*(?<!\\),\s*cSsg|]}t|��dd��qS)z\,r�)rr'r�rrr	r��rA)r�r�r r�)rr"r4rrr	�devstr2devs�szcommands.devstr2devsc
CsBz|�|d�WSty<}z|�|�WYd}~Sd}~00dS)NF)�wait�	TypeError)rZ	terminate�timer]rrr	r��sz
commands.waitc	Cs�t|�����}dD]�}|�|�}|dkr,qzht|d|��}||d�}|dkr\|d9}n0|dkrn|d9}n|dkr�|d9}n|d	kr�d}|WSty�YdS0qdS)
N)�KB�MB�GBr)rqr�ir�ir�i@r))rrr�rfindr�r�)rr"ZunitZunit_ix�val�urrr	�get_size�s&




zcommands.get_sizec
Cs�d}d}z<ttjd��}|����}Wd�n1s80YWnnty�}z$|jtjkrltd|��WYd}~n<d}~0t	t
fy�}ztd|��WYd}~n
d}~00z^ttjd��<}|����}|dtjtj
fvr�tdtj��Wd�n1�s0YWntt�yR}z&|jtjk�r>td|��WYd}~n>d}~0t	t
f�y�}ztd|��WYd}~n
d}~00|dk�r�d}n
|tj
k}|dk�r�d}||fS)Nr)rBz!Failed to read active profile: %szInvalid value in file %s.zFailed to read profile mode: %s)rQr�ACTIVE_PROFILE_FILEr_rrUrX�ENOENTrrT�EOFError�PROFILE_MODE_FILE�ACTIVE_PROFILE_AUTO�ACTIVE_PROFILE_MANUAL)r�profile_name�moderYr]�manualrrr	�get_active_profile�s4. "2 "


zcommands.get_active_profilec
Cs
zFttjd��&}|dur&|�|d�Wd�n1s:0YWn6ttfy|}ztd|j��WYd}~n
d}~00zNttjd��.}|r�tj	ntj
}|�|d�Wd�n1s�0YWn8ttf�y}ztd|j��WYd}~n
d}~00dS)NrJrrz!Failed to save active profile: %szFailed to save profile mode: %s)rQrr�rRrTrUr�strerrorr�r�r�)rr�r�rYr]r�rrr	�save_active_profile�s0$0zcommands.save_active_profilec
Cs�d}z<ttjd��}|����}Wd�n1s40YWnnty|}z$|jtjkrhtd|��WYd}~n<d}~0t	t
fy�}ztd|��WYd}~n
d}~00|dkr�d}|S)Nr)rBz1Failed to read the active post-loaded profile: %s)rQr�POST_LOADED_PROFILE_FILEr_rrUrXr�rrTr��rr�rYr]rrr	�get_post_loaded_profile	s. "z commands.get_post_loaded_profilec
Cs�zFttjd��&}|dur&|�|d�Wd�n1s:0YWn6ttfy|}ztd|j��WYd}~n
d}~00dS)NrJrrz1Failed to save the active post-loaded profile: %s)rQrr�rRrTrUrr�r�rrr	�save_post_loaded_profiles0z!commands.save_post_loaded_profilecCsBzt�||�}Wn&ty6ddl}|�||�}Yn0|�|�S)Nr)r�	maketrans�AttributeError�string�	translate)r�textZsource_charsZ
dest_charsZtransr�rrr	�tr szcommands.trcCs&|p$tdd�|D��o$t|�tjkS)Ncss|]}|tjvVqdSr)rZNAMES_ALLOWED_CHARS)r��crrr	r�*rAz)commands.is_valid_name.<locals>.<genexpr>)�allr+rZNAMES_MAX_LENGTH)r�namerrr	�
is_valid_name)szcommands.is_valid_name)T)r%r%)r%)Nr)N)FFF)r)F)F)F)F)F)T)T)T)r�)r))0�__name__�
__module__�__qualname__r
rrrr#r$r(r*r/r6r:rDrGr^rPrcrerfrirorprwr}r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr	rsZ






#









'
	
D
		r)rXryZ
tuned.logsZtunedrirKrbZtuned.constsrr �
subprocessZtuned.exceptionsrZlogsrrrrrrr	�<module>s


[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
December 04 2024 22:44:57
0 / root
0755
__init__.cpython-39.opt-1.pyc
0.144 KB
December 02 2024 09:49:29
0 / root
0644
__init__.cpython-39.pyc
0.144 KB
December 02 2024 09:49:29
0 / root
0644
commands.cpython-39.opt-1.pyc
16.334 KB
December 02 2024 09:49:29
0 / root
0644
commands.cpython-39.pyc
16.334 KB
December 02 2024 09:49:29
0 / root
0644
config_parser.cpython-39.opt-1.pyc
1.962 KB
December 02 2024 09:49:29
0 / root
0644
config_parser.cpython-39.pyc
1.962 KB
December 02 2024 09:49:29
0 / root
0644
global_config.cpython-39.opt-1.pyc
4.443 KB
December 02 2024 09:49:29
0 / root
0644
global_config.cpython-39.pyc
4.443 KB
December 02 2024 09:49:29
0 / root
0644
nettool.cpython-39.opt-1.pyc
4.712 KB
December 02 2024 09:49:29
0 / root
0644
nettool.cpython-39.pyc
4.712 KB
December 02 2024 09:49:29
0 / root
0644
plugin_loader.cpython-39.opt-1.pyc
2.068 KB
December 02 2024 09:49:29
0 / root
0644
plugin_loader.cpython-39.pyc
2.184 KB
December 02 2024 09:49:29
0 / root
0644
polkit.cpython-39.opt-1.pyc
1.706 KB
December 02 2024 09:49:29
0 / root
0644
polkit.cpython-39.pyc
1.706 KB
December 02 2024 09:49:29
0 / root
0644
profile_recommender.cpython-39.opt-1.pyc
5.185 KB
December 02 2024 09:49:29
0 / root
0644
profile_recommender.cpython-39.pyc
5.185 KB
December 02 2024 09:49:29
0 / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF