Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
¢báW& ã @ s~ d Z ddlZddlZddlZddlZddlZddlZddlm Z m
Z
mZ G dd„ dejj
ƒZG dd„ dejj
ƒZG d d
„ d
ejj
ƒZG dd„ deƒZG d
d„ deƒZG dd„ deƒZG dd„ deƒZejjdƒZejjdƒZejjdƒZejjdƒZejjdƒZejjdƒZedededededediZeZdZd Z d!Z!d"Z"dd#d$efd%d&„Z#dd#d$efd'd(„Z$d/d)d*„Z%d+d,„ Z&d-d.„ Z'dS )0zDNS TSIG support.é Né )ÚlongÚstring_typesÚ text_typec @ s e Zd ZdZdS )ÚBadTimez8The current time is not within the TSIG's validity time.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r r ú/usr/lib/python3.6/tsig.pyr s r c @ s e Zd ZdZdS )ÚBadSignaturez#The TSIG signature fails to verify.N)r r r r
r r r r r
s r
c @ s e Zd ZdZdS )Ú PeerErrorz;Base class for all TSIG errors generated by the remote peerN)r r r r
r r r r r % s r c @ s e Zd ZdZdS )Ú
PeerBadKeyz$The peer didn't know the key we usedN)r r r r
r r r r r * s r c @ s e Zd ZdZdS )ÚPeerBadSignaturez*The peer didn't like the signature we sentN)r r r r
r r r r r / s r c @ s e Zd ZdZdS )ÚPeerBadTimez%The peer didn't like the time we sentN)r r r r
r r r r r 4 s r c @ s e Zd ZdZdS )ÚPeerBadTruncationz=The peer didn't like amount of truncation in the TSIG we sentN)r r r r
r r r r r 9 s r zHMAC-MD5.SIG-ALG.REG.INTz hmac-sha1zhmac-sha224zhmac-sha256zhmac-sha384zhmac-sha512ZSHA224ZSHA256ZSHA384ZSHA512ZSHA1ZMD5é é é é FTc
C sÄ t |tƒr|jƒ }t|ƒ\}
}|r\tj||d�} t|ƒ}|dkr\| jtj d|ƒƒ | j|ƒ tj d|ƒ}| j|ƒ | j| dd… ƒ |r¾| j|j
ƒ ƒ | jtj dtjj
ƒƒ | jtj ddƒƒ |tdƒ }|d? tdƒ@ }|td ƒ@ }tj d
|||ƒ}|
| }t|ƒ}|dk�rtdƒ‚tj d||ƒ| }|�rF| j|ƒ | j|ƒ n
| j|ƒ | jƒ }tj dt|ƒƒ}|| | | | }|
�r¶tj||d�} t|ƒ}| jtj d|ƒƒ | j|ƒ nd} ||| fS )
aj Return 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
)Ú digestmodr z!Hé Nz!Ié iÿÿ l ÿÿ z!HIHz TSIG Other Data is > 65535 bytesz!HH)Ú
isinstancer ÚencodeÚ
get_algorithmÚhmacÚnewÚlenÚupdateÚstructÚpackÚ
to_digestableÚdnsZ
rdataclassÚANYr Ú
ValueErrorZdigest)ÚwireÚkeynameÚsecretÚtimeÚfudgeÚoriginal_idÚerrorÚ
other_dataÚrequest_macÚctxÚmultiÚfirstÚ algorithmZalgorithm_namer ZmlÚidZ long_timeÚ
upper_timeÚ
lower_timeZtime_macZpre_macZolZpost_macÚmacZmpackÚ
tsig_rdatar r r ÚsignW sN
r9 c
C s t | ||||||||| |
||ƒ
S )N)r9 )
r' r( r) r* r+ r, r- r. r/ r0 r1 r2 r3 r r r Úhmac_md5� s r: c C sÖ t jd| dd… ƒ\}|dkr&tjj‚|d8 }| dd… t jd|ƒ | d|… }|}
tjj| |
ƒ\}}|
| }
t jd| |
|
d … ƒ\}}}}|tdƒ d> |tdƒ }|
d7 }
| |
|
| … }|
|7 }
t jd| |
|
d … ƒ\}}}|
d 7 }
| |
|
| … }|
|7 }
|
|| k�r tjj‚|dk�rv|t k�r:t
‚n<|tk�rJt‚n,|t
k�rZt‚n|tk�rjt‚ntd
| ƒ‚|| }|| }||k �sš||k�ržt‚t||||||||||| |
|ƒ
\}}}||k�rÒt‚|S )a* 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 objectz!Hé
é r r z!HIHHr z!HHHé zunknown TSIG error code %d)r! Úunpackr$ Ú exceptionÚ FormErrorr" ÚnameÚ from_wirer ÚBADSIGr ÚBADKEYr ÚBADTIMEr ÚBADTRUNCr r r r9 r
)r' r( r) Znowr/ Z
tsig_startr8 Ú
tsig_rdlenr0 r1 r2 ZadcountZnew_wireÚcurrentÚanameÚusedr5 r6 r+ Úmac_sizer* r7 r, r- Z
other_sizer. Ztime_lowZ time_highZjunkZour_macr r r Úvalidate” sN
$
rL c C s\ t | tƒrtjj| ƒ} y| jƒ tjjt| fS t k
rV t
dt| ƒ d ƒ‚Y nX dS )zÊ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
zTSIG algorithm z is not supportedN)r r r$ rA Ú from_textr# ÚhashZhashesÚ_hashesÚKeyErrorÚNotImplementedErrorÚstr)r3 r r r r Ê s
r c C sz |}t jj| |ƒ\}}|| }tjd| ||d … ƒ\}}}} |d7 }| ||| … }
|| 7 }||| krrt jj‚||
fS )zlReturn the tsig algorithm for the specified tsig_rdata
@raises FormError: The TSIG is badly formed.
z!HIHHr; )r$ rA rB r! r> r? r@ )r' r8 rG rH rI rJ r5 r6 r+ rK r7 r r r Úget_algorithm_and_macÜ s rS )NFT)(r
r r! Z
dns.exceptionr$ Zdns.hashZdns.rdataclassZdns.nameZ_compatr r r r? ZDNSExceptionr r
r r r r r rA rM ZHMAC_MD5Z HMAC_SHA1ZHMAC_SHA224ZHMAC_SHA256ZHMAC_SHA384ZHMAC_SHA512rO Zdefault_algorithmrC rD rE rF r9 r: rL r rS r r r r Ú sL 5
5