[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.222.115.155: ~ $
�
v�{gc@sddlZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZmZmZer=ddlmZmZmZndZd=ZdZdZdZidd6dd6dd6dd6dd6Z idddgd6ddgd6ddgd 6Z!d!�Z"d"�Z#d#e$fd$��YZ%d%�Z&dd&�Z(d'�Z)d(�Z*d)�Z+e,dd*�Z-d+�Z.d,�Z/e#d-��Z0e#d.��Z1d/�Z2d0�Z3d1�Z4d2�Z5d3�Z6d4�Z7e#e&d5���Z8ej9e#e&ej:dd6����Z;e#d7��Z<d8�Z=d9�Z>dd:�Z?d;�Z@d<�ZAdS(>i����Ni(t	constants(tconfig(tconfig_handlers(t	log_utils(t
process_utils(tutils(tauth(terrors(tselinux(tfetch(tupdate_utils(tserver_info(tjson_loads_nstrturlquotet	HTTPError(tDicttListtTuples!/usr/libexec/kcare/libcare-clients/run/libcare/libcare.socks/var/run/libcare.socks /var/cache/kcare/libcare_patchess /var/cache/kcare/libcare_cvelists&/etc/sysconfig/kcare/libcare.logrotatetdbtmysqldtmariadbdtpostgrestqemusqemu-kvmsqemu-system-x86_64tlibctlibssltlibscGstjjtjd||�S(Nt	userspace(tostpathtjoinRtPATCH_CACHE(tlibnametparts((s-/usr/libexec/kcare/python/kcarectl/libcare.pytget_userspace_cache_path.scs�fd�}|S(NcsYz�||�SWdytd�Wn/tk
rS}tjdj|�dt�nXXdS(Nt
clearcaches$Libcare cache clearing failed: '{0}'t	print_msg(tlibcare_clientt	ExceptionRtlogerrortformattFalse(targstkwargsterr(tclbl(s-/usr/libexec/kcare/python/kcarectl/libcare.pytwrapper3s((R,R-((R,s-/usr/libexec/kcare/python/kcarectl/libcare.pytclear_libcare_cache2s
tUserspacePatchLevelcBs)eZdd�Zdd�Zd�ZRS(cCst||�j||�S(N(tsupert__new__(tclsRtbuildidtleveltbaseurl((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR1AscCs(||_||_||_||_dS(N(R4RR3R5(tselfRR3R4R5((s-/usr/libexec/kcare/python/kcarectl/libcare.pyt__init__Ds			cGst|j|jt|�|�S(N(R!RR3tstr(R6R ((s-/usr/libexec/kcare/python/kcarectl/libcare.pyt
cache_pathJsN(t__name__t
__module__tNoneR1R7R9(((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR/@scsd����fd�}|S(NcSsd
\}}z�|dkr't�}ni}g}xft|�D]X}|jdd�||jd�<x0|jdg�D]}|j|jd��qxWq@Wdjg|j�D]}dj|�^q��}dj|�}Wdtjt	|d	t
�tjt|d	t
�XdS(s(KPT-1543 Save info about applyed patchestslatest-versiontpackagetpatchestcves
t Nt
ensure_dir(R=R=(R<t
_libcare_infot_get_patches_infotgettappendRtitemsRtatomic_writetLIBCARE_PATCHEStTruetLIBCARE_CVE_LIST(tinfotversionstcvestpackagest	cves_listtrectpatch((s-/usr/libexec/kcare/python/kcarectl/libcare.pytsave_current_stateOs1cs/d}z�||�}|SWd�|�XdS(N(R<(R)R*RL(R,RS(s-/usr/libexec/kcare/python/kcarectl/libcare.pyR-as
((R,R-((R,RSs-/usr/libexec/kcare/python/kcarectl/libcare.pytrefresh_applied_patches_listNs	c
Cs�tjpd}t|�}t|j��}tjtj|d�|||d�}|dtj	tj
d|��7}tj|d�}y"tjt
j�|dt�}Wn3tjk
r�tjt||�dt��nXtj|j�ttj|j���}t|||d	|jd
��}t|d	�}	t|||	d�}
tjj |
�s~tjj!|
�dkr�tj|d
�}y,tj"||
dtj#dtj$|��Wq�t%k
r�}|j&dkr�tj'd��n�q�Xnt|||	�}dd|
d|dg}
t(j)|
dtdt�\}}}|rotj*dj+|||���nt||d�}tjj,|�r�tjj-|�r�tj|�ntj.|	|d�tj/|d|�dS(Ntmaintus	latest.v1s?info=tupdateRt
check_licenset
ignore_errorsR4R5spatch.tar.gzit	patch_urltcheck_signaturethash_checkeri�i�sKC+ licence is requiredttartxfs-Cs--no-same-ownertcatch_stdouttcatch_stderrs(Patches unpacking error: '{0}' '{1}' {2}tlatests.tmp(i�i�(0RtPREFIXR
tstripRtget_patch_server_urltLIBNAME_MAPRERtencode_server_lib_infotserver_lib_infoR	twrap_with_cache_keyRturlopen_authR(RtNotFoundtshutiltrmtreeR!RJRtset_config_from_patchservertheadersRtnstrtreadR/R8RRtexiststgetsizet	fetch_urlt
USE_SIGNATUREtget_hash_checkerRtcodetNoLibcareLicenseExceptionRtrun_commandt
KcareErrorR'tislinktisdirtsymlinktrename(Rtbuild_idtpatch_leveltprefixturlt	cache_dsttresponsetmetaR4tplevelt
patch_pathtextdsttcmdRvtstdouttstderrt	link_name((s-/usr/libexec/kcare/python/kcarectl/libcare.pytfetch_userspace_patchlsD'#""+,
$!%cCsj|t_|st�ntjd|r/dnd�|rFt�ntjjd|r^dnd�dS(NtLIBCARE_DISABLEDtFALSEtYESslibcare service is tenabledtdisabled(	RR�tlibcare_server_stopRt
update_configtlibcare_server_startRtkcarelogRL(R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pytset_libcare_status�s


cCsEytjdd�ddg}Wntk
r3dSXtj|�dS(Ntservices
/usr/sbin/s/sbin/tlibcaretstop(s
/usr/sbin/s/sbin/(Rtfind_cmdR%Rx(R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR��s

cCs�tjstjjtj�rStjtjddg�tjtjddg�nAytjdd	�ddg}Wnt	k
r�dSXtj|�dS(
Nsreset-failedR�trestartslibcare.socketR�s
/usr/sbin/s/sbin/tstart(s
/usr/sbin/s/sbin/(
RtSKIP_SYSTEMCTL_CHECKRRRqt	SYSTEMCTLRRxR�R%(R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR��s
csadjd�t|pg�D��}ddg}�sM|dd|g7}nyt|�}Wn+tk
r�}tjdj|���nXg}xN|jd�D]=}|r�y|jt	j
|��Wq�tk
r�q�Xq�q�Wg|D]3}i|jd	�d	6|jd
�d
6|d6^q�}x8|D]0}t
�fd�|dj�D��|d<q)W|S(
Nt|css|]}dj|�VqdS(s({0})N(R'(t.0tproc((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>�sRLs-js-ls-rs/Gathering userspace libraries info error: '{0}'s
tcommtpidRc3s4|]*\}}d|ks"�r||fVqdS(tpatchlvlN((R�tktv(tpatched(s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>�s(RtsortedR$R%RRyR'tsplitRFtjsontloadst
ValueErrortpoptdictRG(R�tlimittregexpR�tlinesR+tresulttline((R�s-/usr/libexec/kcare/python/kcarectl/libcare.pyRC�s&%
@
.c	Cs�t�}xJ|D]B}x9|dj�D]'\}}|j|d|df�q'WqWg}x�tD]{}xr|D]j\}}t||t|�d�}	tjj|	�rpt	|	d��}
|j
tj|
��WdQXqpqpWqcW|S(NRR3R�s	info.jsontr(
tsetRGtaddt
USERSPACE_MAPR!R8RRtisfiletopenRFR�tload(RLR?RQt_tdataR�R�R~R�tpatch_info_filenametfd((s-/usr/libexec/kcare/python/kcarectl/libcare.pyRD�s	
#
'cCs
tt��S(N(RDRC(((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_patch_info_basic�scCs3t�}|stjd�ntji|d6�S(NsNo patched processes.R�(R�RR&R�tdumps(R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_patch_info�s	cCs3t�}|stjd�ntji|d6�S(NsNo patched processes.R�(RCRR&R�R�(R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_info�s	cCs=i}x0t�D]%}|jdd�||jd�<qW|S(Nslatest-versionR=R>(R�RE(R�RQ((s-/usr/libexec/kcare/python/kcarectl/libcare.pyt_libcare_version�s#cCs7x0t�j�D]\}}|j|�r|SqWdS(NR=(R�RGt
startswith(RR>tversion((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_versionscCsdjd�|D��dS(NR=css"|]}tj|�dVqdS(tN(Rtbstr(R�tp((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>
sR�(R(tparams((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_client_format	scCs:x$tD]}tjj|�r|SqWtjd��dS(NsLibcare socket is not found.(tLIBCARE_SOCKETRRRqRRy(tlibcare_socket((s-/usr/libexec/kcare/python/kcarectl/libcare.pytget_available_libcare_socket
s
cGstjrtjd��ntjtjtjd�}|jd�d}z�|jt	��|jtj
�t|�}tj
djd|��|j|�x-tr�|jd�}|s�Pn||7}q�W|jdd	�}tj
d
jd|��|SWd|j�XdS(NsLibcare is disabled.ii
R=sLibcare socket send: {cmd}R�isutf-8treplaces!Libcare socket recieved: {result}R�(RR�RRytsockettAF_UNIXtSOCK_STREAMt
settimeouttconnectR�tLIBCARE_SOCKET_TIMEOUTR�RtlogdebugR'tsendallRJtrecvtdecodetclose(R�tsocktresR�R�R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR$s(	

	cCs�x�|D]�}ytdt|��Wn+tk
rQ}tjdj|���nXytd�Wqtk
r�}tjdj|���qXqWdS(Ntstorages(Userspace storage switching error: '{0}'RWs%Userspace patch applying error: '{0}'(R$R!R%RRyR'(R�R�R+((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_patch_apply,s
cCs@ytd�Wn+tk
r;}tjdj|���nXdS(Ntunloads&Userspace patch unloading error: '{0}'(R$R%RRyR'(R+((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_unload9scCs�tj�t�|tjkr.tjr.dS|dkrOtt	j
��}ng}x'|D]}|jt	j|g��q\W|s�t
jdj|��dStd|�\}}}}|r�tjd��n|s�t
jd�dStjtjjtjd��t�yt|�Wn8tjk
rW}t
jt|��tjd��nXt�}	t|	�}
ttd�|	D���s�dSt
jdjd	|��t
jd
jd|
��t d�|
j!�D��}t d
�|j!�D��}||}
t"d�|
j!�D��}t
jdjdt#|
�d|��x9|
j$�D]+\}}t
jdj|t#|���qOW|	S(s0Patch userspace processes to the latest version.sNo such userspace patches: {0}R�s:There was an errors while patches downloading (unpacking).sNo patches were found.Rs+There was an errors while patches applying.css|]}|dVqdS(RN((R�titem((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>tssPatched before: {before}tbeforesPatched after: {after}taftercss"|]}|D]}|Vq
qdS(N((R�RGR�((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>{scss"|]}|D]}|Vq
qdS(N((R�RGR�((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>|scss|]}t|�VqdS(N(tlen(R�R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pys	<genexpr>ss�The patches have been successfully applied to {count} newly discovered processes. The overall amount of applied patches is {overall}.tcounttoveralls*Object `{0}` is patched for {1} processes.N(%Rtlog_all_parent_processestrotate_libcare_logsRtUPDATE_MODE_AUTORtLIB_AUTO_UPDATER<tlistR�tkeystextendRERtloginfoR'tcheck_userspace_updatesRRyRtrestore_selinux_contextRRRRR�R&R8RCt_get_userspace_procstanyR�R�tvaluestsumR�RG(tmodeR�tprocess_filtertuserspace_patchtfailedtsomething_foundR�R�R�t
data_afterR�tuniq_procs_aftertuniq_procs_beforetdiffR�R�R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pytdo_userspace_updateBsR


	
	#cCs_yt�\}}}}Wntjk
r0dSX|r;dS|rEdStjdd�r[dSdS(Niitfilenames.libcarestatusii(R�RRyR
tstatus_gap_passed(R�R�tlibs_not_patched((s-/usr/libexec/kcare/python/kcarectl/libcare.pytget_userspace_update_status�scCs�i}xy|D]q}xh|dj�D]V\}}|jd�r$||krXg||<n||j|d|df�q$q$Wq
W|S(NRR�R�R�(RGRERF(RLR�R�RRQ((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR��s

*cCset�}xU|D]M}xD|dj�D]2\}}|j||d|jdd�f�q'WqW|S(NRR3R�i(R�RGR�RE(RLR�R�RRQ((s-/usr/libexec/kcare/python/kcarectl/libcare.pyt_get_userspace_libs�s
	
.cCs?|s5g}gtj�D]}|j|�^qntdtd|�}t|�}t}}t}x�t|�D]�}|\}}	}
y/t||	|
�t}|
dkr�t}nWqst	j
t	jfk
r�qst	jk
r��qst	j
k
r}t}tjt|��qsXqsWtjdd�||||fS(NR�R�iRs.libcarestatus(R�R�R�RCR(R�RJRR�RRjRwtAlreadyTrialedExceptionRyRR&R8R
ttouch_status_gap_file(R�Rtdata_beforeR�R�R�RRQRR~R�R�((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR��s.)

cCs�d}d}tjddt�}|r�y(tj|tgdt�\}}}Wn%tk
rv}d}t|�}nX|r�tj	dj
|�dt�q�ntjd	dt�d
}tj
j|�s�dStjd}y�tj|�}tjd
�}g|D]*}	|j|	�rtj
j||	�^q}
g|
D]}tj
j|�|f^q:}|jdt�d}
xY|D]Q\}}|
tj
j|�7}
|
|kr{tj|�tjjd|�q{q{WWn$tk
r�tjddt�nXdS(NiR=t	logrotatet	raise_excR`is5failed to run logrotate for libcare logs, stderr: {0}R#slogrotate utility wasn't founds/var/log/libcare/iis^\d+\.log.*treverses%Removed %s because of logs size limits)Failed to cleanup libcare server logfilesi(RR�R(RxtLIBCARE_LOGROTATE_CONFIGRJR%R8RR&R'tlogwarnRRR{Rt!LIBCARE_PIDLOGS_MAX_TOTAL_SIZE_MBtlistdirtretcompiletmatchRtgetctimetsortRrtremoveR�RLtlogexc(trcR�tlogrotate_pathR�tetlibcare_log_directorytmax_total_sizet	log_filest	pidlog_retfntpidlog_filestfptpidlog_files_with_ctt
total_sizetfilepath((s-/usr/libexec/kcare/python/kcarectl/libcare.pyR��s<("
7+

cCsbytjdd	�ddg}Wntk
r3tSXtj|dtdt�\}}}|dkS(
sKAssume that whenever the service is not running, we did not patch anything.R�s
/usr/sbin/s/sbin/R�tstatusR_R`i(s
/usr/sbin/s/sbin/(RR�R%R(RxRJ(R�RvR�((s-/usr/libexec/kcare/python/kcarectl/libcare.pytlibcare_server_started�s
$(s/run/libcare/libcare.socks/var/run/libcare.sock(BRRRkR�R�R=RRRRRRRRRR	R
Rtpy23RR
RR(ttypingRRRtLIBCARE_CLIENTR�RIRKRReR�R!R.tintR/RTR<R�R�R�R�RJRCRDR�R�R�R�R�R�R�R$R�R�tskip_if_no_selinux_moduletUPDATE_MODE_MANUALR�RR�RR�R�R$(((s-/usr/libexec/kcare/python/kcarectl/libcare.pyt<module>sz)
			-	
										
G			*

Filemanager

Name Type Size Permission Actions
__init__.py File 69.58 KB 0644
__init__.pyc File 64.25 KB 0644
__init__.pyo File 64.25 KB 0644
__main__.py File 829 B 0644
__main__.pyc File 926 B 0644
__main__.pyo File 926 B 0644
auth.py File 11.87 KB 0644
auth.pyc File 11.82 KB 0644
auth.pyo File 11.82 KB 0644
config.py File 1.71 KB 0644
config.pyc File 2.01 KB 0644
config.pyo File 2.01 KB 0644
config_handlers.py File 7.26 KB 0644
config_handlers.pyc File 8.47 KB 0644
config_handlers.pyo File 8.47 KB 0644
constants.py File 1.27 KB 0644
constants.pyc File 1.34 KB 0644
constants.pyo File 1.34 KB 0644
errors.py File 1.29 KB 0644
errors.pyc File 2.94 KB 0644
errors.pyo File 2.94 KB 0644
fetch.py File 4.88 KB 0644
fetch.pyc File 5.47 KB 0644
fetch.pyo File 5.47 KB 0644
http_utils.py File 4.06 KB 0644
http_utils.pyc File 4.16 KB 0644
http_utils.pyo File 4.16 KB 0644
kcare.py File 8.56 KB 0644
kcare.pyc File 11.09 KB 0644
kcare.pyo File 11.09 KB 0644
libcare.py File 17.24 KB 0644
libcare.pyc File 19.16 KB 0644
libcare.pyo File 19.16 KB 0644
log_utils.py File 2.82 KB 0644
log_utils.pyc File 3.75 KB 0644
log_utils.pyo File 3.75 KB 0644
platform_utils.py File 3.4 KB 0644
platform_utils.pyc File 4.56 KB 0644
platform_utils.pyo File 4.56 KB 0644
process_utils.py File 3.81 KB 0644
process_utils.pyc File 3.67 KB 0644
process_utils.pyo File 3.67 KB 0644
py23.py File 1.74 KB 0644
py23.pyc File 2.15 KB 0644
py23.pyo File 2.15 KB 0644
selinux.py File 1.68 KB 0644
selinux.pyc File 2.43 KB 0644
selinux.pyo File 2.43 KB 0644
server_info.py File 2.99 KB 0644
server_info.pyc File 3.48 KB 0644
server_info.pyo File 3.48 KB 0644
update_utils.py File 923 B 0644
update_utils.pyc File 1.18 KB 0644
update_utils.pyo File 1.18 KB 0644
utils.py File 7.07 KB 0644
utils.pyc File 7.8 KB 0644
utils.pyo File 7.8 KB 0644