uawdijnntqw1x1x1
IP : 3.22.42.92
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
..
/
lib
/
python2.7
/
site-packages
/
.
/
jinja2
/
..
/
clsudo.pyo
/
/
� b=0Yc@sddlZddlZddlZddlZddlZddlZddlmZmZde fd��YZ de fd��YZde fd��YZd e fd ��YZ ddd dddgZddddgZdZdZdZdefd��YZdS(i����N(tS_IRUSRtS_IRGRPt NoSuchUsercBseZd�ZRS(cCs%d|}tj|d|f�dS(NsNo such user (%s)(t Exceptiont__init__(tselftusertmessage((s*/usr/lib/python2.7/site-packages/clsudo.pyRs (t__name__t __module__R(((s*/usr/lib/python2.7/site-packages/clsudo.pyR stNoSuchGroupcBseZd�ZRS(cCsd|}tj||�dS(NsNo such group (%s)(RR(RtgroupR((s*/usr/lib/python2.7/site-packages/clsudo.pyRs (RR R(((s*/usr/lib/python2.7/site-packages/clsudo.pyR stUnableToReadFilecBseZd�ZRS(cCstj|d�dS(NsCannot read sudoers file(RR(R((s*/usr/lib/python2.7/site-packages/clsudo.pyRs(RR R(((s*/usr/lib/python2.7/site-packages/clsudo.pyRstUnableToWriteFilecBseZd�ZRS(cCstj|d�dS(NsCannot modify sudoers file(RR(R((s*/usr/lib/python2.7/site-packages/clsudo.pyRs(RR R(((s*/usr/lib/python2.7/site-packages/clsudo.pyR ss/bin/pss /bin/greps /sbin/services%/usr/bin/getcontrolpaneluserspackagess/usr/sbin/lvectls>/usr/local/directadmin/plugins/new_lvemanager/admin/GetDomainss/usr/bin/cl-selectors/usr/bin/pinisets/usr/sbin/lvepss/usr/bin/selectorctlsDefaults:%s !requirettys-%%%s ALL=NOPASSWD: LVECTL_CMDS, SELECTOR_CMDSsDefaults:%%%s !requirettytClsudocBseZdZdZdZdZd�Zee�Zd�Zee�Zd�Z ee �Z d�Z ee �Z d�Zee�Zd �Zee�Zd �Z ee �Z d�Zee�Zd�Zee�Zd �Zee�Zd�Zee�ZRS(s/ Adds CloudLinux users to sudoers file s/etc/sudoerss/etctlve_sudoers_cCs�tj|�tj|�tjsCtjjddjt��ntjsltjjddjt ��ntj s�tjjd|f�ntjs�tjjd|f�ntjs�tjjt |f�ntj�dS(s/ Adds username to sudoers file sCmnd_Alias LVECTL_CMDS = s, sCmnd_Alias SELECTOR_CMDS = s%s ALL=NOPASSWD: LVECTL_CMDSs%s ALL=NOPASSWD: SELECTOR_CMDSN(Rt_check_usert _get_contentst has_aliastsudoers_listtappendtjointALIAS_LVECTL_CMDSthas_selector_aliastALIAS_SELECTOR_CMDSt has_rightsthas_selector_rightst has_actiontDEFAULTS_REQUIRETTYt_write_contents(R((s*/usr/lib/python2.7/site-packages/clsudo.pytadd_user3s cCs�tj|�tj|�tjs6tjjd�ntjsYtjjd|f�ntjs|tjjt|f�ntj �dS(s/ Adds username to sudoers file sOCmnd_Alias CAGEFS_CMDS = /usr/sbin/cagefsctl, /bin/ps, /bin/grep, /sbin/services%s ALL=NOPASSWD: CAGEFS_CMDSN( RRRthas_cagefs_aliasRRthas_cagefs_rightsRRR(R((s*/usr/lib/python2.7/site-packages/clsudo.pytadd_cagefs_userGs cCs�tj|�tj|�tjsCtjjddjt��ntjsltjjddjt ��ntj s�tjjt|f�ntjs�tjjt |f�ntj�dS(sJ Adds group to sudoers file, grants access to LVE Manager sCmnd_Alias LVECTL_CMDS = s, sCmnd_Alias SELECTOR_CMDS = N(Rt_check_groupt_get_contents_groupRRRRRRRRtGROUP_LVECTL_SELECTORthas_group_actiontGROUP_DEFAULTS_REQUIRETTYR(t group_name((s*/usr/lib/python2.7/site-packages/clsudo.pytadd_lvemanager_groupWs cCs�y�ttj�}|j�j�t_|j�d}t}xr|ttj�kr�tj|}d|f|ks�t |f|kr�tjj |�t}q@n|d7}q@W|r�tj�nWn t tfk r�t��nXdS(s5 Removes username from sudoers file is%s ALL=NOPASSWD:iN(topenRtfilepathtreadt splitlinesRtclosetFalsetlenRtremovetTrueRtIOErrortOSErrorR(Rtftidxtremovedtline((s*/usr/lib/python2.7/site-packages/clsudo.pytremove_useris" &c Cstj|�tj|�itd6td6}d}x�tttj��D]�}tj|}x�|j�D]�\}}||krj|j |d�j �}|jd�}xG|D]<}||kr�d}d|dj|�ftj|<Pq�q�WqjqjW|dkrJtj �qJqJWd S( s2 updates username in sudoers file sCmnd_Alias LVECTL_CMDSsCmnd_Alias SELECTOR_CMDSitt,is%s = %ss, N(RRRRRtrangeR/Rt iteritemstreplacetstriptsplitRR( Rt cmnd_dicttis_sudoer_changeR5t comand_stringt aliase_keytaliase_listt cmnd_listtaliase_cmnd_item((s*/usr/lib/python2.7/site-packages/clsudo.pytupdate_user�s" cCs5ytj|�Wntk r0t|��nXdS(sZ Checks passwd database for username presence @param user: string N(tpwdtgetpwnamtKeyErrorR(R((s*/usr/lib/python2.7/site-packages/clsudo.pyR�s cCs5ytj|�Wntk r0t|��nXdS(s_ Checks grp database for group_name presence @param group_name: string N(tgrptgetgrnamRJR (R'((s*/usr/lib/python2.7/site-packages/clsudo.pyR"�s cCsbtt_tt_tt_tt_tt_tt_tt_tt_ t jd|�}y�ttj �}|j�j�t_|j�x�tttj��D]�}dtj|kr�tt_q�ndtj|kr�tt_q�nd|ftj|krtt_q�nd|ftj|kr>tt_ q�ndtj|kr|jtj|�}|r�tt_q�q�ndtj|kr dtj|kr�tj|jd d �tj|<ndtj|kr�tj|jd d�tj|<ntt_q�nd |ftj|kr�tt_q�q�q�WWn ttfk r]t��nXdS(sQ Reads file into list of strings @param filename: string sDefaults:\s*%s\s*!requirettysCmnd_Alias LVECTL_CMDSsCmnd_Alias CAGEFS_CMDSs%s ALL=NOPASSWD: LVECTL_CMDSs%s ALL=NOPASSWD: CAGEFS_CMDSt requirettysCmnd_Alias SELECTOR_CMDStpinisets/usr/bin/cl-selectors&/usr/bin/cl-selector, /usr/bin/pinisettlvepss7/usr/bin/cl-selector, /usr/bin/piniset, /usr/sbin/lvepss%s ALL=NOPASSWD: SELECTOR_CMDSN(R.RRR%RRRRRR tretcompileR)R*R+R,RR-R;R/R1tsearchR=R2R3R(Rtrequire_tty_patterntiR5t pattern_match((s*/usr/lib/python2.7/site-packages/clsudo.pyR�sd cCsBtt_tt_tt_tt_tt_tt_tt_tt_ d|}d|}t jd|f�}y�ttj �}|j�j�t_|j�xttttj��D]]}dtj|krMdtj|krtj|jdd�tj|<ndtj|kr>tj|jdd �tj|<ntt_q�nd tj|krott_q�ndtj|kr�tt_q�ntj|j|�r�|jtj|�}|r�tt_tj|j|�r�tt_q�q�ntj|j|�r�tt_q�q�WWn ttfk r=t��nXdS( sS Reads file into list of strings @param group_name: string s%%%ss Defaults:%%%ss1%s\s*ALL=NOPASSWD:\s*LVECTL_CMDS,\s*SELECTOR_CMDSsCmnd_Alias SELECTOR_CMDSRNs/usr/bin/cl-selectors&/usr/bin/cl-selector, /usr/bin/pinisetROs7/usr/bin/cl-selector, /usr/bin/piniset, /usr/sbin/lvepssCmnd_Alias LVECTL_CMDSsCmnd_Alias CAGEFS_CMDSN(R.RRR%RRRRRR RPRQR)R*R+R,RR-R;R/R=R1t startswithRRR2R3R(R'tgroup_prefixtgroup_actiont group_patternRTR5RU((s*/usr/lib/python2.7/site-packages/clsudo.pyR#�sV cCsy�tjdtjdtj�\}}tj|d�}|jdjtj �d�|j �ttB}tj ||�tj|�s�t�nWnPttfk r�y&tjj|�r�tj|�nWnnXt��nXytj|tj�Wntk rt��nXdS(sX Writes data to temporary file then checks it and rewrites sudoers file tprefixtdirtws N(ttempfiletmkstempRttemp_prefixttemp_dirtostfdopentwriteRRR-RRtchmodt_is_file_validR2R3tpathtexiststunlinkR trenameR*(tfdt temp_pathtfotmask((s*/usr/lib/python2.7/site-packages/clsudo.pyRs* c Cshddd|g}tj|dtd�dtjdtjdt�}|j�}|jd krdtStS( Ns/usr/sbin/visudos-cs-ftstdins /dev/nulltstdouttstderrt close_fdsi( t subprocesstPopenR)tPIPEtSTDOUTR1tcommunicatet returncodeR.(tfilenametcmdtrvtrt((s*/usr/lib/python2.7/site-packages/clsudo.pyRe:s (RR t__doc__R*R`R_RtstaticmethodR!R(R8RGRR"RR#RRe(((s*/usr/lib/python2.7/site-packages/clsudo.pyR+s4 9 2 (RaRHRKRPRrR]tstatRRRRR RR RRRR$R&tobjectR(((s*/usr/lib/python2.7/site-packages/clsudo.pyt<module>s"
/home/../lib/python2.7/site-packages/./jinja2/../clsudo.pyo