GhostManSec
Server: Apache
System: Linux s323.xrea.com 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User: moonarc (17751)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //usr/lib/python2.7/site-packages/dns/tsig.pyo
�
�b�Wc@s"dZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZdejj
fd��YZdejj
fd��YZd	ejj
fd
��YZdefd��YZd
efd��YZdefd��YZdefd��YZejjd�Zejjd�Zejjd�Zejjd�Zejjd�Zejjd�Zide6de6de6de6de6de6ZeZdZd Z d!Z!d"Z"de$e%ed#�Z&de$e%ed$�Z'de$e%d%�Z(d&�Z)d'�Z*dS((sDNS TSIG support.i����Ni(tlongtstring_typest	text_typetBadTimecBseZdZRS(s8The current time is not within the TSIG's validity time.(t__name__t
__module__t__doc__(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyRstBadSignaturecBseZdZRS(s#The TSIG signature fails to verify.(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR st	PeerErrorcBseZdZRS(s;Base class for all TSIG errors generated by the remote peer(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR%st
PeerBadKeycBseZdZRS(s$The peer didn't know the key we used(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR	*stPeerBadSignaturecBseZdZRS(s*The peer didn't like the signature we sent(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR
/stPeerBadTimecBseZdZRS(s%The peer didn't like the time we sent(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR4stPeerBadTruncationcBseZdZRS(s=The peer didn't like amount of truncation in the TSIG we sent(RRR(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR9ssHMAC-MD5.SIG-ALG.REG.INTs	hmac-sha1shmac-sha224shmac-sha256shmac-sha384shmac-sha512tSHA224tSHA256tSHA384tSHA512tSHA1tMD5iiiic
Csvt|t�r|j�}nt|�\}
}|r�tj|d|�}	t|�}|dkr�|	jtj	d|��|	j|�q�ntj	d|�}|	j|�|	j|d�|r|	j|j
��|	jtj	dtjj
��|	jtj	dd��n|td�}|d?td�@}|td�@}tj	d	|||�}|
|}t|�}|dkr�td
��ntj	d||�|}|r�|	j|�|	j|�n
|	j|�|	j�}tj	dt|��}|||||}|
rctj|d|�}	t|�}|	jtj	d|��|	j|�nd}	|||	fS(
sjReturn a (tsig_rdata, mac, ctx) tuple containing the HMAC TSIG rdata
    for the input parameters, the HMAC MAC calculated by applying the
    TSIG signature algorithm, and the TSIG digest context.
    @rtype: (string, string, hmac.HMAC object)
    @raises ValueError: I{other_data} is too long
    @raises NotImplementedError: I{algorithm} is not supported
    t	digestmodis!His!Ii i��I����s!HIHs TSIG Other Data is > 65535 bytess!HHN(t
isinstanceRtencodet
get_algorithmthmactnewtlentupdatetstructtpackt
to_digestabletdnst
rdataclasstANYRt
ValueErrortdigesttNone(twiretkeynametsecretttimetfudgetoriginal_idterrort
other_datatrequest_mactctxtmultitfirstt	algorithmtalgorithm_nameRtmltidt	long_timet
upper_timet
lower_timettime_mactpre_mactoltpost_mactmactmpackt
tsig_rdata((s,/usr/lib/python2.7/site-packages/dns/tsig.pytsignWsN



c

Cs.t||||||||||	|
||�
S(N(R>(
R$R%R&R'R(R)R*R+R,R-R.R/R0((s,/usr/lib/python2.7/site-packages/dns/tsig.pythmac_md5�scCshtjd|dd!�\}|dkr7tjj�n|d8}|dd!tjd|�|d|!}|}
tjj||
�\}}|
|}
tjd||
|
d!�\}}}}|td�d>|td�}|
d7}
||
|
|!}|
|7}
tjd||
|
d	!�\}}}|
d	7}
||
|
|!}|
|7}
|
||krntjj�n|dkr�|t	kr�t
�q�|tkr�t�q�|t
kr�t�q�|tkr�t�q�td
|��n||}||}||ks
||krt�nt|||||||||||	|
|�
\}}}||krdt�n|S(s*Validate the specified TSIG rdata against the other input parameters.

    @raises FormError: The TSIG is badly formed.
    @raises BadTime: There is too much time skew between the client and the
    server.
    @raises BadSignature: The TSIG signature did not validate
    @rtype: hmac.HMAC objects!Hi
iiis!HIHHi s!HHHisunknown TSIG error code %d(RtunpackRt	exceptiont	FormErrorRtnamet	from_wireRtBADSIGR
tBADKEYR	tBADTIMERtBADTRUNCRRRR>R(R$R%R&tnowR,t
tsig_startR=t
tsig_rdlenR-R.R/tadcounttnew_wiretcurrenttanametusedR5R6R(tmac_sizeR'R;R)R*t
other_sizeR+ttime_lowt	time_hightjunktour_mac((s,/usr/lib/python2.7/site-packages/dns/tsig.pytvalidate�sN

(
)"

&

				

			cCsxt|t�r$tjj|�}ny"|j�tjjt|fSWn+t	k
rst
dt|�d��nXdS(s�Returns the wire format string and the hash module to use for the
    specified TSIG algorithm

    @rtype: (string, hash constructor)
    @raises NotImplementedError: I{algorithm} is not supported
    sTSIG algorithm s is not supportedN(RRRRCt	from_textRthashthashest_hashestKeyErrortNotImplementedErrortstr(R0((s,/usr/lib/python2.7/site-packages/dns/tsig.pyR�s"
cCs�|}tjj||�\}}||}tjd|||d!�\}}}}	|d7}||||	!}
||	7}|||kr�tjj�n||
fS(slReturn the tsig algorithm for the specified tsig_rdata
    @raises FormError: The TSIG is badly formed.
    s!HIHHi
(RRCRDRR@RARB(R$R=RKRNRORPR5R6R(RQR;((s,/usr/lib/python2.7/site-packages/dns/tsig.pytget_algorithm_and_mac�s
)

(+RRRt
dns.exceptionRtdns.hashtdns.rdataclasstdns.namet_compatRRRRAtDNSExceptionRRRR	R
RRRCRXtHMAC_MD5t	HMAC_SHA1tHMAC_SHA224tHMAC_SHA256tHMAC_SHA384tHMAC_SHA512R[tdefault_algorithmRERFRGRHR#tFalsetTrueR>R?RWRR_(((s,/usr/lib/python2.7/site-packages/dns/tsig.pyt<module>sN
	5	5