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/query.pyo
�
�b�Wc@s*dZddlmZddlZddlZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlmZmZejdkr�eZn	ejZejZde
jjfd��YZd	e
jjfd
��YZd�Zd�Zd
�Zd�Z d�Z!e"ed�rcea#nea#d�Z$d�Z%d�Z&d�Z'ddddde)e)d�Z*d�Z+d�Z,d�Z-ddddde)d�Z.e
j/j0e
j1j2dddde3ddddde)e
j4j5d�Z6dS(sTalk to a DNS server.i����(t
generatorsNi(tlongtstring_typesitUnexpectedSourcecBseZdZRS(s=A DNS query response came from an unexpected address or port.(t__name__t
__module__t__doc__(((s-/usr/lib/python2.7/site-packages/dns/query.pyR,stBadResponsecBseZdZRS(s<A DNS query response does not respond to the question asked.(RRR(((s-/usr/lib/python2.7/site-packages/dns/query.pyR1scCs"|dkrdStj�|SdS(N(tNonettime(ttimeout((s-/usr/lib/python2.7/site-packages/dns/query.pyt_compute_expiration6scCs�d}|r|tjO}n|r2|tjO}n|rH|tjO}ntj�}|j||�|r�|jt|d��}n|j�}t|�S(sqPoll polling backend.
    @param fd: File descriptor
    @type fd: int
    @param readable: Whether to wait for readability
    @type readable: bool
    @param writable: Whether to wait for writability
    @type writable: bool
    @param timeout: Deadline timeout (expiration time, in seconds)
    @type timeout: float
    @return True on success, False on timeout
    ii�(tselecttPOLLINtPOLLOUTtPOLLERRtpolltregisterRtbool(tfdtreadabletwritableterrorR
t
event_masktpollablet
event_list((s-/usr/lib/python2.7/site-packages/dns/query.pyt	_poll_for=scCs�ggg}}}|r&|g}n|r8|g}n|rJ|g}n|dkrwtj|||�\}}	}
n!tj||||�\}}	}
t|p�|	p�|
�S(ssSelect polling backend.
    @param fd: File descriptor
    @type fd: int
    @param readable: Whether to wait for readability
    @type readable: bool
    @param writable: Whether to wait for writability
    @type writable: bool
    @param timeout: Deadline timeout (expiration time, in seconds)
    @type timeout: float
    @return True on success, False on timeout
    N(RRR(RRRRR
trsettwsettxsettrcounttwcounttxcount((s-/usr/lib/python2.7/site-packages/dns/query.pyt_select_for\s!!cCs�t}x�|s�|dkr$d}n+|tj�}|dkrOtjj�ny+t|||||�sytjj�nWn2tk
r�}|jdt	j
kr�|�q�nXt}q	WdS(Ngi(tFalseRR	tdnst	exceptiontTimeoutt_polling_backendtselect_errortargsterrnotEINTRtTrue(RRRRt
expirationtdoneR
te((s-/usr/lib/python2.7/site-packages/dns/query.pyt	_wait_forys		
cCs
|adS(s#
    Internal API. Do not use.
    N(R&(tfn((s-/usr/lib/python2.7/site-packages/dns/query.pyt_set_polling_backend�sRcCst|ttt|�dS(N(R/R+R"(tsR,((s-/usr/lib/python2.7/site-packages/dns/query.pyt_wait_for_readable�scCst|ttt|�dS(N(R/R"R+(R2R,((s-/usr/lib/python2.7/site-packages/dns/query.pyt_wait_for_writable�scCsPtjj||d�}tjj||d�}||koO|d|dkS(Nii(R#tinett	inet_pton(tafta1ta2tn1tn2((s-/usr/lib/python2.7/site-packages/dns/query.pyt_addresses_equal�scCs|dkrEytjj|�}WqEtk
rAtjj}qEXn|tjjkr�||f}|dk	s{|dkr|dkr�d}n||f}qni|tjjkr||ddf}|dk	s�|dkr|dkr�d}n||ddf}qn|||fS(Nis0.0.0.0s::(RR#R5taf_for_addresst	ExceptiontAF_INETtAF_INET6(R7twheretporttsourcetsource_porttdestination((s-/usr/lib/python2.7/site-packages/dns/query.pyt_destination_and_source�s$
		i5ic	Cs�|j�}	t|||||�\}}
}t|tjd�}d}z�t|�}
|jd�|dk	r�|j|�nt	||
�t
j
�}|j|	|
�x�t||
�|j
d�\}	}t|||
�stjj|�r
|d|
dkr
Pn|s�td||
f��q�q�WWd|dkrFd}nt
j
�|}|j�Xtjj|	d|jd|jd|�}||_
|j|�s�t�n|S(	s�Return the response obtained after sending a query via UDP.

    @param q: the query
    @type q: dns.message.Message
    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param timeout: The number of seconds to wait before the query times out.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @rtype: dns.message.Message object
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param ignore_unexpected: If True, ignore responses from unexpected
    sources.  The default is False.
    @type ignore_unexpected: bool
    @param one_rr_per_rrset: Put each RR into its own RRset
    @type one_rr_per_rrset: bool
    ii��is$got a response from %s instead of %sNtkeyringtrequest_mactone_rr_per_rrset(tto_wireRFtsocket_factorytsockett
SOCK_DGRAMRRtsetblockingtbindR4R	tsendtoR3trecvfromR<R#R5tis_multicastRtclosetmessaget	from_wireRGtmactis_responseR(tqRAR
RBR7RCRDtignore_unexpectedRItwireRER2t
begin_timeR,tfrom_addresst
response_timetr((s-/usr/lib/python2.7/site-packages/dns/query.pytudp�sD


	!			cCshd}x[|dkrct||�|j|�}|dkrFt�n|t|�}||}q	W|S(s�Read the specified number of bytes from sock.  Keep trying until we
    either get the desired amount, or we hit EOF.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    ti(R3trecvtEOFErrortlen(tsocktcountR,R2tn((s-/usr/lib/python2.7/site-packages/dns/query.pyt	_net_reads
	cCsMd}t|�}x4||krHt||�||j||�7}qWdS(s�Write the specified data to the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    iN(RcR4tsend(RdtdataR,tcurrenttl((s-/usr/lib/python2.7/site-packages/dns/query.pyt
_net_writes

cCs�y|j|�Wnvtjk
r�tj�d \}}t|d�rU|j}n
|d}|tjtjtj	gkr�|�q�nXdS(NiR)i(
tconnectRLRtsystexc_infothasattrR)tEINPROGRESStEWOULDBLOCKtEALREADY(R2taddressttytvtv_err((s-/usr/lib/python2.7/site-packages/dns/query.pyt_connect%s
cCs�|j�}t|||||�\}}	}t|tjd�}
d}z�t|�}|
jd�tj�}|dk	r�|
j	|�nt
|
|	�t|�}
tj
d|
�|}t|
||�t|
d|�}tjd|�\}
t|
|
|�}Wd|dkrd}ntj�|}|
j�Xtjj|d|jd|jd|�}||_|j|�s�t�n|S(sReturn the response obtained after sending a query via TCP.

    @param q: the query
    @type q: dns.message.Message object
    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param timeout: The number of seconds to wait before the query times out.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @rtype: dns.message.Message object
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param one_rr_per_rrset: Put each RR into its own RRset
    @type one_rr_per_rrset: bool
    is!HiNRGRHRI(RJRFRKRLtSOCK_STREAMRRRNR	RORxRctstructtpackRlRgtunpackRSR#RTRURGRVRWR(RXRAR
RBR7RCRDRIRZRER2R[R,RkttcpmsgtldataR]R^((s-/usr/lib/python2.7/site-packages/dns/query.pyttcp3s8

	!			c&csHt|t�r$tjj|�}nt|t�rHtjj|�}ntjj|||�}|tjjkr�tj	j|dddd|
�}|j
j|�n|dk	r�|j
||d|�n|j�}t|	||||�\}	}}|r8|tjjkr td��nt|	tjd�}nt|	tjd�}|jd�|dk	rv|j|�nt|
�}t||�t|�}|r�t||�|j|�n&tjd|�|}t|||�t}t }t}d}|r|}tjj!}nd}|}d}t }x|s9t|�} | dks\| |kre|} n|r�t"||�|j#d�\}}!n9t$|d	| �}"tj%d|"�\}t$||| �}|tjjk}#tjj&|d
|j'd|j(dt d
|d|dt d|d|#�}$|$j)}t}d}%|dkr�|$j*sd|$j*dj|krytj+j,d��n|$j*d}|j-tjj.kr�tj+j,d��nd}%|j/�}|tjjkr�|dj0|
kr�t }q�t }q�nx|$j*|%D]�}|r+tj+j,d��n|j-tjj.kr�|j|kr�|r�|dj0|
kr}tj+j,d��nt}n|tjjkr�|}n||kr�|tjj1ks�|tjjkr�|r�t }q�q
|r
tjj1}t}q
q
W|r1|j'r1|$j2r1tj+j,d��n|$Vq2W|j3�dS(s�Return a generator for the responses to a zone transfer.

    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param zone: The name of the zone to transfer
    @type zone: dns.name.Name object or string
    @param rdtype: The type of zone transfer.  The default is
    dns.rdatatype.AXFR.
    @type rdtype: int or string
    @param rdclass: The class of the zone transfer.  The default is
    dns.rdataclass.IN.
    @type rdclass: int or string
    @param timeout: The number of seconds to wait for each response message.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param keyring: The TSIG keyring to use
    @type keyring: dict
    @param keyname: The name of the TSIG key to use
    @type keyname: dns.name.Name object or string
    @param relativize: If True, all names in the zone will be relativized to
    the zone origin.  It is essential that the relativize setting matches
    the one specified to dns.zone.from_xfr().
    @type relativize: bool
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @param lifetime: The total number of seconds to spend doing the transfer.
    If None, the default, then there is no limit on the time the transfer may
    take.
    @type lifetime: float
    @rtype: generator of dns.message.Message objects.
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param serial: The SOA serial number to use as the base for an IXFR diff
    sequence (only meaningful if rdtype == dns.rdatatype.IXFR).
    @type serial: int
    @param use_udp: Use UDP (only meaningful for IXFR)
    @type use_udp: bool
    @param keyalgorithm: The TSIG algorithm to use; defaults to
    dns.tsig.default_algorithm
    @type keyalgorithm: string
    itINtSOAs. . %u 0 0 0 0t	algorithmscannot do a UDP AXFRs!Hi��iRGRHtxfrtoriginttsig_ctxtmultitfirstRIs No answer or RRset not for qnamesfirst RRset is not an SOAisanswers after final SOAsIXFR base serial mismatchsmissing TSIGN(4t
isinstanceRR#tnamet	from_textt	rdatatypeRTt
make_querytIXFRtrrsett	authoritytappendRtuse_tsigRJRFt
ValueErrorRKRLRMRyRNRORRxRcR4RhRzR{RlR"R+temptyR3RQRgR|RURGRVR�tanswerR$t	FormErrortrdtypeR�tcopytserialtAXFRthad_tsigRS(&RAtzoneR�trdclassR
RBRGtkeynamet
relativizeR7tlifetimeRCRDR�tuse_udptkeyalgorithmRXR�RZRER2R,RkR}R-tdelete_modet
expecting_SOAt	soa_rrsetR�tonameR�R�tmexpirationR\R~tis_ixfrR^tanswer_index((s-/usr/lib/python2.7/site-packages/dns/query.pyR�ss�5



		
!		 	
	$		

	(i(7Rt
__future__RR)RRLRzRnR	t
dns.exceptionR#tdns.inettdns.nametdns.messagetdns.rdataclasst
dns.rdatatypet_compatRRtversion_infotOSErrorR'RRKR$tDNSExceptionRR�RRRR!R/R1RpR&R3R4R<RFRR"R_RgRlRxRR�R�t
rdataclassR�R+ttsigtdefault_algorithmR�(((s-/usr/lib/python2.7/site-packages/dns/query.pyt<module>sV														C			?