[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.190.176.94: ~ $
�
v�{gc@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZm
Z
mZmZdZdZd
Zd�Zd�Zd�Ze
jd��Zd�Zd�Zed�Zd�Zd�Zed�Ze
jd��Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%dd �Z&d!�Z'dS("i����Ni(terrors(tconfig(t	constants(t
http_utils(t	log_utils(tplatform_utils(tutils(t	urlencodetjson_loads_nstrtURLErrort	HTTPErrors/etc/sysconfig/kcare/systemids&/etc/sysconfig/kcare/systemid.almacares/var/imunify360/license.jsoncCs�tjjt�sdSttd��d}xZ|D]R}|jd�\}}}|j�dkri|j�Stj	dj
t���q/WWdQXdS(Ntrt=t	server_idsUnable to parse {0}.(tostpathtexiststSYSTEMIDtNonetopent	partitiontstripRt
KcareErrortformat(tfdtlinetparamt_tvalue((s*/usr/libexec/kcare/python/kcarectl/auth.pyt	_systemids

cCsBtjjt�sdSttd��}|j�j�SWdQXdS(NR(RRRt
ALMA_SYSTEMIDRRtreadlineR(tf((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_alma_systemid$sc	Cswtjjt�sdSi}tt��@}|j�}|rdyt|�}Wqdtk
r`qdXnWdQX|j	d�S(Ntid(
RRRtIM360_LICENSE_FILERRtreadRt	Exceptiontget(tdataR tcontent((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_im360_systemid+s

cCst�pt�pt�S(sqGet server_id or None if not present.

    Lookup order: SYSTEMID then IM360_LICENSE_FILE then ALMA_SYSTEMID
    (RR)R!(((s*/usr/libexec/kcare/python/kcarectl/auth.pytget_serverid:scCstjt�dS(N(RtunlinkR(((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_rm_serveridCscCstjtdj|��dS(Nsserver_id={0}
(Rtatomic_writeRR(R
((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_set_server_idGscCsd}y�t�}|dkr8|s4tjd�ndStjdj|�}tj|�}t	j
|j��}t	j|�}|ddkr�t
�|s�tjd�q�n+|s�tj|�tjd|d�nWn,tk
r}|stj||�qnXdS(Ns1Error unregistering server: cannot find server ids&/unregister_server.plain?server_id={0}tsuccessttruesServer was unregisteredsError unregistering server: tmessage(RR*RtlogerrorRtREGISTRATION_URLRRturlopenRtnstrR$tdata_as_dictR,tloginfoR
tprint_cln_http_error(tsilentturlR
tresponseR(treste((s*/usr/libexec/kcare/python/kcarectl/auth.pyt
unregisterKs*	
cCsPdGHtj�}|dkr!dStj�tj�}ddl}|dkr_|jd�n|jj�tdd�}tdd�}tj|j	�|j
j	��tj|j	�|jj	��tj|j	�|jj	��xbtrKt
jd
�t|�\}}}|dkr�|r�t|�t|�|jd�q�q�WdS(NsHRegister auto-retry has been enabled, the system can be registered laterii����s	/dev/nullRsa+i<iii (RtforktsetsidtsystexittstdouttflushRtdup2tfilenotstdintstderrtTruettimetsleept
_try_registerR.t_set_auth_token(R:tpidRAtsitsotcodeR
t
auth_token((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_register_retrycs,

	


cCs�yitj|�}|jjtjd�}tjtj	|j
���}t|d�|jd�|fSWnOtt
fk
r�}tj||�dStk
r�tjjd|�dSXdS(NRQR
s)Exception while trying to register URL %s(NNN(NNN(RR4theadersR&RtAUTH_TOKEN_HEADERRRR6R5R$tintR
R	RR8R%tkcarelogt	exception(R:R;RRR<R=((s*/usr/libexec/kcare/python/kcarectl/auth.pyRL}s$
cCs�ytt�Wn!tk
r1tjjd�nXtj�}td|fd|fg�}dj	t
j|�}t|�\}}}|dkr�t
|�t|�tjd�dS|dkr�tjd�n�|d	kr�tjd
�n�|dkrtjd�nj|d
kr'tjd�nN|dkrCtjd�n2|dkr_tjd�ntjdj	|��|r�t|�dS|p�dS(Ns9Exception while trying to unregister URL before register.thostnametkeys{0}/register_server.plain?{1}isServer RegisteredisAccount LockedisInvalid Keyis}You have reached maximum registered servers for this key. Please go to your CLN account, remove unused servers and try again.is[IP is not allowed. Please change allowed IP ranges for the key in KernelCare Key tab in CLNisEThis IP was already used for trial, you cannot use it for trial againisfThis IP was banned. Please contact support for more information at https://www.kernelcare.com/support/sUnknown Error {0}i����(R>RIR%RRWRXRtget_hostnameRRRR3RLR.RMR7R2RS(RZtretryRYtqueryR:RQR
RR((s*/usr/libexec/kcare/python/kcarectl/auth.pytregister�s>





cCstjtj�S(N(Rttry_to_readRtAUTH_TOKEN_DUMP_PATH(((s*/usr/libexec/kcare/python/kcarectl/auth.pyt_get_auth_token�scCs!|s
dStjtj|�dS(N(RR-RR`(RR((s*/usr/libexec/kcare/python/kcarectl/auth.pyRM�scOs�|jdd�}|jdt�r-t}n	tj}tj|�rXtj|||�Stj|t	�t
�d|�}tj|dd�tj�|||�S(Ntmethodt
check_licensetcounti(
tpopRRIt_check_auth_retryRtcheck_urlopen_retrytis_local_urlturlopen_basethttp_requesttget_http_auth_stringRaRR\(R:targstkwargsRbtchecktrequest((s*/usr/libexec/kcare/python/kcarectl/auth.pyturlopen_auth�s		!cCs>t�}|r:tjtjtjdj|d����SdS(Ns{0}:{1}t
kernelcare(R*RR5tbase64t	b64encodetbstrRR(R
((s*/usr/libexec/kcare/python/kcarectl/auth.pyRk�s	+cCsLt|t�r5|jdkr(t|�S|jdkSt|t�rHtSdS(Ni�i�i�(i�i�(t
isinstanceR
RQt_handle_forbiddenR	RI(R=tstate((s*/usr/libexec/kcare/python/kcarectl/auth.pyRf�s

cCs#d|krtStjrt�}|rEtjddj|�}n
tjd}y7tjtj	|dt
�j��}tj|�}Wn*t
k
r�}tj||dt
�dSX|s�|jd�r�tjjdj|��dS|ddkrt|d<tjd�tSt�ndS(
sIn case of 403 error we should check what's happen.
    Case #1. We are trying to register unlicensed machine and should try to register trial.
    Case #2. We have a valid license but access restrictions on server are not consistent yet
             and we had to try later.
    tlicenses/check.plains?server_id={0}tretry_on_500RCNRQsUnexpected CLN response: {0}t0t1s$Unable to access server. Retrying...(RzR{(RIRtCHECK_CLN_LICENSE_STATUSR*R3RRR5RR4tFalseR$R6R	RR8R&RWterrorR2t_register_trial(RwR
R:R(tinfotex((s*/usr/libexec/kcare/python/kcarectl/auth.pyRv�s*		
$

cCst�}|r�tjdj|�}y�tj|�}tj|j��}tj	|�}|sr|j
d�r�dj|�GHdSt|d�}|dkr�dGHdStdd�}|dkr�dGHn|SWqt
k
r�}tj||�dSXnt�SdS(	Ns/check.plain?server_id={0}RQsUnexpected CLN response: {0}iisKey-based valid license foundtkey_checkeds No valid key-based license found(R*RR3RRR4RR5R$R6R&RVt_get_license_info_by_ipR
RR8(R
R:R;R(R<RQtlicense_typeR=((s*/usr/libexec/kcare/python/kcarectl/auth.pytlicense_infos,	icCs�tjd}y|tj|�}tj|j��}tj|�}|dj�dkrht	|d�}|dkr�dj
|d�GHdS|dkr�|d}tj|d	�jd
�}dj
||�GHdS|dkr$|dkr$|d}tj|d	�jd
�}d
j
||�GHn|dkr�|dkr�d|kr]dj
|d�GHqedGHq�n |j
dd�}dj
|�GHWnLtk
r�}	tj|	|�n*tk
r�}
dj
|
|j��GHnXdS(Ns/check.plainR/R0RQisValid license found for IP {0}tipitexpire_dates%Y-%m-%ds?You have a trial license for the IP {0} that will expire on {1}is0Your trial license for the IP {0} expired on {1}isThe IP {0} hasn't been licenseds This server hasn't been licensedR1ts"Error retrieving license info: {0}s1Unexpected CLN response, cannot find {0} key:
{1}(RR3RR4RR5R$R6tlowerRVRtparse_response_datetstrftimeR&R
RR8tKeyErrorR(R�R:R;R(R<RQR�texpires_strR1R=RZ((s*/usr/libexec/kcare/python/kcarectl/auth.pyR� s<


cCsytjjtjd�}tjj|�r.dSytjtj	d�}t
jt
j|j
���}y�|dj�dkr�t
j|ddt�|ddkr�tj|d|d	��ntjd
j|d��dS|ddkrt
j|ddt�tjd��ntjd
��Wn"tk
rK}tj|��nXWn%tk
rt}tj|j��nXdS(Nstrial-requesteds/trial.plainR/R0R�t
ensure_dirtexpiredR�tcreateds3Requesting trial license for IP {0}. Please wait...tnasInvalid Licensei����(RRtjoinRtPATCH_CACHERRR4RR3RR6R5R$R�R-RIRtAlreadyTrialedExceptionRR7RRRtUnableToGetLicenseExceptionR�R
RQ(t
trial_markR;R<tkeR=((s*/usr/libexec/kcare/python/kcarectl/auth.pyRCs*((RrRRJR�RRRRRRRtpy23RRR	R
RRR#RR!R)tcachedR*R,R.R}R>RSRLR^RaRMRpRkRfRvR�R�R(((s*/usr/libexec/kcare/python/kcarectl/auth.pyt<module>s@"								(		
				)	#

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