MOON
Server: Apache
System: Linux server2.shieldcogroup.com 3.10.0-1160.119.1.el7.tuxcare.els12.x86_64 #1 SMP Fri Nov 8 05:49:38 UTC 2024 x86_64
User: jacom (1029)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/libexec/kcare/python/kcarectl/kcare.pyc
�
%��ic@sBddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZer�ddlmZmZmZndZd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zdefd��YZ de fd��YZ!de fd��YZ"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*e
j+d��Z,e
j+d��Z-e
j+d��Z.d �Z/d!�Z0d"�Z1d#�Z2d$�Z3d%�Z4e
j+d&��Z5d'�Z6d(�Z7d)�Z8d*�Z9dS(+i����Ni(tconfigt	constantst	log_utilst
process_utilstutils(tSafeExceptionWrapper(tjson_loads_nstr(tListtOptionaltTuplesuname: cCstj|�p|dkS(Ns.-_+(tstrtisalnum(tc((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
is_uname_charscCs�t�}tt||tj�d��S}xI|j�D];}|jt�r7djt	t
|tt�j���Sq7WWdQXdS(Ntrt(
tget_kernel_hashtopentget_cache_pathRt
PATCH_INFOt	readlinest
startswithtUNAME_LABELtjointfilterR
tlentstrip(tpatch_leveltkhashtftline((s+/usr/libexec/kcare/python/kcarectl/kcare.pytparse_unames	!0cCsatjjtj�r]y1ttjd�}|j|�|j�tSWq]t	k
rYq]Xnt
S(Ntw(tostpathtexistsRtKCARE_UNAME_FILERtwritetclosetTruet	ExceptiontFalse(tnew_versionR((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_update_effective_version%s


cCsAttjd�}ztj|j��j�SWd|j�XdS(Ntrb(RRtKERNEL_VERSION_FILEthashlibtsha1treadt	hexdigestR&(R((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR1sc	Cs�tjjtjd�}tjj|�r�t|d��i}|j�j�}yt	|�Wn;t
k
r�tt	tjj|���St
k
r�dSX|SWdQXndS(s:Returns timestamp from PATCH_CACHE/stoped.at if its exsitss
stopped.atRterrorNs-1(R!R"RRtPATCH_CACHER#RR0trstriptintt
ValueErrorR
tgetctimeR((tstopped_at_filenametfhtvalue((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
get_last_stop<s


cCswtjpd}tjpd}dj||t|�|g�}tjd|f}|rg||f7}ntjj|�S(Ntnonetdefaultt-tpatches(	RtPREFIXt
PATCH_TYPERR
RR3R!R"(Rtpleveltfnametprefixtptypet	patch_dirtresult((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRMs!cGstjtj|�S(N(Rtget_patch_server_urlRR@(tparts((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_kernel_prefixed_urlWstBaseKernelPatchLevelcBseZd�Zd�ZRS(cGst|jt|�|�S(N(RRR
(tselfRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
cache_path\scCs,i|jd6|jd6|jd6|jd6S(NtlevelRtbaseurltrelease(RNRRORP(RL((s+/usr/libexec/kcare/python/kcarectl/kcare.pytas_dict_s



(t__name__t
__module__RMRQ(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRK[s	tKernelPatchLevelcBs2eZdd�Zdd�Zd�Zd�ZRS(cCst||�j||�S(N(tsupert__new__(tclsRRNRORP((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRViscCs(||_||_||_||_dS(N(RNRRORP(RLRRNRORP((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt__init__ls			cGstj|j|j|�S(N(RRHROR(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkmod_urlrscGs"tj|j|jt|�|�S(N(RRHRORR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytfile_urlusN(RRRStNoneRVRXRYRZ(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRThs	tLegacyKernelPatchLevelcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsCyt||�j||�SWntk
r>}t|��nXdS(N(RURVR6R(RWRRNtexc((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRVzscCs(||_||_d|_d|_dS(N(RNRR[RORP(RLRRN((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRX�s			cGs8dtjkr(t|jt|�|�St|j|�S(Nspatches.kernelcare.com(RtPATCH_SERVERRJRR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRY�scGst|jt|�|�S(N(RJRR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRZ�scCst|jt|�|�S(N(RTRR5(RLRO((s+/usr/libexec/kcare/python/kcarectl/kcare.pytupgrade�s(RRRSRVRXRYRZR_(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR\ys
				cCsoyDttjjtjd�d��}tj|j�|�WdQXWn$t	k
rjt
jddt�nXdS(Nskernel_patch_level.jsonR s!failed to dump kernel patch levelt	print_msg(
RR!R"RRR3tjsontdumpRQR(RtlogexcR)(tkernel_patch_levelR((s+/usr/libexec/kcare/python/kcarectl/kcare.pytdump_kernel_patch_level�s
$ 
cCsfy;ttjjtjd���}t|j��SWdQXWn$tk
rat	j
ddt�nXdS(Nskernel_patch_level.jsons(failed to read dumped kernel patch levelR`(RR!R"RRR3RR0R(RRcR)(R((s+/usr/libexec/kcare/python/kcarectl/kcare.pytread_dumped_kernel_patch_level�s
!
cCs>tg|D]}|tjj|�f^q
dd�dt�S(NtkeycSs|dS(Ni((tpair((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt<lambda>�streverse(tsortedR!R"R7R'(t
files_listtit((s+/usr/libexec/kcare/python/kcarectl/kcare.pytsort_files_by_ctime�s+	cCs|d}tjjd�s|Std��N}xD|D]<}|j�}|jd�r2|jdd�\}}q2q2WWdQX|S(Ns
/var/crashs/etc/kdump.confspath i(R!R"tisfileRRRtsplitR[(t
kdump_patht
kdump_confRt_((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_kdump_root�s
%cCs;t�}tjj|�sgStjtjj|d��S(Ns*/vmcore(RtR!R"tisdirtglobR(t
kdump_root((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_kdump_vcore_files�s	cCs;t�}tjj|�sgStjtjj|d��S(Ns*/*.txt(RtR!R"RuRvR(Rw((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_kdump_txt_files�s	cCs8tjjtj�sgStjtjjtjd��S(Ns*.log(R!R"RuRt
KDUMPS_DIRRvR(((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_crashreporter_log_files�scCsNtjjtj�sgSgtjtj�D]}tjjtj|�^q,S(N(R!R"RuRRztlistdirR(Rm((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_crashreporter_artifacts�scCs%t�}|sdSt|�ddS(Nii(RxR[Rn(tkdumps((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkdumps_latest_event_timestamp�s	cCs\tjstjjtj�rXtjtjddgdtdt�\}}}|j	�SdS(Ns	is-activetkdumptcatch_stdouttcatch_stderrssystemd-absent(
RtSKIP_SYSTEMCTL_CHECKR!R"Rot	SYSTEMCTLRtrun_commandR'R(Rststdout((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkdump_status�s0
cCs%t�}|sdSt|�ddS(Nii(R}R[Rn(t	artifacts((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt$crashreporter_latest_event_timestamp�s	cCsJd}tjj|�sdSt|d��}|j�j�}WdQX|S(Ns/sys/module/kcare/versionR(R!R"R#RR0R(tkmod_version_fileRtversion((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_current_kmod_version�scCsMt�}|stStjdddt||tj�g�j�}||kS(Ns
/sbin/modinfos-FR�(R�R'Rtcheck_outputRRtKMOD_BINR(RRBtold_versionR*((s+/usr/libexec/kcare/python/kcarectl/kcare.pytis_kmod_version_changed�s	*cCs#t�}|stj�St|�S(N(tloaded_patch_leveltplatformRPR(R((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_uname_sus	
cCs<tjjtj�r1ttjd�j�j�St�SdS(NR(	R!R"R#RR$RR0RR�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_unamescCsftt��d}|rbyt|�Wn(tk
rQ}t|dt���nXtt�|�SdS(Nspatch-levelsUnexpected patch state(tparse_patch_descriptiontloaded_patch_descriptionR5R6Rt_patch_infoR\R(tplte((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�scCsVy tjtjdgdt�SWn/tjk
rQ}|jtj	krM�ndSXdS(NtinfotcheckR(
RR�Rt
KPATCH_CTLR't
subprocesstCalledProcessErrort
returncodeterrnotEBUSY(R�((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�!s cCsiy+gtd�D]}|j�d^qSWn7ttfk
rd}tjdt|�dt�gSXdS(Ns
/proc/modulesis#Error getting loaded modules list: R`(RRptOSErrortIOErrorRtlogerrorR
R)(Rtex((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_loaded_modules*s
+cCs#dt�krdStt�d�S(Ntkcareskpatch-description(R�R[tget_patch_valueR�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�3scCstj|�j|�S(N(Rtdata_as_dicttget(R�tlabel((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�;sc	Cs�idd6dd6dd6dd6}|s,|S|jd�\}}}|jd�\}}}|jd	�\}}}|p}d|d<|p�d|d<||d<||d<|S(
Nspatch-levelR=s
patch-typeRslast-updateskernel-versiont;t:R>(R[t	partition(	tdescRGtlevel_type_timestampRstkernelt
level_typet	timestampRt
patch_type((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�?s"

c
Cs�tjjtjd�}tjj|�r�t|d��G}y|j�}tj	|�SWn t
ttt
tfk
r{nXWdQXndS(Nskcare.stateR(R!R"RRR3R#RR0tasttliteral_evaltSyntaxErrorR�R6t	TypeErrortUnicodeDecodeError(t
state_fileRtstate((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt	get_stateSs(:R�R�RvR.RaR!R�R�RRRRRRterrorsRtpy23RR)ttypingRRR	RR
RR+RR;RRJR5RKRTR\ReRfRnRtRxRyR{R}tcachedRR�R�R�R�R�R�R�R�R�R�R�R�R�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt<module>sZ(