HEX
Server: Apache
System: Linux 162-240-236-42.bluehost.com 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: bt667 (1004)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //usr/libexec/kcare/python/kcarectl/kcare.pyc
�
��	ic@s*ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZddlm
Z
ddlmZer�ddlmZmZmZndZd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zdefd��YZdefd��YZdefd��YZ d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(ej)d��Z*ej)d��Z+ej)d��Z,d �Z-d!�Z.d"�Z/d#�Z0d$�Z1d%�Z2ej)d&��Z3d'�Z4d(�Z5d)�Z6d*�Z7dS(+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�}zPxI|j�D];}|jt�r7djt	t
|tt�j���Sq7WWd|j
�XdS(Ntrt(tget_kernel_hashtopentget_cache_pathRt
PATCH_INFOt	readlinest
startswithtUNAME_LABELtjointfilterR
tlentstriptclose(tpatch_leveltkhashtftline((s+/usr/libexec/kcare/python/kcarectl/kcare.pytparse_unames	.cCsatjjtj�r]y1ttjd�}|j|�|j�tSWq]t	k
rYq]Xnt
S(Ntw(tostpathtexistsRtKCARE_UNAME_FILERtwriteRtTruet	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.pyR2sc	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.pyRNs!cGstjtj|�S(N(Rtget_patch_server_urlRR@(tparts((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_kernel_prefixed_urlXstBaseKernelPatchLevelcBseZd�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.pyRVjscCs(||_||_||_||_dS(N(RNRRORP(RLRRNRORP((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt__init__ms			cGstj|j|j|�S(N(RRHROR(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkmod_urlsscGs"tj|j|jt|�|�S(N(RRHRORR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytfile_urlvsN(RRRStNoneRVRXRYRZ(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRTis	tLegacyKernelPatchLevelcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsCyt||�j||�SWntk
r>}t|��nXdS(N(RURVR6R(RWRRNtexc((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRV{scCs(||_||_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\zs
				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�scCstjtjdg�S(Ntinfo(RR�Rt
KPATCH_CTL(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�"scCsiy+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�/scCstj|�j|�S(N(Rtdata_as_dicttget(R�tlabel((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�7sc	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_stateOs(8R�RvR.RaR"R�RRRRRRterrorsRtpy23RR)ttypingRRR	RR
R R+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>sV(