AlkantarClanX12

Your IP : 18.221.238.204


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

3

���f&�@shddlZddlZddlZddlmZmZddlmZmZdZ	Gdd�d�Z
d
dd�Zd	d
�Zdd�Z
dS)�N)�Popen�PIPE)�prefix�versionzdnssec-checkdsc@sPeZdZddddd�ZdZdZdZdZdZdZ	d	Z
dd
d�Zdd
�Zdd�Z
dS)�SECRRzSHA-1zSHA-256ZGOSTzSHA-384)������INNrcCs�|st�t|�tk	r$|jd�j�}n|j�}t|�dkr<t�|r�d|_|j�|_|dj�j	d�jd�}|j
�|jd�}|j
�xDt|�dkr�t|�dkr�|d|dkr�|dd�}|dd�}q�W|r�t�|j
�dj|�|_|jd|jd|_
nd|_|dj�|_
|dd�}|dj�dk�rJ|dj�|_|dd�}n(t|d�|_|dj�|_|dd�}|dj�|jk�r�td|dj�|jf��tt|dd
��\|_|_|_dj|d
d��j�|_dS)N�ascii��DLVr�.r�DSr�CH�HSrz%s does not match %sr
r)rrr)�	Exception�type�str�decode�split�len�rrtype�lower�dlvname�strip�reverse�join�parent�rrname�upper�rrclass�int�ttl�map�keyid�keyalg�hashalg�digest)�selfZrrtextrZfieldsr �dlv�r-�/usr/lib/python3.6/checkds.py�__init__$sH

*zSECRR.__init__cCs$d|j|j|j|j|j|j|jfS)Nz%s %s %s %d %d %d %s)r!r#rr'r(r)r*)r+r-r-r.�__repr__SszSECRR.__repr__cCs|j�|j�kS)N)r0)r+�otherr-r-r.�__eq__XszSECRR.__eq__)N)�__name__�
__module__�__qualname__�hashalgsr!r#r'r(r)r*r%r/r0r2r-r-r-r.rs
/rc
	Cs&g}|jddd|rdndd|r*|d|n|g}t|td�j�\}}x6|j�D]*}t|�tk	rh|jd	�}|jt	||��qNWt
|d
d�d�}g}	|r�|jd
|g}|r�|d|g7}|j|�t|td�j�\}}ndt|jddddd|gtd�j�\}
}|jd
dg}|�r|d|g7}|j|�t|ttd�j|
�\}}x:|j�D].}t|�tk	�rZ|jd	�}|	jt	||���q>Wt|	�dk�r�t
d�dSd}xv|	D]n}||k�r�t
d|j|jjd�|j|jt	j|jf�d}n,t
d|j|jjd�|j|jt	j|jf��q�W|�s"t
d|�rdnd�|S)Nz+noallz+answerz-tr,Zdsz-qr)�stdoutr
cSs|j|j|jfS)N)r'r(r))�rrr-r-r.�<lambda>mszcheck.<locals>.<lambda>)�keyz-fz-lZdnskey�-)�stdinr7rz$No DNSKEY records found in zone apexFz,%s for KSK %s/%03d/%05d (%s) found in parentTz0%s for KSK %s/%03d/%05d (%s) missing from parentz'No %s records were found for any DNSKEYrr)�digrrZcommunicate�
splitlinesrrr�appendr�sorted�	dsfromkeyr�printrr!rr(r'r6r))
�zone�args�
masterfile�	lookasideZrrlist�cmd�fp�_�lineZklistZintods�foundr8r-r-r.�checkcsV





rLcCs�tjtdd�}d}tjdkr"dnd}|jdtdd�|jd	d
dtdd
�|jdddtdd
�|jdddtjjt	|�d�tdd�|jdddtjjt	|�d�tdd�|jdddt
d�|j�}|jj
d �|_|jr�|jj
d �|_|S)!Nz: checks DS coverage)�description�bin�ntZsbinrCz
zone to check)r�helpz-fz--filerEzzone master file)�destrrPz-lz--lookasiderFzDLV lookaside zonez-dz--digr=z
path to 'dig')rQ�defaultrrPz-Dz--dsfromkeyrAzdnssec-dsfromkeyzpath to 'dnssec-dsfromkey'z-vz	--versionr)�actionrr)�argparse�ArgumentParser�prog�os�name�add_argumentr�pathrrr�
parse_argsrCrrF)�parserZbindirZsbindirrDr-r-r.r[�s,




r[cCs.t�}t|j||j|j�}t|r$dnd�dS)Nrr)r[rLrCrErF�exit)rDrKr-r-r.�main�sr^)NN)rTrW�sys�
subprocessrrZ	isc.utilsrrrVrrLr[r^r-r-r-r.�<module>sI
;