Hacked By AnonymousFox
�
#�Sc @ s� d Z d d l Z d d l Z d d l Z e j d � Z d � Z e j d � Z e j d � Z e j d � Z
d � Z d Z d � Z
d S( s IPv6 helper functions.i����Ns
0+([0-9a-f]+)c C s/ t | � d k r! t d � � n | j d � } g } d } t | � } xe | | k r� | | | d !} t j | � } | d k r� | j d � } n | j | � | d 7} qK Wd } d } d } t }
xv t d � D]h } | | d k r(|
r=| } | | } | | k r| } | } n t }
q=q� |
s� | } t
}
q� q� W|
rud } | | } | | k ru| } | } qun | d k r| d k r�| d
k s�| d k r�| d d k r�| d
k r�d
}
n d }
|
t j j
| d � } q+d j | | � d
d j | | | � } n d j | � } | S( s� Convert a network format IPv6 address into text.
@param address: the binary address
@type address: string
@rtype: string
@raises ValueError: the address isn't 16 bytes long
i s IPv6 addresses are 16 bytes longt hex_codeci i i i����i t 0i i t ffffs ::s ::ffff:i t :N( t lent
ValueErrort encodet
_leading_zerot matcht Nonet groupt appendt Falset xranget Truet dnst ipv4t inet_ntoat join( t addresst hext chunkst it lt chunkt mt
best_startt best_lent startt
last_was_zerot endt current_lent prefix( ( s. /usr/lib64/python2.7/site-packages/dns/ipv6.pyR s^
s (.*):(\d+\.\d+\.\d+\.\d+)$s ::.*s .*::$c
C sO | d k r d } n t j | � } | d k r� t j j | j d � � } d | j d � t | d � t | d � t | d � t | d � f } n t j | � } | d k r� | d } n( t j | � } | d k r� | d } n | j
d � } t | � } | d
k rt j j
� n t } g } x� | D]� } | d k r�| rXt j j
� n t } x� t d d
| d � D] } | j d � qvWq1t | � } | d
k r�t j j
� n | d
k r�d d
| | } n | j | � q1W| d
k r| rt j j
� n d j | � } y | j d � SWn t k
rJt j j
� n Xd S( s� Convert a text format IPv6 address into network format.
@param text: the textual address
@type text: string
@rtype: string
@raises dns.exception.SyntaxError: the text was not properly formatted
s ::s 0::i s %s:%02x%02x:%02x%02xi i i i����R i t t 0000i R R N( t
_v4_endingR R R R t inet_atonR
t ordt _colon_colon_startt _colon_colon_endt splitR t exceptiont SyntaxErrorR R R
R R t decodet TypeError(
t textR t bR R t
seen_emptyt canonicalt cR t lc( ( s. /usr/lib64/python2.7/site-packages/dns/ipv6.pyR$ ` sN
)$
s i
s ��c C s
| j t � S( N( t
startswitht _mapped_prefix( R ( ( s. /usr/lib64/python2.7/site-packages/dns/ipv6.pyt is_mapped� s s
s ��( t __doc__t ret
dns.exceptionR t dns.ipv4t compileR R R# R&