%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/dig.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlm	Z	ddl
Z
ddlZe
je
�ZdZd�Zd�Zdd�Zdd	�Zedd
�Zddd�Zedd
�Zdd�ZeZeZeZeZeZdS(uq
Compendium of generic DNS utilities.
The 'dig' command line tool must be installed in order to use this module.
i(tabsolute_importtprint_functiontunicode_literalsN(tsixudigcC@s#tjjjd�rtStdfS(u3
    Only load module if dig binary is present
    udiguMThe dig execution module cannot be loaded: the dig binary is not in the path.(tsalttutilstpathtwhicht__virtualname__tFalse(((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pyt__virtual__scC@sy|jdd�}Wntk
r*tSXtjjj|d�r�y.dt|d�kohdknrqtSWq�t	k
r�tSt
k
r�tSXntjjj|d�ry.dt|d�ko�dknr�tSWqt	k
r�tSt
k
rtSXntS(u�
    Check if address is a valid IP. returns True if valid, otherwise False.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.check_ip 127.0.0.1
        salt ns1 dig.check_ip 1111:2222:3333:4444:5555:6666:7777:8888
    u/iii ii�(trsplittAttributeErrorR	RRtnetworktis_ipv4tinttTruet
ValueErrort
IndexErrortis_ipv6(taddr((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytcheck_ip s*
&

&

cC@s�ddtj|�dg}|dk	r@|jdj|��ntd|dt�}|ddkr�tjd	j|d��gSg|d
j	d�D]}t
|�r�|^q�S(
u�
    Return the A record for ``host``.

    Always returns a list.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.A www.google.com
    udigu+shortuAu@{0}ucmd.run_alltpython_shelluretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutu
N(Rt	text_typetNonetappendtformatt__salt__R	tlogtwarningtsplitR(thostt
nameservertdigtcmdtx((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytAKscC@s�ddtj|�dg}|dk	r@|jdj|��ntd|dt�}|ddkr�tjd	j|d��gSg|d
j	d�D]}t
|�r�|^q�S(
u�
    Return the AAAA record for ``host``.

    Always returns a list.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.AAAA www.google.com
    udigu+shortuAAAAu@{0}ucmd.run_allRuretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutu
N(RRRRRRR	RRRR(RR R!R"R#((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytAAAAkscC@s�ddtj|�dg}|dk	r@|jdj|��ntd|dt�}|ddkr�tjd	j|d��gS|r�g}xB|d
j	d�D]-}x$t
||�D]}|j|�q�Wq�W|S|d
j	d�S(
u�
    Return a list of IPs of the nameservers for ``domain``

    If ``resolve`` is False, don't resolve names.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.NS google.com
    udigu+shortuNSu@{0}ucmd.run_allRuretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutu
N(RRRRRRR	RRRR$(tdomaintresolveR R!R"trettns_hosttip_addr((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytNS�s uSPFcC@s�tjd�}ddtj|�|g}|dk	rO|jdj|��ntd|dt�}|ddkr�t	j
d	j|d��gS|d
dkr�|dkr�t|d
|�Stjdd|d
�j
�}t|�dks|ddkrgS|djd�r/t|ddd|�Sg}x�|dD]�}y|j|�j�\}	}
Wntk
r{q@nX|	dkr�|jt|
d|��q@|	dkr@t|
�r@|j|
�q@q@W|S(uZ
    Return the allowed IPv4 ranges in the SPF record for ``domain``.

    If record is ``SPF`` and the SPF record is empty, the TXT record will be
    searched automatically. If you know the domain uses TXT and not SPF,
    specifying that will save a lookup.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.SPF google.com
    u(?:\+|~)?(ip[46]|include):(.+)udigu+shortu@{0}ucmd.run_allRuretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutuuSPFuTXTu"uv=spf1iu	redirect=i	uincludeuip4uip6N(uip4uip6(tretcompileRRRRRRR	RRtSPFtsubRtlent
startswithtmatchtgroupsRtextendR(R&trecordR tspf_reR"tresulttsectionsR(tsectiont	mechanismtaddress((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pyR.�s8"
c@s�ddtj|�dg}�d
k	r@|jdj���ntd|dt�}|ddkr�tjd	j|d��gSg|d
j	d�D]}|j	�^q�}|r�g|D]}�fd�|�^q�S|S(u

    Return a list of lists for the MX of ``domain``.

    If the ``resolve`` argument is True, resolve IPs for the servers.

    It's limited to one IP, because although in practice it's very rarely a
    round robin, it is an acceptable configuration and pulling just one IP lets
    the data be similar to the non-resolved version. If you think an MX has
    multiple IPs, don't use the resolver here, resolve them in a separate step.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.MX google.com
    udigu+shortuMXu@{0}ucmd.run_allRuretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutu
c@s|dt|d��dgS(Nii(R$(R#(R (s4/usr/lib/python2.7/site-packages/salt/modules/dig.pyt<lambda>
sN(
RRRRRRR	RRR(R&R'R R!R"R#tstdout((R s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytMX�s,&cC@s�ddtj|�dg}|dk	r@|jdj|��ntd|dt�}|ddkr�tjd	j|d��gSg|d
j	d�D]}|^q�S(
u�
    Return the TXT record for ``host``.

    Always returns a list.

    CLI Example:

    .. code-block:: bash

        salt ns1 dig.TXT google.com
    udigu+shortuTXTu@{0}ucmd.run_allRuretcodeiu?dig returned exit code '{0}'. Returning empty list as fallback.ustdoutu
N(
RRRRRRR	RRR(RR R!R"ti((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pytTXTs( t__doc__t
__future__RRRtsalt.utils.networkRtsalt.utils.pathtsalt.extRtloggingR,t	getLoggert__name__RRR
RRR$R%RR+R.R	R>R@tataaaatnstspftmx(((s4/usr/lib/python2.7/site-packages/salt/modules/dig.pyt<module>s*	
	+  &7+ 

Zerion Mini Shell 1.0