uawdijnntqw1x1x1
IP : 3.137.162.120
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
..
/
lib
/
python2.7
/
site-packages
/
rhn
/
..
/
kitchen
/
..
/
ipaddr.pyo
/
/
� ��I]c@s�dZdZddlZdZdZdefd��YZdefd ��YZed �Z ee d�Zd�Zd �Z d�Zd�Zd�Zd�Zd�Zd�ZeZy%eekr�ed��neZWn-eefk r defd��YZnXd�Zdefd��YZdefd��YZdefd��YZdefd��YZd eefd!��YZ d"eefd#��YZ!d$efd%��YZ"d&e"efd'��YZ#d(e"efd)��YZ$dS(*s�A fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. s2.1.11i����Ni i�tAddressValueErrorcBseZdZRS(s%A Value Error related to the address.(t__name__t __module__t__doc__(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR stNetmaskValueErrorcBseZdZRS(s%A Value Error related to the netmask.(RRR(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR$scCs�|r5|dkrt|�S|dkr5t|�Snyt|�SWnttfk r\nXyt|�SWnttfk r�nXtd|��dS(s�Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. version: An Integer, 4 or 6. If set, don't try to automatically determine what the IP address type is. important for things like IPAddress(1), which could be IPv4, '0.0.0.1', or IPv6, '::1'. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. iis0%r does not appear to be an IPv4 or IPv6 addressN(tIPv4AddresstIPv6AddressRRt ValueError(taddresstversion((s*/usr/lib/python2.7/site-packages/ipaddr.pyt IPAddress(s cCs�|r;|dkrt||�S|dkr;t||�Snyt||�SWnttfk renXyt||�SWnttfk r�nXtd|��dS(s�Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. version: An Integer, if set, don't try to automatically determine what the IP address type is. important for things like IPNetwork(1), which could be IPv4, '0.0.0.1/32', or IPv6, '::1/128'. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if a strict network was requested and a strict network wasn't given. iis0%r does not appear to be an IPv4 or IPv6 networkN(tIPv4NetworktIPv6NetworkRRR(RR tstrict((s*/usr/lib/python2.7/site-packages/ipaddr.pyt IPNetworkPs cCs4|tjkrtd��nttjd|��S(sThe binary representation of this address. Args: address: An integer representation of an IPv4 IP address. Returns: The binary representation of this address. Raises: ValueError: If the integer is too large to be an IPv4 IP address. sAddress too large for IPv4s!I(t_BaseV4t _ALL_ONESRtByteststructtpack(R((s*/usr/lib/python2.7/site-packages/ipaddr.pytv4_int_to_packedys cCs!ttjd|d?|d@��S(s�The binary representation of this address. Args: address: An integer representation of an IPv6 IP address. Returns: The binary representation of this address. s!QQi@iill����(RRR(R((s*/usr/lib/python2.7/site-packages/ipaddr.pytv6_int_to_packed�s cCsM|d}}x2|dD]&}|j|jdkr>|}qPqW||fS(s�Find a sequence of addresses. Args: addresses: a list of IPv4 or IPv6 addresses. Returns: A tuple containing the first and last IP addresses in the sequence. ii(t_ip(t addressestfirsttlasttip((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_find_address_range�s cCs7x0t|�D]"}||?||?kr ||Sq WdS(sGet the number of leading bits that are same for two numbers. Args: number1: an integer. number2: another integer. bits: the maximum number of bits to compare. Returns: The number of leading bits that are the same for two numbers. i(trange(tnumber1tnumber2tbitsti((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_get_prefix_length�scCs=|dkr|Sx&t|�D]}||?dr|SqWdS(s�Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. iiN(R(tnumberRR ((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_count_righthand_zero_bits�s cCs�t|t�ot|t�s-td��n|j|jkrdtdt|�t|�f��n||krtd��ng}|jdkr�t}n$|jdkr�t}ntd��|j}|j }|j }x�||kr�t ||�}d}xB|dkrDd|d } || }|d 8}||krPqqWt|||�} |d t|�| f�}|j |�||jkr�Pn|d }t|d|j�}q�W|S( s/Summarize a network range given the first and last IP addresses. Example: >>> summarize_address_range(IPv4Address('1.1.1.0'), IPv4Address('1.1.1.130')) [IPv4Network('1.1.1.0/25'), IPv4Network('1.1.1.128/31'), IPv4Network('1.1.1.130/32')] Args: first: the first IPv4Address or IPv6Address in the range. last: the last IPv4Address or IPv6Address in the range. Returns: The address range collapsed to a list of IPv4Network's or IPv6Network's. Raise: TypeError: If the first and last objects are not IP addresses. If the first and last objects are not the same version. ValueError: If the last object is not greater than the first. If the version is not 4 or 6. s1first and last must be IP addresses, not networkss%%s and %s are not of the same versions*last IP address must be greater than firstiisunknown IP versioniiis%s/%dR N(t isinstancet_BaseIPt TypeErrorR tstrRRRt_max_prefixlenRR#tNoneR!tappendRR t_version(RRtnetworksRtip_bitst first_inttlast_inttnbitstcurrenttaddendtprefixtnet((s*/usr/lib/python2.7/site-packages/ipaddr.pytsummarize_address_range�sB cCs�g}t}x�|D]�}|s2|j|�qn||dkrKt}q||dj�j�dkr�|j|j�j��t}q|j|�qW|r�t|�S|S(s�Loops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4Network('1.1.0.0/24') ip2 = IPv4Network('1.1.1.0/24') ip3 = IPv4Network('1.1.2.0/24') ip4 = IPv4Network('1.1.3.0/24') ip5 = IPv4Network('1.1.4.0/24') ip6 = IPv4Network('1.1.0.1/22') _collapse_address_list_recursive([ip1, ip2, ip3, ip4, ip5, ip6]) -> [IPv4Network('1.1.0.0/22'), IPv4Network('1.1.4.0/24')] This shouldn't be called directly; it is called via collapse_address_list([]). Args: addresses: A list of IPv4Network's or IPv6Network's Returns: A list of IPv4Network's or IPv6Network's depending on what we were passed. i����i(tFalseR*tTruetsupernettsubnettpopt _collapse_address_list_recursive(Rt ret_arrayt optimizedtcur_addr((s*/usr/lib/python2.7/site-packages/ipaddr.pyR;s cCs�d}g}g}g}x.|D]&}t|t�r�|ry|dj|jkrytdt|�t|d�f��n|j|�q|j|jkr�|r�|dj|jkr�tdt|�t|d�f��n|j|j�q|r8|dj|jkr8tdt|�t|d�f��n|j|�qWt t |��}t t |��}xU|t|�kr�t||�\}}|j |�d}|jt||��qpWtt ||dtj��S(s�Collapse a list of IP objects. Example: collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) -> [IPv4('1.1.0.0/23')] Args: addresses: A list of IPv4Network or IPv6Network objects. Returns: A list of IPv4Network or IPv6Network objects depending on what we were passed. Raises: TypeError: If passed a list of mixed version objects. ii����s%%s and %s are not of the same versionitkey(R$R%R+R&R'R*t _prefixlenR(RtsortedtsettlenRtindextextendR5R;t_BaseNett_get_networks_key(RR taddrstipstnetsRRR((s*/usr/lib/python2.7/site-packages/ipaddr.pytcollapse_address_list:s6 ###sbytes is not a distinct typeRcBseZd�ZRS(cCsdtj|�S(Ns Bytes(%s)(R't__repr__(tself((s*/usr/lib/python2.7/site-packages/ipaddr.pyRL�s(RRRL(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�scCs6t|t�r|j�St|t�r2|j�StS(s+Return a key suitable for sorting between networks and addresses. Address and Network objects are not sortable by default; they're fundamentally different so the expression IPv4Address('1.1.1.1') <= IPv4Network('1.1.1.1/24') doesn't make any sense. There are some times however, where you may wish to have ipaddr sort these for you anyway. If you need to do this, you can use this function as the key= argument to sorted(). Args: obj: either a Network or Address object. Returns: appropriate key. (R$RFRGR%t_get_address_keytNotImplemented(tobj((s*/usr/lib/python2.7/site-packages/ipaddr.pytget_mixed_type_key�s t_IPAddrBasecBsGeZdZd�Zd�Zd�Zed��Zed��ZRS(sThe mother class.cCs|jS(N(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt __index__�scCs|jS(N(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__int__�scCs t|j�S(N(thexR(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__hex__�scCs |j�S(s:Return the longhand version of the IP address as a string.(t_explode_shorthand_ip_string(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytexploded�scCs t|�S(s;Return the shorthand version of the IP address as a string.(R'(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt compressed�s( RRRRSRTRVtpropertyRXRY(((s*/usr/lib/python2.7/site-packages/ipaddr.pyRR�s R%cBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Zd �Zd�Z d�Zed ��ZRS(s�A generic IP object. This IP class contains the version independent methods which are used by single IP addresses. cCs?y&|j|jko$|j|jkSWntk r:tSXdS(N(RR+tAttributeErrorRO(RMtother((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__eq__�s cCs$|j|�}|tkrtS|S(N(R]RO(RMR\teq((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__ne__�scCs$|j|�}|tkrtS|S(N(t__gt__RO(RMR\tgt((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__le__�scCs$|j|�}|tkrtS|S(N(t__lt__RO(RMR\tlt((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__ge__�scCs�|j|jkr7tdt|�t|�f��nt|t�sktdt|�t|�f��n|j|jkr�|j|jkStS(Ns%%s and %s are not of the same versions"%s and %s are not of the same type(R+R&R'R$R%RR6(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyRc�scCs�|j|jkr7tdt|�t|�f��nt|t�sktdt|�t|�f��n|j|jkr�|j|jkStS(Ns%%s and %s are not of the same versions"%s and %s are not of the same type(R+R&R'R$R%RR6(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyR`�scCs0t|t�stStt|�|d|j�S(NR (R$tintROR R+(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__add__�scCs0t|t�stStt|�|d|j�S(NR (R$RfROR R+(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__sub__�scCsd|jjt|�fS(Ns%s(%r)(t __class__RR'(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRL�scCsd|j|j�S(Ns%s(t_string_from_ip_intR(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__str__�scCsttt|j���S(N(thashRUtlongR(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__hash__scCs |j|fS(N(R+(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRNscCstd��dS(NsBaseIP has no version(tNotImplementedError(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR s(RRRR]R_RbReRcR`RgRhRLRkRnRNRZR (((s*/usr/lib/python2.7/site-packages/ipaddr.pyR%�s RFcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Zd �Zd�Z d�Zd �Zd�Zd�Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d d%d!�Z$d"�Z%d d%d#�Z&d d%d$�Z'e&Z(e'Z)eZ*eZ+eZ,RS(&svA generic IP object. This IP class contains the version independent methods which are used by networks. cCs i|_dS(N(t_cache(RMR((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__init__scCsd|jjt|�fS(Ns%s(%r)(RiRR'(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRLsccs_t|j�d}t|j�d}x2||krZ|d7}t|dd|j�Vq)WdS(s�Generate Iterator over usable hosts in a network. This is like __iter__ except it doesn't return the network or broadcast addresses. iR N(Rftnetworkt broadcastR R+(RMtcurtbcast((s*/usr/lib/python2.7/site-packages/ipaddr.pyt iterhostss ccsWt|j�}t|j�}x2||krR|d7}t|dd|j�Vq!WdS(NiR (RfRrRsR R+(RMRtRu((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__iter__)s cCs�t|j�}t|j�}|dkrZ|||krCt�nt||d|j�S|d7}|||kr}t�nt||d|j�SdS(NiR i(RfRrRst IndexErrorR R+(RMtnRrRs((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__getitem__0s cCs�|j|jkr7tdt|�t|�f��nt|t�sktdt|�t|�f��n|j|jkr�|j|jkS|j|jkr�|j|jkStS(Ns%%s and %s are not of the same versions"%s and %s are not of the same type(R+R&R'R$RFRrtnetmaskR6(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyRc=scCs�|j|jkr7tdt|�t|�f��nt|t�sktdt|�t|�f��n|j|jkr�|j|jkS|j|jkr�|j|jkStS(Ns%%s and %s are not of the same versions"%s and %s are not of the same type(R+R&R'R$RFRrR{R6(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyR`JscCs$|j|�}|tkrtS|S(N(R`RO(RMR\Ra((s*/usr/lib/python2.7/site-packages/ipaddr.pyRbWscCs$|j|�}|tkrtS|S(N(RcRO(RMR\Rd((s*/usr/lib/python2.7/site-packages/ipaddr.pyRe]scCs�yD|j|jkoB|j|jkoBt|j�t|j�kSWnBtk r�t|t�r�|j|jko�|j|jkSnXdS(N(R+RrRfR{R[R$R%R(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyR]cs cCs$|j|�}|tkrtS|S(N(R]RO(RMR\R^((s*/usr/lib/python2.7/site-packages/ipaddr.pyR_mscCs dt|j�t|j�fS(Ns%s/%s(R'RR@(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRksscCs tt|j�t|j�A�S(N(RlRfRrR{(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRnwscCs~|j|jkrtSt|t�rG|j|jkoF|j|jkSt|j�t|j�kowt|j�kSSdS(N(R+R6R$RFRrRsRfR(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pyt__contains__zs cCs:|j|kp9|j|kp9|j|kp9|j|kS(s*Tell if self is partly contained in other.(RrRs(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pytoverlaps�scCsW|jjd�}|dkrSt|jt|j�@d|j�}||jd<n|S(NRrR (RptgetR)R RRfR{R+(RMtx((s*/usr/lib/python2.7/site-packages/ipaddr.pyRr�s %cCsW|jjd�}|dkrSt|jt|j�Bd|j�}||jd<n|S(NRsR (RpR~R)R RRfthostmaskR+(RMR((s*/usr/lib/python2.7/site-packages/ipaddr.pyRs�s %cCsW|jjd�}|dkrStt|j�|jAd|j�}||jd<n|S(NR�R (RpR~R)R RfR{RR+(RMR((s*/usr/lib/python2.7/site-packages/ipaddr.pyR��scCsdt|j�|jfS(Ns%s/%d(R'RR@(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytwith_prefixlen�scCs dt|j�t|j�fS(Ns%s/%s(R'RR{(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytwith_netmask�scCs dt|j�t|j�fS(Ns%s/%s(R'RR�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt with_hostmask�scCst|j�t|j�dS(s&Number of hosts in the current subnet.i(RfRsRr(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytnumhosts�scCstd��dS(NsBaseNet has no version(Ro(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR �scCs|jS(N(R@(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt prefixlen�scCs�|j|jks7tdt|�t|�f��nt|t�s_tdt|���n||kr�tdt|�t|�f��n||kr�gSg}tdt|j�t|j�fd|j�}|j �\}}xx||krc||krc||kr2|j |�|j �\}}q�||kr�|j |�|j �\}}q�q�W||kr�|j |�n||kr�|j |�nt|dtj�S(sRemove an address from a larger block. For example: addr1 = IPNetwork('10.1.1.0/24') addr2 = IPNetwork('10.1.1.0/26') addr1.address_exclude(addr2) = [IPNetwork('10.1.1.64/26'), IPNetwork('10.1.1.128/25')] or IPv6: addr1 = IPNetwork('::1/32') addr2 = IPNetwork('::1/128') addr1.address_exclude(addr2) = [IPNetwork('::0/128'), IPNetwork('::2/127'), IPNetwork('::4/126'), IPNetwork('::8/125'), ... IPNetwork('0:0:8000::/33')] Args: other: An IPvXNetwork object of the same type. Returns: A sorted list of IPvXNetwork objects addresses which is self minus other. Raises: TypeError: If self and other are of difffering address versions, or if other is not a network object. ValueError: If other is not completely contained by self. s%%s and %s are not of the same versions%s is not a network objects%s not contained in %ss%s/%sR R?( R+R&R'R$RFRRRrR�R9R*RARG(RMR\t ret_addrsts1ts2((s*/usr/lib/python2.7/site-packages/ipaddr.pytaddress_exclude�s6"% cCs�|j|jkrdS|j|jkr,dS|j|jkrBdS|j|jkrXdS|j|jkrndS|j|jkr�dSdS(s�Compare two IP objects. This is only concerned about the comparison of the integer representation of the network addresses. This means that the host bits aren't considered at all in this method. If you want to compare host bits, you can easily enough do a 'HostA._ip < HostB._ip' Args: other: An IP object. Returns: If the IP versions of self and other are the same, returns: -1 if self < other: eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24') IPv6('1080::200C:417A') < IPv6('1080::200B:417B') 0 if self == other eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24') IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96') 1 if self > other eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24') IPv6('1080::1:200C:417A/112') > IPv6('1080::0:200C:417A/112') If the IP versions of self and other are different, returns: -1 if self._version < other._version eg: IPv4('10.0.0.1/24') < IPv6('::1/128') 1 if self._version > other._version eg: IPv6('::1/128') > IPv4('255.255.255.0/24') i����ii(R+RrR{(RMR\((s*/usr/lib/python2.7/site-packages/ipaddr.pytcompare_networkss"cCs|j|j|jfS(s�Network-only key function. Returns an object that identifies this address' network and netmask. This function is a suitable "key" argument for sorted() and list.sort(). (R+RrR{(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRG?scCs|j|j|?AS(s�Turn the prefix length into a bitwise netmask. Args: prefixlen: An integer, the prefix length. Returns: An integer. (R(RMR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_ip_int_from_prefixIs cCs`|j}x,|r7|d@r Pn|dL}|d8}qW|d|>dkrP|Std��dS(sReturn prefix length from a bitwise netmask. Args: ip_int: An integer, the netmask in expanded bitwise format. Returns: An integer, the prefix length. Raises: NetmaskValueError: If the input is not a valid netmask. is!Bit pattern does not match /1*0*/N(R(R(RMtip_intR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_prefix_from_ip_intUs cCs{yStjj|�st�nt|�}d|koD|jknsRt�nWn!tk rvtd|��nX|S(s)Turn a prefix length string into an integer. Args: prefixlen_str: A decimal string containing the prefix length. Returns: The prefix length as an integer. Raises: NetmaskValueError: If the input is malformed or out of range. is%s is not a valid prefix length(Rt_DECIMAL_DIGITSt issupersetRRfR(R(RMt prefixlen_strR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_prefix_from_prefix_stringns cCs�y|j|�}Wn!tk r6td|��nXy|j|�SWntk r[nX||jN}y|j|�SWn!tk r�td|��nXdS(s.Turn a netmask/hostmask string into a prefix length. Args: ip_str: A netmask or hostmask, formatted as an IP address. Returns: The prefix length as an integer. Raises: NetmaskValueError: If the input is not a netmask or hostmask. s%s is not a valid netmaskN(t_ip_int_from_stringRRR�R(RMtip_strR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_prefix_from_ip_string�s iccs�|j|jkr|VdS|dk rp||jkrEtd��n|dkr`td��n||j}n|dkr�td��n|j|}||jkr�td|t|�f��ntdt|j�t|j|�fd |j�}|V|}xutr}|j }||j kr+dSt t|�dd |j�}tdt|�t|�fd |j�}|Vq WdS( s�The subnets which join to make the current subnet. In the case that self contains only one IP (self._prefixlen == 32 for IPv4 or self._prefixlen == 128 for IPv6), return a list with just ourself. Args: prefixlen_diff: An integer, the amount the prefix length should be increased by. This should not be set if new_prefix is also set. new_prefix: The desired new prefix length. This must be a larger number (smaller prefix) than the existing prefix. This should not be set if prefixlen_diff is also set. Returns: An iterator of IPv(4|6) objects. Raises: ValueError: The prefixlen_diff is too small or too large. OR prefixlen_diff and new_prefix are both set or new_prefix is a smaller number than the current prefix (smaller number means a larger network) Nsnew prefix must be longeris(cannot set prefixlen_diff and new_prefixisprefix length diff must be > 0s0prefix length diff %d is invalid for netblock %ss%s/%sR (R@R(R)RR'RRrR+R7RsR Rf(RMtprefixlen_difft new_prefixt new_prefixlenRR1Rstnew_addr((s*/usr/lib/python2.7/site-packages/ipaddr.pytiter_subnets�s: cCs#td|j|jfd|j�S(s8Return the network object with the host bits masked out.s%s/%dR (RRrR@R+(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytmasked�scCst|j||��S(s2Return a list of subnets, rather than an iterator.(tlistR�(RMR�R�((s*/usr/lib/python2.7/site-packages/ipaddr.pyR9�scCs�|jdkr|S|dk rh||jkr=td��n|dkrXtd��n|j|}n|j|dkr�td|j|f��ntdt|j�t|j|�fd|j�S( s�The supernet containing the current network. Args: prefixlen_diff: An integer, the amount the prefix length of the network should be decreased by. For example, given a /24 network and a prefixlen_diff of 3, a supernet with a /21 netmask is returned. Returns: An IPv4 network object. Raises: ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a negative prefix length. OR If prefixlen_diff and new_prefix are both set or new_prefix is a larger number than the current prefix (larger number means a smaller network) isnew prefix must be shorteris(cannot set prefixlen_diff and new_prefixs;current prefixlen is %d, cannot have a prefixlen_diff of %ds%s/%sR N(R@R)RR�RR'RrR+(RMR�R�((s*/usr/lib/python2.7/site-packages/ipaddr.pyR8�sN(-RRRRqRLRvRwRzRcR`RbReR]R_RkRnR|R}RZRrRsR�R�R�R�R�R R�R�R�RGR�R�R�R�R)R�R�R9R8tSubnettSupernettAddressExcludetCompareNetworkstContains(((s*/usr/lib/python2.7/site-packages/ipaddr.pyRF sR N 3 "> )RcBs�eZdZdedZed�Zd�Zd�Zd�Z d�Z d�Zed ��Z ed ��Zed��Zed��Zed ��Zed��Zed��Zed��Zed��ZRS(syBase IPv4 object. The following methods are used by IPv4 objects in both single IP addresses and networks. iit 0123456789cCsd|_t|_dS(Ni(R+t IPV4LENGTHR((RMR((s*/usr/lib/python2.7/site-packages/ipaddr.pyRq,s cCs t|�S(N(R'(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyRW0scCs�|jd�}t|�dkr0t|��nd}xI|D]A}y|d>|j|�B}Wq=tk r}t|��q=Xq=W|S(sTurn the given IP string into an integer for comparison. Args: ip_str: A string, the IP ip_str. Returns: The IP ip_str as an integer. Raises: AddressValueError: if ip_str isn't a valid IPv4 Address. t.iii(tsplitRCRt_parse_octetR(RMR�toctetst packed_iptoc((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�3s cCse|jj|�st�nt|d�}|dksX|ddkrat|�dkrat�n|S(sConvert a decimal octet into an integer. Args: octet_str: A string, the number to parse. Returns: The octet as an integer. Raises: ValueError: if the octet isn't strictly a decimal from [0..255]. i i�it0i(R�R�RRfRC(RMt octet_strt octet_int((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�Ls . cCsNg}x8td�D]*}|jdt|d@��|dL}qWdj|�S(s�Turns a 32-bit integer into dotted decimal notation. Args: ip_int: An integer, the IP address. Returns: The IP address as a string in dotted decimal notation. iii�iR�(txrangetinsertR'tjoin(RMR�R�t_((s*/usr/lib/python2.7/site-packages/ipaddr.pyRjcs cCs|jS(N(R((RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt max_prefixlensscCs t|j�S(s*The binary representation of this address.(RR(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytpackedwscCs|jS(N(R+(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR |scCs|td�kS(s�Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within the reserved IPv4 Network range. s240.0.0.0/4(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytis_reserved�s cCs4|td�kp3|td�kp3|td�kS(s�Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 1918. s 10.0.0.0/8s 172.16.0.0/12s192.168.0.0/16(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt is_private�scCs|td�kS(s�Test if the address is reserved for multicast use. Returns: A boolean, True if the address is multicast. See RFC 3171 for details. s224.0.0.0/4(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytis_multicast�s cCs|td�kS(s�Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 5735 3. s0.0.0.0(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytis_unspecified�s cCs|td�kS(s�Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback per RFC 3330. s127.0.0.0/8(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytis_loopback�scCs|td�kS(s�Test if the address is reserved for link-local. Returns: A boolean, True if the address is link-local per RFC 3927. s169.254.0.0/16(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt is_link_local�s(RRRR�Rt frozensetR�RqRWR�R�RjRZR�R�R R�R�R�R�R�R�(((s*/usr/lib/python2.7/site-packages/ipaddr.pyRs" RcBseZdZd�ZRS(s/Represent and manipulate single IPv4 Addresses.cCs�tj||�t|ttf�r\||_|dksI||jkrXt|��ndSt|t�r�yt j d|�\|_Wn t jk r�t|��nXdSt|�}|j |�|_dS(s� Args: address: A string or integer representing the IP '192.168.1.1' Additionally, an integer can be passed, so IPv4Address('192.168.1.1') == IPv4Address(3232235777). or, more generally IPv4Address(int(IPv4Address('192.168.1.1'))) == IPv4Address('192.168.1.1') Raises: AddressValueError: If ipaddr isn't a valid IPv4 address. iNs!I(RRqR$RfRmRRRRRtunpackterrorR'R�(RMRtaddr_str((s*/usr/lib/python2.7/site-packages/ipaddr.pyRq�s (RRRRq(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�sRcBs>eZdZed�Zd�Zd�Zd�Zd�ZRS(s~This class represents and manipulates 32-bit IPv4 networks. Attributes: [examples for IPv4Network('1.2.3.4/27')] ._ip: 16909060 .ip: IPv4Address('1.2.3.4') .network: IPv4Address('1.2.3.0') .hostmask: IPv4Address('0.0.0.31') .broadcast: IPv4Address('1.2.3.31') .netmask: IPv4Address('255.255.255.224') .prefixlen: 27 cCs�tj||�tj||�t|tttf�rxt|�|_|jj |_ |j |_t|j�|_ dSt|�jd�}t|�dkr�t|��n|j|d�|_ t|j �|_t|�dkr/y|j|d�|_Wq;tk r+|j|d�|_q;Xn|j |_t|j|j��|_ |r�|j|jkr�td|j��q�n|j|j dkr�|j|_ndS(s�Instantiate a new IPv4 network object. Args: address: A string or integer representing the IP [& network]. '192.168.1.1/24' '192.168.1.1/255.255.255.0' '192.168.1.1/0.0.0.255' are all functionally the same in IPv4. Similarly, '192.168.1.1' '192.168.1.1/255.255.255.255' '192.168.1.1/32' are also functionaly equivalent. That is to say, failing to provide a subnetmask will create an object with a mask of /32. If the mask (portion after the / in the argument) is given in dotted quad form, it is treated as a netmask if it starts with a non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it starts with a zero field (e.g. 0.255.255.255 == /8), with the single exception of an all-zero mask which is treated as a netmask == /0. If no mask is given, a default of /32 is used. Additionally, an integer can be passed, so IPv4Network('192.168.1.1') == IPv4Network(3232235777). or, more generally IPv4Network(int(IPv4Network('192.168.1.1'))) == IPv4Network('192.168.1.1') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 192.168.1.0/24 and not an IP address on a network, eg, 192.168.1.1/24. Raises: AddressValueError: If ipaddr isn't a valid IPv4 address. NetmaskValueError: If the netmask isn't valid for an IPv4 address. ValueError: If strict was True and a network address was not supplied. Nt/iiis%s has host bits set(RFRqRR$RfRmRRRRR(R@RR{R'R�RCRR�R�RR�R�RrRRwRv(RMRR taddr((s*/usr/lib/python2.7/site-packages/ipaddr.pyRq�s4( cCs|jS(N(R�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt<lambda>OscCs|jS(N(R�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�PscCs|jS(N(R�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�QscCs|jS(N(R�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�Rs( RRRR6Rqt IsRFC1918tIsMulticastt IsLoopbacktIsLinkLocal(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�s R t_BaseV6cBs*eZdZdedZdZed�Zd�Zd�Z d�Z d�Zdd �Z d �Zed��Zed��Zed ��Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zed��Zed��ZRS(syBase IPv6 object. The following methods are used by IPv6 objects in both single IP addresses and networks. iiit0123456789ABCDEFabcdefcCsd|_t|_dS(Ni(R+t IPV6LENGTHR((RMR((s*/usr/lib/python2.7/site-packages/ipaddr.pyRqbs c Cs�|jd�}t|�dkr0t|��nd|dkr�t|j��j}|jd|d?d@�|jd|d@�nt|�|jdkr�t|��nyFgtdt|�d�D]}||s�|^q�p�dg\}Wnt k rt|��nX|dk r�|}t|�|d}|d sf|d8}|rft|��qfn|ds�|d8}|r�t|��q�n|j||}|dkr�t|��q�n<t|�|jkr�t|��nt|�}d }d }y�d } x5t|�D]'}| dK} | |j||�O} qW| d|K} x9t|d �D]'}| dK} | |j||�O} q]W| SWnt k r�t|��nXdS(s�Turn an IPv6 ip_str into an integer. Args: ip_str: A string, the IPv6 ip_str. Returns: A long, the IPv6 ip_str. Raises: AddressValueError: if ip_str isn't a valid IPv6 Address. t:iR�i����s%xii��iilN(R�RCRRR:RR*t _HEXTET_COUNTR�R)Rt _parse_hextet( RMR�tpartstipv4_intR t skip_indextparts_hitparts_lot parts_skippedR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�fsZ 6 cCs^|jj|�st�nt|�dkr6t�nt|d�}|dkrZt�n|S(sConvert an IPv6 hextet string into an integer. Args: hextet_str: A string, the number to parse. Returns: The hextet as an integer. Raises: ValueError: if the input isn't strictly a hex number from [0..FFFF]. iii��(t_HEX_DIGITSR�RRCRf(RMt hextet_strt hextet_int((s*/usr/lib/python2.7/site-packages/ipaddr.pyR��s cCs�d}d}d}d}xstt|��D]_}||dkr~|d7}|dkr`|}n||kr�|}|}q�q+d}d}q+W|dkr�||}|t|�kr�|dg7}ndg|||+|dkr�dg|}q�n|S(s�Compresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. i����iR�it(RRC(RMthextetstbest_doublecolon_starttbest_doublecolon_lentdoublecolon_starttdoublecolon_lenRDtbest_doublecolon_end((s*/usr/lib/python2.7/site-packages/ipaddr.pyt_compress_hextets�s. c Cs�|r%|dkr%t|j�}n||jkrCtd��nd|}g}x?tddd�D]+}|jdt|||d!d��qfW|j|�}dj|�S( s,Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. isIPv6 address is too larges%032xi is%xiR�(RfRRRRR*R�R�(RMR�thex_strR�R((s*/usr/lib/python2.7/site-packages/ipaddr.pyRj�s )cCs�t|t�r!t|j�}nt|�}|j|�}g}x6t|j�D]%}|jd|d@�|dL}qRW|j�t|t�r�ddj |�|j fSdj |�S(s�Expand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. s%04xi��is%s/%dR�(R$RFR'RR�R�R�R*treverseR�R�(RMR�R�R�R ((s*/usr/lib/python2.7/site-packages/ipaddr.pyRWs cCs|jS(N(R((RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�/scCs t|j�S(s*The binary representation of this address.(RR(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�3scCs|jS(N(R+(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR 8scCs|td�kS(s�Test if the address is reserved for multicast use. Returns: A boolean, True if the address is a multicast address. See RFC 2373 2.7 for details. sff00::/8(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�<s cCs|td�kp|td�kp|td�kp|td�kp|td�kp|td�kp|td�kp|td�kp|td �kp|td �kp|td�kp|td�kp|td �kp|td�kp|td�kS(s�Test if the address is otherwise IETF reserved. Returns: A boolean, True if the address is within one of the reserved IPv6 Network ranges. s::/8s100::/8s200::/7s400::/6s800::/5s1000::/4s4000::/3s6000::/3s8000::/3sA000::/3sC000::/3sE000::/4sF000::/5sF800::/6sFE00::/9(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�Gs cCs%|jdko$t|dd�dkS(s�Test if the address is unspecified. Returns: A boolean, True if this is the unspecified address as defined in RFC 2373 2.5.2. iR@i�(Rtgetattr(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�`s cCs%|jdko$t|dd�dkS(s�Test if the address is a loopback address. Returns: A boolean, True if the address is a loopback address as defined in RFC 2373 2.5.3. iR@i�(RR�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�ks cCs|td�kS(s�Test if the address is reserved for link-local. Returns: A boolean, True if the address is reserved per RFC 4291. s fe80::/10(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�vscCs|td�kS(s`Test if the address is reserved for site-local. Note that the site-local address space has been deprecated by RFC 3879. Use is_private to test if this address is in the space of unique local addresses as defined by RFC 4193. Returns: A boolean, True if the address is reserved per RFC 3513 2.5.6. s fec0::/10(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt is_site_local�scCs|td�kS(s�Test if this address is allocated for private networks. Returns: A boolean, True if the address is reserved per RFC 4193. sfc00::/7(R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR��scCs(|jd?dkrdSt|jd@�S(s�Return the IPv4 mapped address. Returns: If the IPv6 address is a v4 mapped address, return the IPv4 mapped address. Return None otherwise. i i��l��N(RR)R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytipv4_mapped�s cCs@|jd?dkrdSt|jd?d@�t|jd@�fS(s�Tuple of embedded teredo IPs. Returns: Tuple of the (server, client) IPs or None if the address doesn't appear to be a teredo address (doesn't start with 2001::/32) i`i i@l��N(RR)R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pytteredo�s cCs,|jd?dkrdSt|jd?d@�S(s�Return the IPv4 6to4 embedded address. Returns: The IPv4 6to4-embedded address if present or None if the address doesn't appear to contain a 6to4 embedded address. ipi iPl��N(RR)R(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyt sixtofour�s N(RRRR�RR�R�R�RqR�R�R�R)RjRWRZR�R�R R�R�R�R�R�R�R�R�R�R�(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�Us. O / RcBseZdZd�ZRS(s4Represent and manipulate single IPv6 Addresses. cCs�tj||�t|ttf�r\||_|dksI||jkrXt|��ndSt|t�r�yt j d|�\}}Wn t jk r�t|��nX|d>|B|_dSt|�}|s�td��n|j |�|_dS(sInstantiate a new IPv6 address object. Args: address: A string or integer representing the IP Additionally, an integer can be passed, so IPv6Address('2001:4860::') == IPv6Address(42541956101370907050197289607612071936L). or, more generally IPv6Address(IPv6Address('2001:4860::')._ip) == IPv6Address('2001:4860::') Raises: AddressValueError: If address isn't a valid IPv6 address. iNs!QQi@R�(R�RqR$RfRmRRRRRR�R�R'R�(RMRthitloR�((s*/usr/lib/python2.7/site-packages/ipaddr.pyRq�s" (RRRRq(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�sRcBs)eZdZed�Zed��ZRS(s�This class represents and manipulates 128-bit IPv6 networks. Attributes: [examples for IPv6('2001:658:22A:CAFE:200::1/64')] .ip: IPv6Address('2001:658:22a:cafe:200::1') .network: IPv6Address('2001:658:22a:cafe::') .hostmask: IPv6Address('::ffff:ffff:ffff:ffff') .broadcast: IPv6Address('2001:658:22a:cafe:ffff:ffff:ffff:ffff') .netmask: IPv6Address('ffff:ffff:ffff:ffff::') .prefixlen: 64 cCs�tj||�tj||�t|tttf�rxt|�|_|jj |_ |j |_t|j�|_ dSt|�jd�}t|�dkr�t|��n|j|d�|_ t|j �|_t|�dkr|j|d�|_n|j |_t|j|j��|_ |rY|j|jkrYtd|j��qYn|j|j dkr~|j|_ndS(s�Instantiate a new IPv6 Network object. Args: address: A string or integer representing the IPv6 network or the IP and prefix/netmask. '2001:4860::/128' '2001:4860:0000:0000:0000:0000:0000:0000/128' '2001:4860::' are all functionally the same in IPv6. That is to say, failing to provide a subnetmask will create an object with a mask of /128. Additionally, an integer can be passed, so IPv6Network('2001:4860::') == IPv6Network(42541956101370907050197289607612071936L). or, more generally IPv6Network(IPv6Network('2001:4860::')._ip) == IPv6Network('2001:4860::') strict: A boolean. If true, ensure that we have been passed A true network address, eg, 192.168.1.0/24 and not an IP address on a network, eg, 192.168.1.1/24. Raises: AddressValueError: If address isn't a valid IPv6 address. NetmaskValueError: If the netmask isn't valid for an IPv6 address. ValueError: If strict was True and a network address was not supplied. NR�iiis%s has host bits set(RFRqR�R$RfRmRRRRR(R@RR{R'R�RCRR�R�R�RrRRwRv(RMRR R�((s*/usr/lib/python2.7/site-packages/ipaddr.pyRqs. cCs|jS(N(R�(RM((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�Fs(RRRR6RqRZR�(((s*/usr/lib/python2.7/site-packages/ipaddr.pyR�sD(%Rt__version__RR�R�RRRR)R R6RRRRR!R#R5R;RKtCollapseAddrListtbytesR'R&Rt NameErrorRQtobjectRRR%RFRRRR�RR(((s*/usr/lib/python2.7/site-packages/ipaddr.pyt<module>sH() @ / 6 U���,g�n1
/home/../lib/python2.7/site-packages/rhn/../kitchen/../ipaddr.pyo