Viewing File: /usr/lib64/python2.7/site-packages/dns/resolver.pyo


Sc@s`dZddlZddlZddlZddlZyddlZWnek
reddlZnXddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ejdkrddlZnde
jjfdYZde
jjfdYZe
jjZde
jjfd	YZd
e
jjfdYZde
jjfd
YZde
jjfdYZde
jjfdYZ de!fdYZ"de!fdYZ#de!fdYZ$de!fdYZ%de!fdYZ&e'a(dZ)e
j*j+e
j,j-e.e'e/ddZ0e
j,j-e.e'dZ1iej2gej36ej4gej56Z6e'a7ej8Z9ej:Z;ej<Z=ej>Z?ej@ZAejBZCe'e'ejDdddd ZEdd!ZFe'd"ZGd#ZHd$ZId%ZJe'd&ZKd'ZLdS((s{DNS stub resolver.

@var default_resolver: The default resolver object
@type default_resolver: dns.resolver.Resolver objectiNtwin32tNXDOMAINcBseZdZRS(sThe query name does not exist.(t__name__t
__module__t__doc__(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR.stYXDOMAINcBseZdZRS(s4The query name is too long after DNAME substitution.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR2stNoAnswercBseZdZRS(s7The response did not contain an answer to the question.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR<st
NoNameserverscBseZdZRS(s<No non-broken nameservers are available to answer the query.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR@stNotAbsolutecBseZdZRS(sSRaised if an absolute domain name is required but a relative name
    was provided.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRDst	NoRootSOAcBseZdZRS(sYRaised if for some reason there is no SOA at the root name.
    This should never happen!(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR	Ist
NoMetaqueriescBseZdZRS(sMetaqueries are not allowed.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR
NstAnswercBsYeZdZedZdZdZdZdZdZ	dZ
dZRS(	s9DNS stub resolver answer

    Instances of this class bundle up the result of a successful DNS
    resolution.

    For convenience, the answer object implements much of the sequence
    protocol, forwarding to its rrset.  E.g. "for a in answer" is
    equivalent to "for a in answer.rrset", "answer[i]" is equivalent
    to "answer.rrset[i]", and "answer[i:j]" is equivalent to
    "answer.rrset[i:j]".

    Note that CNAMEs or DNAMEs in the response may mean that answer
    node's name might not be the query name.

    @ivar qname: The query name
    @type qname: dns.name.Name object
    @ivar rdtype: The query type
    @type rdtype: int
    @ivar rdclass: The query class
    @type rdclass: int
    @ivar response: The response message
    @type response: dns.message.Message object
    @ivar rrset: The answer
    @type rrset: dns.rrset.RRset object
    @ivar expiration: The time when the answer expires
    @type expiration: float (seconds since the epoch)
    @ivar canonical_name: The canonical name of the query name
    @type canonical_name: dns.name.Name object
    cCs^||_||_||_||_d}d}x#tddD]}yG|j|j|||}|dks|j|kr|j}nPWq@t	k
rQ|t
jjkr?yj|j|j||t
jj}	|dks|	j|kr|	j}nx|	D]}
|
j
}PqWw@Wq?t	k
r;|r<tq<q?Xn|rRtqRq@Xq@W|dkrq|rqtn||_||_|dkrGxyp|j|j||t
jj}|dks|j|kr|j}n|dj|kr|dj}nPWqt	k
r@y|j}WqAt
jjk
r<PqAXqXqntj||_dS(Niii(tqnametrdtypetrdclasstresponsetNonetxranget
find_rrsettanswertttltKeyErrortdnst	rdatatypetCNAMEttargetRtcanonical_nametrrsett	authoritytSOAtminimumtparenttnametNoParentttimet
expiration(tselfRR
RRtraise_on_no_answertmin_ttlRtcounttcrrsettrdtsrrset((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__init__qsf				

	
			
cCs~|dkr|jjS|dkr,|jjS|dkrB|jjS|dkrX|jjS|dkrn|jjSt|dS(NR RtcoversRR
(RR RR,RR
tAttributeError(R$tattr((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getattr__s




cCs
t|jS(N(tlenR(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__len__scCs
t|jS(N(titerR(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__iter__scCs|j|S(N(R(R$ti((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getitem__scCs|j|=dS(N(R(R$R4((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__delitem__scCs|j||!S(N(R(R$R4tj((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getslice__scCs|j||5dS(N(R(R$R4R7((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__delslice__s(RRRtTrueR+R/R1R3R5R6R8R9(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRSs7						tCachecBsAeZdZddZdZdZdZddZRS(sqSimple DNS answer cache.

    @ivar data: A dictionary of cached data
    @type data: dict
    @ivar cleaning_interval: The number of seconds between cleanings.  The
    default is 300 (5 minutes).
    @type cleaning_interval: float
    @ivar next_cleaning: The time the cache should next be cleaned (in seconds
    since the epoch.)
    @type next_cleaning: float
    gr@cCs;i|_||_tj|j|_tj|_dS(sInitialize a DNS cache.

        @param cleaning_interval: the number of seconds between periodic
        cleanings.  The default is 300.0
        @type cleaning_interval: float.
        N(tdatatcleaning_intervalR"t
next_cleaningt
_threadingtLocktlock(R$R=((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+s		cCstj}|j|krg}x<|jjD]+\}}|j|kr1|j|q1q1Wx|D]}|j|=qgWtj}||j|_ndS(s&Clean the cache if it's time to do so.N(R"R>R<t	iteritemsR#tappendR=(R$tnowtkeys_to_deletetktv((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_maybe_cleans
cCskzV|jj|j|jj|}|dksM|jtjkrQdS|SWd|jjXdS(s)Get the answer associated with I{key}.  Returns None if
        no answer is cached for the key.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @rtype: dns.resolver.Answer object or None
        N(	RAtacquireRHR<tgetRR#R"trelease(R$tkeyRG((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRJs	

!cCs=z(|jj|j||j|<Wd|jjXdS(sAssociate key and value in the cache.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @param value: The answer being cached
        @type value: dns.resolver.Answer object
        N(RARIRHR<RK(R$RLtvalue((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytputs
	

cCssz^|jj|dk	r>|jj|r]|j|=q]ni|_tj|j|_Wd|jjXdS(sFlush the cache.

        If I{key} is specified, only that item is flushed.  Otherwise
        the entire cache is flushed.

        @param key: the key to flush
        @type key: (dns.name.Name, int, int) tuple or None
        N(	RARIRR<thas_keyR"R=R>RK(R$RL((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytflushs

	N(	RRRR+RHRJRNRRP(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR;s
			tLRUCacheNodecBs2eZdZdZdZdZdZRS(sLRUCache node.
    cCs(||_||_||_||_dS(N(RLRMtprevtnext(R$RLRM((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+,s			cCs.|j|_||_||j_||_dS(N(RRRS(R$tnode((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytlink_before2s	cCs.||_|j|_||j_||_dS(N(RRRS(R$RT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt
link_after8s	cCs"|j|j_|j|j_dS(N(RRRS(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytunlink>s(RRRR+RURVRW(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRQ)s
			tLRUCachecBsAeZdZddZdZdZdZddZRS(sOBounded least-recently-used DNS answer cache.

    This cache is better than the simple cache (above) if you're
    running a web crawler or other process that does a lot of
    resolutions.  The LRUCache has a maximum number of nodes, and when
    it is full, the least-recently used node is removed to make space
    for a new one.

    @ivar data: A dictionary of cached data
    @type data: dict
    @ivar sentinel: sentinel node for circular doubly linked list of nodes
    @type sentinel: LRUCacheNode object
    @ivar max_size: The maximum number of nodes
    @type max_size: int
    icCs;i|_|j|tdd|_tj|_dS(sInitialize a DNS cache.

        @param max_size: The maximum number of nodes to cache; the default is 100000.  Must be > 1.
        @type max_size: int
        N(R<tset_max_sizeRQRtsentinelR?R@RA(R$tmax_size((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+Ss	
cCs"|dkrd}n||_dS(Ni(R[(R$R[((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRY^s	cCsz}|jj|jj|}|dkr2dS|j|jjtjkre|j|j	=dS|j
|j|jSWd|jjXdS(s)Get the answer associated with I{key}.  Returns None if
        no answer is cached for the key.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @rtype: dns.resolver.Answer object or None
        N(
RARIR<RJRRWRMR#R"RLRVRZRK(R$RLRT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRJcs


cCsz|jj|jj|}|dk	rH|j|j|j=nx?t|j|jkr|j	j
}|j|j|j=qKWt||}|j|j	||j|<Wd|jj
XdS(sAssociate key and value in the cache.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @param value: The answer being cached
        @type value: dns.resolver.Answer object
        N(RARIR<RJRRWRLR0R[RZRRRQRVRK(R$RLRMRT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRN{s


cCsz|jj|dk	rW|jj|}|dk	r|j|j|j=qnL|jj}x4||jkr|j}d|_	d|_|}qfWi|_Wd|jj
XdS(sFlush the cache.

        If I{key} is specified, only that item is flushed.  Otherwise
        the entire cache is flushed.

        @param key: the key to flush
        @type key: (dns.name.Name, int, int) tuple or None
        N(RARIRR<RJRWRLRZRSRRRK(R$RLRTRS((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRPs	

			

N(	RRRR+RYRJRNRRP(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRXBs			tResolvercBseZdZdedZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZejjejjeded
dZdejjdZdZdZRS(s)DNS stub resolver

    @ivar domain: The domain of this host
    @type domain: dns.name.Name object
    @ivar nameservers: A list of nameservers to query.  Each nameserver is
    a string which contains the IP address of a nameserver.
    @type nameservers: list of strings
    @ivar search: The search list.  If the query name is a relative name,
    the resolver will construct an absolute query name by appending the search
    names one by one to the query name.
    @type search: list of dns.name.Name objects
    @ivar port: The port to which to send queries.  The default is 53.
    @type port: int
    @ivar timeout: The number of seconds to wait for a response from a
    server, before timing out.
    @type timeout: float
    @ivar lifetime: The total number of seconds to spend trying to get an
    answer to the question.  If the lifetime expires, a Timeout exception
    will occur.
    @type lifetime: float
    @ivar keyring: The TSIG keyring to use.  The default is None.
    @type keyring: dict
    @ivar keyname: The TSIG keyname to use.  The default is None.
    @type keyname: dns.name.Name object
    @ivar keyalgorithm: The TSIG key algorithm to use.  The default is
    dns.tsig.default_algorithm.
    @type keyalgorithm: string
    @ivar edns: The EDNS level to use.  The default is -1, no Edns.
    @type edns: int
    @ivar ednsflags: The EDNS flags
    @type ednsflags: int
    @ivar payload: The EDNS payload size.  The default is 0.
    @type payload: int
    @ivar flags: The message flags to use.  The default is None (i.e. not overwritten)
    @type flags: int
    @ivar cache: The cache to use.  The default is None.
    @type cache: dns.resolver.Cache object
    @ivar retry_servfail: should we retry a nameserver if it says SERVFAIL?
    The default is 'false'.
    @type retry_servfail: bool
    s/etc/resolv.confcCsI|j|rEtjdkr,|jqE|rE|j|qEndS(sJInitialize a resolver instance.

        @param filename: The filename of a configuration file in
        standard /etc/resolv.conf format.  This parameter is meaningful
        only when I{configure} is true and the platform is POSIX.
        @type filename: string or file object
        @param configure: If True (the default), the resolver instance
        is configured in the normal fashion for the operating system
        the resolver is running on.  (I.e. a /etc/resolv.conf file on
        POSIX systems and from the registry on Windows systems.)
        @type configure: boolRN(tresettsystplatformt
read_registrytread_resolv_conf(R$tfilenamet	configure((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+s

cCstjjtjjtjd|_t|jdkrRtjj|_ng|_	g|_
d|_d|_d|_
d|_d|_tjj|_d|_d|_d|_d|_d|_t|_t|_dS(s1Reset all resolver configuration to the defaults.iii5g@g>@iN(RR tNamet	from_texttsockettgethostnametdomainR0troottnameserverstsearchtportttimeouttlifetimeRtkeyringtkeynamettsigtdefault_algorithmtkeyalgorithmtednst	ednsflagstpayloadtcachetflagstFalsetretry_servfailtrotate(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR]s$+													cCst|tst|tr[yt|d}Wntk
rQdg|_dSXt}nt}z7x0|D](}t|dksk|ddksk|ddkrqkn|j	}t|dkrqkn|ddkr|jj
|dqk|dd	kr tjj
|d|_qk|dd
krdx`|dD]"}|jj
tjj
|q;Wqk|ddkrkd|dkrt|_qqkqkWWd|r|jnXt|jdkr|jj
dndS(
sProcess f as a file in the /etc/resolv.conf format.  If f is
        a string, it is used as the name of the file to open; otherwise it
        is treated as the file itself.trs	127.0.0.1Nit#t;t
nameserveriRhRktoptionsR{(t
isinstancetstrtunicodetopentIOErrorRjR:RyR0tsplitRCRR ReRhRkR{tclose(R$tft
want_closetlttokenstsuffix((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRas:
	
2#cCsF|jddkrd}n$|jddkr<d}nd}|S(Nt it,(tfind(R$tentryt
split_char((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_determine_split_char(s		cCsat|}|j|}|j|}x0|D](}||jkr1|jj|q1q1WdS(s&Configure a NameServer registry entry.N(RRRRjRC(R$RjRtns_listtns((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_nameservers7s
cCstjjt||_dS(s"Configure a Domain registry entry.N(RR ReRRh(R$Rh((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_domainAscCsmt|}|j|}|j|}x<|D]4}||jkr1|jjtjj|q1q1WdS(s"Configure a Search registry entry.N(RRRRkRCRR Re(R$RkRtsearch_listts((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_searchFs
cCstytj|d\}}Wntk
r5d}nX|r|j|y2tj|d\}}|rz|j|nWq$tk
rq$Xnytj|d\}}Wntk
rd}nX|r$|j|y2tj|d\}}|r|j|nWq$tk
r q$Xnytj|d\}}Wntk
rYd}nX|rp|j|ndS(s%Extract DNS info from a registry key.t
NameServertDomaintDhcpNameServert
DhcpDomaint
SearchListN(t_winregtQueryValueExtWindowsErrorRRRR(R$RLtserverstrtypetdomRk((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_fromkeyPs<









cCsStjdtj}t}z&ytj|d}t}Wn#tk
r_tj|d}nXz|j|Wd|j	X|r@tj|d}zd}xtr-yltj
||}|d7}tj||}|j|||swnz|j|Wd|j	XWqtk
r)PqXqWWd|j	XnWd|j	XdS(s9Extract resolver configuration from the Windows registry.s2SYSTEM\CurrentControlSet\Services\Tcpip\Parameterss+SYSTEM\CurrentControlSet\Services\VxD\MSTCPNs=SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfacesii(RtConnectRegistryRtHKEY_LOCAL_MACHINERytOpenKeyR:tEnvironmentErrorRtClosetEnumKeyt_win32_is_nic_enabled(R$tlmt	want_scant
tcp_paramst
interfacesR4tguidRL((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR`rs@		

	
			


c
Csytj|d|}ztj|d\}}|tjkrLtntj|d|}z=tj|d\}}|tjkrtn|d@SWd|jXWd|jXWnRttfk
ry&tj|d\}	}|	dk	SWqt	k
r
t
SXnXdS(Ns]SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\%s\Connectiont
PnpInstanceIDs SYSTEM\CurrentControlSet\Enum\%stConfigFlagsitNTEContextList(RRRtREG_SZt
ValueErrort	REG_DWORDRRRRRy(
R$RRt
interface_keytconnection_keytpnp_idtttypet
device_keyRxtnte((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRs6
		
	
cCsstj}||kr:||dkr1tq:|}n||}||jkr\tnt|j||jS(Ni(R"tTimeoutRntminRm(R$tstartRDtduration((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_compute_timeouts		
	icCsut|ttfr-tjj|d}nt|ttfrWtjj|}ntjj|rrt	nt|ttfrtj
j|}ntj
j|rt	ng}|jr|j
|nt|dkr
|j
|jtjjn|jr@xC|jD]}	|j
|j|	qWn|j
|j|jt}
tj}x|D]}|jr|jj|||f}|dk	r|jdkr|rtq|Sqntjj|||}
|jdk	r|
j|j|jd|jn|
j|j |j!|j"|j#dk	rS|j#|
_#nd}|j$}|j%r|t&j'|nd}xt|dkrt|dkrt(nx|D]}|j)|}y|rtj*j+|
|||j,d|d|}nytj*j-|
|||j,d|d|}|j#tj#j.@rx|j)|}tj*j+|
|||j,d|d|}nWnt/j0tj1j2fk
rd}qnrtj*j3k
rd}qnStj1j4k
r|j5|d}qn't6k
r|j5|d}qnX|j7}|tj7j8kr=t8n|tj7j9ksa|tj7j:krePn|tj7j;ks|j<r|j5|nd}qW|dk	rPnt|dkr|j)|}t=||}|d9}tj>|qqW|j7tj7j:krqrnt?}
PqrW|
r1t:nt@|||||}|jrq|jjA|||f|n|S(	sQuery nameservers to find the answer to the question.

        The I{qname}, I{rdtype}, and I{rdclass} parameters may be objects
        of the appropriate type, or strings that can be converted into objects
        of the appropriate type.  E.g. For I{rdtype} the integer 2 and the
        the string 'NS' both mean to query for records with DNS rdata type NS.

        @param qname: the query name
        @type qname: dns.name.Name object or string
        @param rdtype: the query type
        @type rdtype: int or string
        @param rdclass: the query class
        @type rdclass: int or string
        @param tcp: use TCP to make the query (default is False).
        @type tcp: bool
        @param source: bind to this IP address (defaults to machine default IP).
        @type source: IP address in dotted quad notation
        @param raise_on_no_answer: raise NoAnswer if there's no answer
        (defaults is True).
        @type raise_on_no_answer: bool
        @param source_port: The port from which to send the message.
        The default is 0.
        @type source_port: int
        @rtype: dns.resolver.Answer instance
        @raises Timeout: no answers could be found in the specified lifetime
        @raises NXDOMAIN: the query name does not exist
        @raises YXDOMAIN: the query name is too long after DNAME substitution
        @raises NoAnswer: the response did not contain an answer and
        raise_on_no_answer is True.
        @raises NoNameservers: no non-broken nameservers are available to
        answer the question.it	algorithmg?itsourcetsource_portiN(BRRRRR ReRRtis_metatypeR
t
rdataclasstis_metaclasstis_absoluteRCR0tconcatenateRiRkRhR:R"RwRJRRtmessaget
make_queryRptuse_tsigRoRstuse_ednsRtRuRvRxRjR{trandomtshuffleRRtqueryttcpRltudptTCRfterrort	exceptionRtUnexpectedSourcet	FormErrortremovetEOFErrortrcodeRtNOERRORRtSERVFAILRzRtsleepRyRRN(R$RR
RRRR%Rt
qnames_to_tryRtall_nxdomainRRtrequestRRjtbackoffRRmRt
sleep_time((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRs"			
		


			


	

			cCsD||_|dkr.|jjd|_n	||_||_dS(sAdd a TSIG signature to the query.

        @param keyring: The TSIG keyring to use; defaults to None.
        @type keyring: dict
        @param keyname: The name of the TSIG key to use; defaults to None.
        The key must be defined in the keyring.  If a keyring is specified
        but a keyname is not, then the key used will be the first key in the
        keyring.  Note that the order of keys in a dictionary is not defined,
        so applications should supply a keyname when a keyring is used, unless
        they know the keyring contains only one key.
        @param algorithm: The TSIG key algorithm to use.  The default
        is dns.tsig.default_algorithm.
        @type algorithm: stringiN(RoRtkeysRpRs(R$RoRpR((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRs
		cCs4|dkrd}n||_||_||_dS(sConfigure Edns.

        @param edns: The EDNS level to use.  The default is -1, no Edns.
        @type edns: int
        @param ednsflags: The EDNS flags
        @type ednsflags: int
        @param payload: The EDNS payload size.  The default is 0.
        @type payload: intiN(RRtRuRv(R$RtRuRv((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRs

			cCs
||_dS(sOverrides the default flags with your own

        @param flags: The flags to overwrite the default with
        @type flags: intN(Rx(R$Rx((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt	set_flagssN(RRRR:R+R]RaRRRRRR`RRRRtARtINRyRRRqRrRRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR\s$)		&		
		
	"	-	7		cCstdkrtantS(s7Get the default resolver, initializing it if necessary.N(tdefault_resolverRR\(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytget_default_resolversicCs"tj|||||||S(sQuery nameservers to find the answer to the question.

    This is a convenience function that uses the default resolver
    object to make the query.
    @see: L{dns.resolver.Resolver.query} for more information on the
    parameters.(RR(RR
RRRR%R((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRs	cCst|ttfr3tjj|tjj}n|dkrKt}n|j	sft
|nxy8|j|tjj
||}|jj|kr|SWn#tjjtjjfk
rnXy|j}Wqitjjk
rtqiXqidS(sFind the name of the zone which contains the specified name.

    @param name: the query name
    @type name: absolute dns.name.Name object or string
    @param rdclass: The query class
    @type rdclass: int
    @param tcp: use TCP to make the query (default is False).
    @type tcp: bool
    @param resolver: the resolver to use
    @type resolver: dns.resolver.Resolver object or None
    @rtype: dns.name.NameN(RRRRR ReRiRRRRRRRRtresolverRRRR!R	(R RRRR((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt
zone_for_names"
cCs|tjtjB@dkr#tn|dkrP|dkrPtjtjng}g}d}y|dkrd}|tj@dkr|jd|jdq|jd|jdnY|j	d}	t
|	dkr|	d}
n|}
tjj
|
}|j||}Wny)tjj
|}|j||}Wq|tj@dkry*d}|tjks|tjkrtj|tjjd	t}
|
j}|
jjt}|
jdk	rx$|
jD]}|j|jqWqn|tjks|tjkrtj|tjjd	t}|j}|jjt}|jdk	rx$|jD]}|j|jqoWqnWqtjj k
rtjtjqtjtj!qXqqXnXd}y%|dkrd}nt"|}Wn:|tj#@dkrGytj$|}WqCqCXqGnX|dkrhtjtjng}|dkrtj%tj&g}n	|g}|tj'@dkr|}nd
}|tjks|tjkr=xb|D]W}xN|D]F}x=t(|D]1}|jtj|||||ddffqWqWqWn|tjks[|tjkrx\|D]Q}xH|D]@}x7t(|D]+}|jtj|||||ffqWqoWqbWnt
|dkrtjtjn|S(Nit	localhosts::s0.0.0.0s::1s	127.0.0.1t%iR%t()Rft
AI_ADDRCONFIGtAI_V4MAPPEDtNotImplementedErrorRtgaierrort
EAI_NONAMEt
AI_PASSIVERCRR0Rtipv6t	inet_atontipv4tAI_NUMERICHOSTtAF_INET6t	AF_UNSPECt	_resolverRRtAAAARyRRtto_textR:RtaddresstAF_INETRRRt
EAI_SYSTEMtinttAI_NUMERICSERVt
getservbynamet
SOCK_DGRAMtSOCK_STREAMtAI_CANONNAMEt_protocols_for_socktype(thosttservicetfamilytsocktypetprotoRxtv6addrstv4addrsRtpartstahosttaddrRtv6trdatatv4Rlttuplest	socktypestcname((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getaddrinfo	s	






				!			

(

"c
Cs|d}|d}t|dkr<|d}tj}nd}tj}t|||tjtjd}t|dkrtjdn|ddd}|tj	@rd}nd}t
jj|}	|tj
@dkry/tj|	d}
|
jdjjt}Wqt
jjt
jjfk
r|tj@rVtjtjn|}|dk	r|d	t|7}qqXn)|}|dk	r|d	t|7}n|tj@rt|}ntj||}||fS(
Niiiis'sockaddr resolved to multiple addressesRRtPTRR(R0RfRRRRRtSOL_TCPRtNI_DGRAMRtreversenametfrom_addresstNI_NUMERICHOSTRRRRRR:RRRtNI_NAMEREQDRRRtNI_NUMERICSERVt
getservbyport(
tsockaddrRxRRltscopeR
RRtpnameRRthostnameR	((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getnameinfomsB


	
	

cCs:|dkrtj}ntt|ddddS(NiPii(RRfRgR&R(R ((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getfqdnscCst|ddS(Nii(t_gethostbyname_ex(R ((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_gethostbynamescCstg}g}t|dtjtjtjtj}|dd}x#|D]}|j|ddqHW|||fS(Niii(RRfRRRRRC(R taliasest	addressesRt	canonicaltitem((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR(s
cCsy1tjj|}|dddf}tj}Wn|df}tj}nXt|tj\}}g}g}t|d|tj	tj
tj}|dd}	x#|D]}
|j|
ddqW|	||fS(NiPiii(
RRRRfRRR&RRRRRRC(tipRR"R
R RlR*R+RR,R-((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_gethostbyaddrs 


cCsX|dkrt}n|att_tt_tt_	t
t_tt_
tt_dS(sOverride the system resolver routines in the socket module with
    versions which use dnspython's resolver.

    This can be useful in testing situations where you want to control
    the resolution behavior of python code without having to change
    the system's resolver settings (e.g. /etc/resolv.conf).

    The resolver to use may be specified; if it's not, the default
    resolver will be used.

    @param resolver: the resolver to use
    @type resolver: dns.resolver.Resolver object or None
    N(RRRRRftgetaddrinfoR&tgetnameinfoR'tgetfqdnR)t
gethostbynameR(tgethostbyname_exR/t
gethostbyaddr(R((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytoverride_system_resolvers					cCs@datt_tt_tt_t	t_
tt_t
t_dS(s4Undo the effects of override_system_resolver().
    N(RRt_original_getaddrinfoRfR0t_original_getnameinfoR1t_original_getfqdnR2t_original_gethostbynameR3t_original_gethostbyname_exR4t_original_gethostbyaddrR5(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytrestore_system_resolvers					(MRRfR^R"Rt	threadingR?tImportErrortdummy_threadingt
dns.exceptionRt	dns.flagstdns.ipv4tdns.ipv6tdns.messagetdns.namet	dns.queryt	dns.rcodetdns.rdataclasst
dns.rdatatypetdns.reversenameR_RRtDNSExceptionRRRRRRR	R
tobjectRR;RQRXR\RRRRRRRRyR:RRtSOL_UDPRRRRRR0R7R1R8R2R9R3R:R4R;R5R<RRR&R'R)R(R/R6R=(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt<module>sz
v`l		
%						c'			
Back to Directory File Manager