MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 216.73.216.126
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python2.7/site-packages/pyzor/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python2.7/site-packages/pyzor/config.pyc
�
YF�Tc@s�dZddlZddlZddlZddlZyddlmZeZWne	k
rie
ZnXddlZej
d�Zd�Zd�Zd�Zd�Zd	�Zdd
d�Zd�ZdS(
s8Functions that handle parsing pyzor configuration files.i����N(t
SentryHandlers((?<=[^\\])#.*)cCs?tjd�}tjt�}tjj|�sT|jd�td�|t	j
<|St|�}x�|D]�}|j�sg|dd	kr�qgny;g|j
d
�D]}|j�j�^q�\}}}	Wn$tk
r�|jd|�qgnXyitd6td
6|	}	Wn$tk
r4|jd|�qgnX|dkrJd}n%g|j
�D]}
|
j�^qW}|dkr�|}n%g|j
�D]}|j�^q�}xq|D]i}|	r�|jddj|�|�||j|�q�|jddj|�|�||j|�q�WqgW|j�|jd|�|S(s�Load the ACL from the specified file, if it exists, and return an
    ACL dictionary, where each key is a username and each value is a set
    of allowed permissions (if the permission is not in the set, then it
    is not allowed).

    'accounts' is a dictionary of accounts that exist on the server - only
    the keys are used, which must be the usernames (these are the users
    that are granted permission when the 'all' keyword is used, as
    described below).

    Each line of the file should be in the following format:
        operation : user : allow|deny
    where 'operation' is a space-separated list of pyzor commands or the
    keyword 'all' (meaning all commands), 'username' is a space-separated
    list of usernames or the keyword 'all' (meaning all users) - the
    anonymous user is called "anonymous", and "allow|deny" indicates whether
    or not the specified user(s) may execute the specified operations.

    The file is processed from top to bottom, with the final match for
    user/operation being the value taken.  Every file has the following
    implicit final rule:
        all : all : deny

    If the file does not exist, then the following default is used:
        check report ping info : anonymous : allow
    tpyzordsXUsing default ACL: the anonymous user may use the check, report, ping and info commands.tchecktreporttpingtpongtinfoit#t:sInvalid ACL line: %rtallowtdenytallt	whitelistsGranting %s to %s.t,sRevoking %s from %s.sACL: %r(scheckRRRsinfo(scheckRRRsinfos	whitelist(tloggingt	getLoggertcollectionstdefaultdicttsettostpathtexistsRtpyzortanonymous_usertopentstriptsplittlowert
ValueErrortwarntTruetFalsetKeyErrortdebugtjointupdatetdifference_updatetclose(t	access_fntaccountstlogtacltaccessftlinetpartt
operationstuserstallowedt	operationtuser((s0/usr/lib/python2.7/site-packages/pyzor/config.pytload_access_filesN

8

	"	%

cCstjd�}i}tjj|�s8|jd�|St|�}x�|D]�}|j�sK|ddkrtqKny|jd�\}}Wn$t	k
r�|j
d|�qKnX|j�}|j�}|jd||�|||<qKW|j�|jdd	j
|��|S(
sLoad the accounts from the specified file.

    Each line of the file should be in the format:
        username : key

    If the file does not exist, then an empty dictionary is returned;
    otherwise, a dictionary of (username, key) items is returned.
    RsIAccounts file does not exist - only the anonymous user will be available.iRRsInvalid accounts line: %rs'Creating an account for %s with key %s.sAccounts: %sR
(RRRRRRRRRRRR!R%R"(t	passwd_fnR(R'tpasswdfR+R1tkey((s0/usr/lib/python2.7/site-packages/pyzor/config.pytload_passwd_filecs*	



cCs�i}tjd�}tjj|�r�t|�}xqt|�D]c\}}|j�}|s@|jd�rtq@ny8g|j	d�D]}|j�^q�\}}	}
}Wn$t
k
r�|jd|�q@nXyt|	�}	Wn)t
k
r}|jd||�q@nX||	f}
yt
jj|�\}}Wn)t
k
rb}|jd||�q@nX|r�|r�|jd|�q@nt
jj|
||�||
<q@W|j�n
|jd�|S(s4Layout of file is: host : port : username : salt,keyRRRs4account file: invalid line %d: wrong number of partss!account file: invalid line %d: %ss;account file: invalid line %d: keystuff can't be all None'ssLNo accounts are setup.  All commands will be executed by the anonymous user.(RRRRRRt	enumerateRt
startswithRRRtintRtaccounttkey_from_hexstrtAccountR%(tfilepathR'R(t	accountsftlinenot	orig_lineR+txthosttporttusernameR5textaddresstsalt((s0/usr/lib/python2.7/site-packages/pyzor/config.pyt
load_accounts�sD5
		 

c	Cs�tjd�}tjj|�s*g}n~g}t|��j}x`|D]X}|j�}tjd|�rF|j	dd�\}}|j
|t|�f�qFqFWWdQX|s�|jd�d	g}n|S(
sLoad the servers file.Rs[^#][a-zA-Z0-9.-]+:[0-9]+RiNs5No servers specified, defaulting to public.pyzor.org.spublic.pyzor.orgiy_(spublic.pyzor.orgiy_(
RRRRRRRtretmatchtrsplittappendR9R(R=tloggertserverstserverfR+RFRC((s0/usr/lib/python2.7/site-packages/pyzor/config.pytload_servers�s	
&
cCsztjj|�st�St�}t|��F}x<|D]4}tjd|�j�}|r8|j|�q8q8WWdQX|S(s Load the local digest skip file.tN(	RRRRRt
_COMMENT_PtsubRtadd(R=RROR+((s0/usr/lib/python2.7/site-packages/pyzor/config.pytload_local_whitelist�s	
tWARNc
Cstjd�}tj�}|r6tj}tj}ntj}tj}tj|�}	|	j|�|j|�|j|�|	j	|�|r�tj
|�}
|
j|�|
j|�|	j	|
�n|rtrtt|�}t
|�}|j|�|	j	|�n|	S(sTSetup logging according to the specified options. Return the Logger
    object.
    s3%(asctime)s (%(process)d) %(levelname)s %(message)s(Rt	Formattert
StreamHandlertDEBUGtCRITICALtINFORtsetLeveltsetFormattert
addHandlertFileHandlert
_has_raventgetattrR(
tlog_nameR=R!t
sentry_dsnt
sentry_lvltfmttstream_handlertstream_log_leveltfile_log_levelRMtfile_handlertsentry_leveltsentry_handler((s0/usr/lib/python2.7/site-packages/pyzor/config.pyt
setup_logging�s.			






cCs�x{|D]s}|j||�}|s+qntjj|�}tjj|�sgtjj||�}n|j|||�qWdS(s5Set the full file path for these configuration files.N(tgetRRt
expandusertisabsR"R(t	homefilestcategorythomedirtconfigtfilenameR=((s0/usr/lib/python2.7/site-packages/pyzor/config.pytexpand_homefiles�s
(t__doc__RRIRRtraven.handlers.loggingRRR`tImportErrorRt
pyzor.accountRtcompileRRR2R6RHRPRUtNoneRlRu(((s0/usr/lib/python2.7/site-packages/pyzor/config.pyt<module>s&


	O	#	)		&

MMCT - 2023