/usr/lib/python2.6/site-packages/netaddr/ip
NameSizeModeActions
glob.py104740644editdlrm
glob.pyc98900644editdlrm
iana.py136210755editdlrm
iana.pyc145780644editdlrm
ipv4-address-space.xml534390644editdlrm
ipv6-address-space.xml75600644editdlrm
ipv6-unicast-address-assignments.xml145730644editdlrm
multicast-addresses.xml1322140644editdlrm
nmap.py40660644editdlrm
nmap.pyc37520644editdlrm
rfc1924.py17500644editdlrm
rfc1924.pyc21670644editdlrm
sets.py265610644editdlrm
sets.pyc216780644editdlrm
__init__.py660220644editdlrm
__init__.pyc640090644editdlrm
Edit: /usr/lib/python2.6/site-packages/netaddr/ip/glob.pyc (9890B)
Ñò }DVc@sždZddklZlZddklZlZlZlZddk l Z d„Z d„Z d„Z d„Zd „Zd „Zd efd „ƒYZd S(sb Routines and classes for supporting and expressing IP address ranges using a glob style syntax. iÿÿÿÿ(tAddrFormatErrortAddrConversionError(tIPRanget IPAddresst IPNetworktiprange_to_cidrs(t_is_strc Cs±t|ƒptSt}t}|idƒ}t|ƒdjotSxe|D]]}d|joË|otSt}|otSy:g}|idƒD]}|t|ƒq”~\}}Wntj otSX||jotSd|jo djnptSd|jo djnptSqL|djo t}qL|tjotS|tjotSy-dt|ƒjo djnptSWqLtj otSXqLWtS( s‹ :param ipglob: An IP address range in a glob-style format. :return: ``True`` if IP range glob is valid, ``False`` otherwise. t.it-iiþiiÿt*(RtFalsetsplittlentTruetintt ValueError( tipglobt seen_hyphent seen_asterisktoctetstoctett_[1]titoctet1toctet2((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt valid_globsJ  :      $  cCsöt|ƒptd|ƒ‚ng}g}xž|idƒD]}d|jo5|idƒ}|i|dƒ|i|dƒq=|djo|idƒ|idƒq=|i|ƒ|i|ƒq=Wtdi|ƒƒtdi|ƒƒfS( s÷ A function that accepts a glob-style IP range and returns the component lower and upper bound IP address. :param ipglob: an IP address range in a glob-style format. :return: a tuple contain lower and upper bound IP objects. s#not a recognised IP glob range: %r!RRiiR t0t255(RRR tappendRtjoin(Rt start_tokenst end_tokensRttokens((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pytglob_to_iptupleFs     cCsít|ƒptd|ƒ‚ng}g}xž|idƒD]}d|jo5|idƒ}|i|dƒ|i|dƒq=|djo|idƒ|idƒq=|i|ƒ|i|ƒq=Wtdi|ƒdi|ƒƒS( sÁ A function that accepts a glob-style IP range and returns the equivalent IP range. :param ipglob: an IP address range in a glob-style format. :return: an IPRange object. s#not a recognised IP glob range: %r!RRiiR RR(RRR RRR(RRRRR ((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pytglob_to_iprangeds     cCsìt|ƒ}t|ƒ}|idjo |idjotdƒ‚nd„}g}y=|||ƒ}t|ƒptdƒ‚n|i|ƒWnQtj oEx@t||ƒD]*}||d|dƒ}|i|ƒqµWnX|S(s A function that accepts an arbitrary start and end IP address or subnet and returns one or more glob-style IP ranges. :param start: the start IP address or subnet. :param end: the end IP address or subnet. :return: a list containing one or more IP globs. is!IP glob ranges only support IPv4!c Ss^g}t|ƒidƒD]}|t|ƒq~}g}t|ƒidƒD]}|t|ƒqP~}g}t}t} xÐtdƒD]Â} || || jo|it|| ƒƒq‹|| djo(|| djo|idƒt} q‹| p@|p)|id|| || fƒt}qMtdƒ‚q‹tdƒ‚q‹Wdi|ƒS( NRiiiÿR s%s-%ss,only 1 hyphenated octet per IP glob allowed!s3asterisks are not allowed before hyphenated octets!( tstrR RR trangeRR RR( tlbtubRt_tt1t_[2]tt2R RRR((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt_iprange_to_glob“s*66 "     sinvalid ip glob creatediiÿÿÿÿ(RtversionRRRR(tstarttendR+tglobsRtcidr((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pytiprange_to_globs‚s"    ! cCstt|ƒŒS(sï A function that accepts a glob-style IP range and returns a list of one or more IP CIDRs that exactly matches it. :param ipglob: an IP address range in a glob-style format. :return: a list of one or more IP objects. (RR!(R((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt glob_to_cidrsÌs cCsNt|ƒ}t|d|dƒ}t|ƒdjotdƒ‚n|dS(sÿ A function that accepts an IP subnet in a glob-style format and returns a list of CIDR subnets that exactly matches the specified glob. :param cidr: an IP object CIDR subnet. :return: a list of one or more IP addresses and subnets. iiÿÿÿÿisbad CIDR to IP glob conversion!(RR1R R(R0tipR/((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt cidr_to_globØs tIPGlobcBsheZdZd Zd„Zd„Zd„Zd„Zd„Ze eed dƒZ d„Z d „Z RS( s½ Represents an IP address range using a glob-style syntax ``x.x.x-y.*`` Individual octets can be represented using the following shortcuts : 1. ``*`` - the asterisk octet (represents values ``0`` through ``255``) 2. ``x-y`` - the hyphenated octet (represents values ``x`` through ``y``) A few basic rules also apply : 1. ``x`` must always be greater than ``y``, therefore : - ``x`` can only be ``0`` through ``254`` - ``y`` can only be ``1`` through ``255`` 2. only one hyphenated octet per IP glob is allowed 3. only asterisks are permitted after a hyphenated octet Examples: +------------------+------------------------------+ | IP glob | Description | +==================+==============================+ | ``192.0.2.1`` | a single address | +------------------+------------------------------+ | ``192.0.2.0-31`` | 32 addresses | +------------------+------------------------------+ | ``192.0.2.*`` | 256 addresses | +------------------+------------------------------+ | ``192.0.2-3.*`` | 512 addresses | +------------------+------------------------------+ | ``192.0-1.*.*`` | 131,072 addresses | +------------------+------------------------------+ | ``*.*.*.*`` | the whole IPv4 address space | +------------------+------------------------------+ .. note :: IP glob ranges are not directly equivalent to CIDR blocks. They can represent address ranges that do not fall on strict bit mask boundaries. They are suitable for use in configuration files, being more obvious and readable than their CIDR counterparts, especially for admins and end users with little or no networking knowledge or experience. All CIDR addresses can always be represented as IP globs but the reverse is not always true. t_globcCsKt|ƒ\}}tt|ƒi||ƒt|i|iƒd|_dS(Ni(R!tsuperR5t__init__R1t_startt_endtglob(tselfRR-R.((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyR8scCstt|ƒiƒS(s-:return: Pickled state of an `IPGlob` object.(R7R5t __getstate__(R<((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyR=scCs6tt|ƒi|ƒt|i|iƒd|_dS(s>:param state: data used to unpickle a pickled `IPGlob` object.iN(R7R5t __setstate__R1R9R:R;(R<tstate((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyR>#scCs|iS(N(R6(R<((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt _get_glob(scCs8t|ƒ\|_|_t|i|iƒd|_dS(Ni(R!R9R:R1R6(R<R((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt _set_glob+ss-an arbitrary IP address range in glob format.cCs d|iS(s3:return: IP glob in common representational format.s%s(R;(R<((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt__str__2scCsd|ii|ifS(s8:return: Python statement to create an equivalent objects%s('%s')(t __class__t__name__R;(R<((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt__repr__6s(s_globN(RDt __module__t__doc__t __slots__R8R=R>R@RAtpropertytNoneR;RBRE(((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyR5ês-        N(RGt netaddr.coreRRt netaddr.ipRRRRtnetaddr.compatRRR!R"R1R2R4R5(((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/glob.pyt s" 6   J