Edit File: coverage.cpython-36.pyc
3 8Pe�&������������������@���s����d�dl�mZ�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dl Z d�dl mZ�dZd�dl mZmZmZmZmZmZ�dd��Zdad d ��Zdd��Zd d��Zddd�Zdd��Zdd��ZdS�)�����)�print_functionN)�defaultdictzdnssec-coverage)�dnskey� eventlist�keydict�keyevent�keyzone�utilsc��������������O���s���t�|�|��tjd��d�S�)N����)�print�sys�exit)�args�kwargs��r����/usr/lib/python3.6/coverage.py�fatal���s���� r���Tc��������������O���sJ���d|kr|d�}|j�dd��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���)r���r���r���r���r���r����output'���s����r���c���������������C���s���da�dS�)zreset vertical spacingTN)r���r���r���r���r����vreset8���s����r���c�������������C���s����|�j���}�yt|��S��tk r$���Y�nX�tjd�}|j|��}|sJtd|����|j��\}}t|�}|j��}|jd�rx|d�S�|jd�r�|d�S�|jd�r�|d�S�|jd �r�|d �S�|jd�r�|d�S�|jd �r�|d�S�|jd�r�|S�td|���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��hi��Zmi�<����szInvalid suffix %sN) �strip�int� ValueError�re�compile�match�groups�lower� startswith)r����r�m�nZunitr���r���r���� parse_timeA���s6���� r,���c�������������C���s����|}|�s(t�jj|��s(t�j|t�j��r�t�jd�}|s>t�jj}xB|jt�j�D�]2}t�jj ||��}t�jj|�rzt�j|t�j�rzP�d}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 directoryr���r���r����set_pathk���s����$ r9���c�������� ���0���C���sD��t�dtjjtjd�d��}�tjtd�d�d�}|j dt dddFd��|j dd 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�}||_W�n�tk �r����Y�nX�y|j�r�t|j�}||_W�n�tk �r���Y�nX�y|j�r(t|j�}||_W�n�tk �r@���Y�nX�y<|j�r||j}t|j�}|dBk�rnd|_ntj��|�|_W�n�tk �r����Y�nX�|j�r�|j�r�|S�|j�r*|j�r*y:t|jdB�|j|j�}|j�p�|j|_|j�p�|j|_W�n4�tk �r(�}�ztdC|j�|��W�Y�dd}~X�nX�|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)�destr8���r=���r?����metavarz-f�filenamezzone master file�file)rB���r=���r?���rC���z-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)])rB���r=���r8���r?���rC���z-z�no_ksk� store_trueFz#Only check zone-signing keys (ZSKs))rB����actionr8���r?���z-k�no_zskz"Only check key-signing keys (KSKs)z-Dz--debugZ debug_modezTurn on debugging outputz-vz --version�version)rO���rQ���z)ERROR: -z and -k cannot be used together.ZKSKZZSKr ���z)ERROR: -f can only be used with one zone.c�������������S���s4���g�|�],}t�|�d�kr,|d�dkr,|dd��n|�qS�)r ���r@���N���rR���)�len)�.0�xr���r���r���� <listcomp>����s���zparse_args.<locals>.<listcomp>r���z"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)) r9���r.���r/���r7���r ����prefix�argparse�ArgumentParser�prog�add_argument�strrQ���� parse_argsrP���rM���r����keytyperD���rS���r;���rF���r,���r"���rH���rI���rK���rG���r���rJ���� Exceptionr���r���) rJ����parserr���r*����kr)���Zlimr;����er���r���r���r]�������s����� � "r]���c�����������(���C���sp��t���}�td��yt|�j|�j|�jd�}W�n2�tk rX�}�ztdt|����W�Y�d�d�}~X�nX�x<|D�]4}|j t ��|jr�|jt ��q`|jt |�j |�j���q`W�t d��t���yt|�}W�n2�tk r��}�ztdt|����W�Y�d�d�}~X�nX�d}|�j�s|jd�|�j|�jt ��sXd}nJxH|�jD�]>}y|j||�j|�jt ��s6d}W�n���t d|���Y�nX��qW�tj|�rfd nd ��d�S�)Nz;PHASE 1--Loading keys to check for internal timing problems)r/���ZzonesrH���z'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]���r���r���r/���r;���rH���r_���r���r\���Zcheck_prepubr����sepZ check_postpubrF���rI���r���r���Zcoverager^���rK���r���r ���)r���Zkdrb����keyZelist�errorsr;���r���r���r����main����s:����" " rf���)N)Z __future__r���r.���r���rX���Zglobr#���rG���Zcalendar�pprint�collectionsr���rZ���Ziscr���r���r���r���r���r ���r���r���r���r���r,���r9���r]���rf���r���r���r���r����<module>���s&��� * x