AlkantarClanX12

Your IP : 18.188.140.232


Current Path : /proc/self/root/usr/lib/python3.6/site-packages/isc/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3.6/site-packages/isc/__pycache__/coverage.cpython-36.pyc

3

���f�&�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZdZddl
mZmZmZmZmZmZdd�Zdad	d
�Zdd�Zd
d�Zddd�Zdd�Zdd�ZdS)�)�print_functionN)�defaultdictzdnssec-coverage)�dnskey�	eventlist�keydict�keyevent�keyzone�utilscOst||�tjd�dS)N�)�print�sys�exit)�args�kwargs�r�/usr/lib/python3.6/coverage.py�fatals
rTcOsJd|kr|d}|jdd�nd}tr,dan|r8td�|rFt||�dS)zuoutput text, adding a vertical space this is *not* the first
    first section being printed since a call to vreset()�skipNTF�)�pop�
_firstliner)rrrrrr�output'srcCsdadS)zreset vertical spacingTN)rrrrr�vreset8srcCs�|j�}yt|�Stk
r$YnXtjd�}|j|�}|sJtd|��|j�\}}t|�}|j�}|jd�rx|dS|jd�r�|dS|jd�r�|dS|jd	�r�|d
S|jd�r�|dS|jd
�r�|dS|jd�r�|Std|��dS)z� convert a formatted time (e.g., 1y, 6mo, 15mi, etc) into seconds
    :param s: String with some text representing a time interval
    :return: Integer with the number of seconds in the time interval
    z([0-9][0-9]*)\s*([A-Za-z]*)zCannot parse %s�yi�3��moi�'�wi�:	�di�Q�hiZmi�<�szInvalid suffix %sN)	�strip�int�
ValueError�re�compile�match�groups�lower�
startswith)r�r�m�nZunitrrr�
parse_timeAs6








r,cCs�|}|s(tjj|�s(tj|tj�r�tjd}|s>tjj}xB|jtj�D]2}tjj	||�}tjj|�rztj|tj�rzPd}qLW|S)a1 find the location of a specified command.  if a default is supplied
    and it works, we use it; otherwise we search PATH for a match.
    :param command: string with a command to look for in the path
    :param default: default location to use
    :return: detected location for the desired command
    �PATHN)
�os�path�isfile�access�X_OK�environ�defpath�split�pathsep�join)Zcommand�defaultZfpathr/Z	directoryrrr�set_pathks$
r9c	0CsDtdtjjtjd�d��}tjtddd�}|j	dt
dddFd�|j	dd
dt
ddd�|j	ddt
ddd�|j	ddt
ddd�|j	ddt
ddd�|j	ddd t
d!dd�|j	d"d#|t
d$d
d�|j	d%d&t
d'd(dd)�|j	d*d+d,d-d.d/�|j	d0d1d,d-d2d/�|j	d3d4d5d,d-d6d/�|j	d7d8d9tjd:�|j�}|j
�rJ|j�rJtd;�n*|j
�sZ|j�rn|j
�rfd<nd=|_nd|_|j�r�t|j�d>k�r�td?�d@dA�|jD�|_y|j�r�t|j�}||_Wntk
�r�YnXy|j�r�t|j�}||_Wntk
�rYnXy|j�r(t|j�}||_Wntk
�r@YnXy<|j�r||j}t|j�}|dBk�rnd|_ntj�||_Wntk
�r�YnX|j�r�|j�r�|S|j�r*|j�r*y:t|jdB|j|j�}|j�p�|j|_|j�p�|j|_Wn4tk
�r(}ztdC|j|�WYdd}~XnX|j�s@tdD�dE|_|S)Gz8Read command line arguments, set global 'args' structureznamed-compilezoneZsbinz: checks future zDNSKEY coverage for a zone)�description�zone�*Nzzone(s) to checkz%(default: all zones in the directory))�type�nargsr8�helpz-Kr/�.z&a directory containing keys to process�dir)�destr8r=r?�metavarz-f�filenamezzone master file�file)rBr=r?rCz-m�maxttlzthe longest TTL in the zone(s)�timez-d�keyttlzthe DNSKEY TTLz-r�resignZ1944000z:the RRSIG refresh interval in seconds [default: 22.5 days]z-c�compilezonezpath to 'named-compilezone'z-l�
checklimit�0zDLength of time to check for DNSSEC coverage [default: 0 (unlimited)])rBr=r8r?rCz-z�no_ksk�
store_trueFz#Only check zone-signing keys (ZSKs))rB�actionr8r?z-k�no_zskz"Only check key-signing keys (KSKs)z-Dz--debugZ
debug_modezTurn on debugging outputz-vz	--version�version)rOrQz)ERROR: -z and -k cannot be used together.ZKSKZZSKr
z)ERROR: -f can only be used with one zone.cSs4g|],}t|�dkr,|ddkr,|dd�n|�qS)r
r@N���rR)�len)�.0�xrrr�
<listcomp>�szparse_args.<locals>.<listcomp>rz"Unable to load zone data from %s: z�WARNING: Maximum TTL value was not specified.  Using 1 week
	 (604800 seconds); re-run with the -m option to get more
	 accurate results.i�:	z5zone(s) to check(default: all zones in the directory)) r9r.r/r7r	�prefix�argparse�ArgumentParser�prog�add_argument�strrQ�
parse_argsrPrMr�keytyperDrSr;rFr,r"rHrIrKrGrrJ�	Exceptionrr)	rJ�parserrr*�kr)Zlimr;�errrr]�s�



















"r]c(Cspt�}td�yt|j|j|jd�}Wn2tk
rX}ztdt|��WYdd}~XnXx<|D]4}|j	t
�|jr�|jt
�q`|jt
|j
|j�q`Wt
d�t�yt|�}Wn2tk
r�}ztdt|��WYdd}~XnXd}|j�s|jd|j|jt
��sXd}nJxH|jD]>}y|j||j|jt
��s6d}Wnt
d|�YnX�qWtj|�rfd	nd
�dS)Nz;PHASE 1--Loading keys to check for internal timing problems)r/ZzonesrHz'ERROR: Unable to build key dictionary: z9PHASE 2--Scanning future key events for coverage failuresz#ERROR: Unable to build event list: FTz&ERROR: Coverage check failed for zone r
r)r]rrr/r;rHr_rr\Zcheck_prepubr�sepZ
check_postpubrFrIrrZcoverager^rKrr
)rZkdrb�keyZelist�errorsr;rrr�main�s:"

"
rf)N)Z
__future__rr.rrXZglobr#rGZcalendar�pprint�collectionsrrZZiscrrrrrr	rrrrr,r9r]rfrrrr�<module>s& 	*
x