https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /proc/self/root/lib/python2.7/site-packages/redhat_support_tool/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyo
�
��Tc@s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z	dZ
dZ
ejdde�Z
e
jZeaeaeadefd	��YZd
efd��YZd�ZdS(
s� This module manages the configuration for redhat-support-tool.
Configuration options are stored in $HOME/.rhhelp and this module
will both create this configuration file and handle the prompting
of the user for the data which will be stored therein.

To get a configuration you should begin by calling:
 - confighelper.get_config_helper()

This will return an instance of ConfigHelper which has getter
methods for the important configuration options.

i����(tiziptcycleNs%Keith Robertson <kroberts@redhat.com>sRex White <rexwhite@redhat.com>sredhat-support-tooltfallbacktEmptyValueErrorcBseZd�ZRS(cCstj||�dS(N(t	Exceptiont__init__(tselftmsg((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR2s(t__name__t
__module__R(((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR1stConfigHelpercBs�eZdZdZdZeZdZd�Zddd�Z
dddeed�Zddd�Zdded	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zded�Zd�Zeed�Zeed�ZRS(s/etc/redhat-support-tool.confshttps://api.access.redhat.comtWARNINGs)/var/lib/redhat-support-tool/debugkernelscCsntj�|_tj�|_tj�|_tjjd�}|rQ||_ntjjd�}|r�|j	ddd|�n|j
�|j�|jdd�s�|j	ddddd|j
d	td
t�n|jdd�s|j	ddddd|jd	td
t�ntjj|jdd��sjytj|jdd��Wqjtk
rf}qjXndS(
NtRHST_CONFIGt
http_proxytoptiont	proxy_urltvalueturltsectiontRHHelpt
global_configtpersisttdebugtkern_debug_dir(tConfigParsertSafeConfigParserRtlocal_configtprivate_configtostenvirontgettGLOBAL_CONFIG_FILEtsett_load_global_configt_load_local_configt
has_optiontDEFAULT_URLtTruet
DEFAULT_DEBUGtpathtexiststmakedirsR(Rtenv_varte((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR=s2

	
RcCssy|jj||�}WnSy|jj||�}Wqoy|jj||�}Wqkd}qkXqoXnX|S(sh
        Returns the string value of 'option' in the indicated section.
        If no section is specified 'RHHelp' is assumed
        If the specified option does not exist in the local config file,
        the value for that option from the global
        config file is returned.  If the option does not exist in either
        config, return None.
        N(RRRRtNone(RRRtresult((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyRhs	cCs�|r|j}n!|tkr*|j}n	|j}|j|�sR|j|�n|j|||�|r�|r~|j�q�|j�ndS(sA
        Sets specified 'option' in 'section' to 'value'
        N(	RtFalseRRthas_sectiontadd_sectionR t_save_global_configt_save_local_config(RRRRRRtconfig((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR �s	
cCsdt}|jj||�r$t}n<|jj||�rBt}n|jj||�r`t}n|S(sY
        Test for existence of specified option in either local or global config
        (R.RR#R%RR(RRRR-((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR#�s			cCsG|r&|jj||�|j�n|jj||�|j�dS(sC
        Remove an option from the indicated configuration
        N(Rt
remove_optionR1RR2(RRRR((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR4�s

cCs�tjtj��}tjj|jd�|_tjj|j�s[tj	|jd�ntjj|jd�|_
|jj|j
�dS(sX
        Load local config from ~/.redhat-support-tool/redhat-support-tool.conf
        s.redhat-support-tooli�sredhat-support-tool.confN(
tpwdtgetpwuidRtgetuidR'tjointpw_dirtdotdirR(R)tdotfileRtread(Rtpw((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR"�scCs_tjd�}z;t|jdd�}z|jj|�Wd|j�XWdtj|�XdS(sc
        Write the local config to
        ~/.redhat-support-tool/redhat-support-tool.conf
        itwbi�N(RtumasktopenR;Rtwritetclose(Rt
umask_savet
configfile((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR2�scCs�|jj|j�}t|�dkr�|jjd�|jjdd|j�|jjdd|j�|jjdd|j�ndS(sG
        Load global config from /etc/redhat-support-tool.conf
        iRRRRN(	RR<RtlenR0R R$R&tDEFAULT_KERN_DEBUG_DIR(RtfileAry((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR!�scCs_tjd�}z;t|jdd�}z|jj|�Wd|j�XWdtj|�XdS(sF
        Write global config to /etc/redhat-support-tool.conf
        i{R>i�N(RR?R@RRRARB(RRCRD((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR1�scCs\g}xFt|t|��D]/\}}|jtt|�t|�A��qWdj|�S(s�
        A simple utility function to obfuscate the password when a user
        elects to save it in the config file.  We're not necessarily
        going for strong encryption here (eg. a keystore) because that
        would require a user supplied PW to unlock the keystore.

        We're merely trying to provide a convenience against an
        accidental display of the file (eg. cat ~/.rhhelp).
        t(RRtappendtchrtordR8(Rtsalttstringtstr_arytxty((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyt__xor�s
"'cCs3|r+|r+tj|�}|j||�SdSdS(s�
        This convenience function will de-obfuscate a password or other value
        previously obfuscated with pw_encode()

        Returns the de-obfuscated string
        N(tbase64tstandard_b64decodet_ConfigHelper__xorR,(Rtpasswordtkey((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyt	pw_decodescCs3|r+|r+|j||�}tj|�SdSdS(s|
        This convenience function will obfuscated a password or other value

        Returns the obfuscated string
        N(RTRRturlsafe_b64encodeR,(RRURVtpasswd((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyt	pw_encodes
cCsJy0||�}t|�j�dkr+|S|SWntk
rEH|SXdS(NRH(tstrtstriptEOFError(RRtdefaulttpromptertval((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pytget_from_prompts
c
Cs�t}|jtd��}|rIt|�j�rIt|�j�}n|r�t}|r�|jtd�|jd�}tat|�j�j�dkr�t}q�n|j	ddddd	|d
|�nt
td���|S(NsPlease enter your RHN user ID: sSave the user ID in %s (y/n): tnRPRRRtuserRRs The RHN user ID cannot be empty.(t_prompted_for_userid_saveRat_R[R\R.R;R%tlowerR R(Rtprompt_for_saveRcRR`((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pytprompt_for_user(s c
Cs
|rtrt}t}nt}t}|jdd�}|jtd�|dtj�}|r�|r�|jtd�||jfd�}t}t	|�j
�dkr�t}q�n|j||�}	|jdddd	d
|	d|d|�nt
td
���|S(NRRcs"Please enter the password for %s: s&Save the password for %s in %s (y/n): RbRPRRRURRRs!The RHN password cannot be empty.(t_prompted_for_password_saveR%R.RRaReR,tgetpassR;R[RfRZR R(
RtpromptRRgRRcRUR`t_prompted_for_passwd_saveRY((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pytprompt_for_passwordDs*
		cCs�|jdd�}|jtd�|dtj�}|r�|r�t}|jtd�||jfd�}t|�j�dkr�t	}q�nt	}|j
||�}|jdddd	d
|d|d|�nttd
���|S(NRt
proxy_users-Please enter the password for proxy user %s: s1Save the password for proxy user %s in %s (y/n): RbRPRRtproxy_passwordRRRs#The proxy password cannot be empty.(
RRaReR,RjR.R;R[RfR%RZR R(RRkRRcRURR`RY((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pytprompt_for_proxy_passwordgs$		N(RR	RR$R&R.tDEFAULT_NOVERIFYSSLRFRR,RR R#R4R"R2R!R1RTRWRZt	raw_inputRaRhR%RmRp(((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyR
6s.	+				
			
		#cCstst�antS(s:
    A helper method to get the configuration object.
    (t_config_helperR
(((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pytget_config_helper�s(t__doc__t	itertoolsRRRRRRjtgettextRR5t
__author__ttranslationR%tttugettextReR,RsR.RdRiRRtobjectR
Rt(((sL/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/confighelper.pyt<module>s$	�Q

https://t.me/AnonymousX5 - 2025