Ńň îĄßNc@s<dZddklZddklZd„Zd„ZdS(sÎ Routines for dealing with nmap-style IPv4 address ranges. The nmap range specification represents between 1 and 4 contiguous IP address blocks depending on the range specified. Each octets can be represented with hyphenated range sets according to the following rules: 1. * C{'x-y'} - the hyphenated octet (represents values x through y) 2. x must be less than or equal to y 3. x and y must be values between 0 through 255 Example nmap ranges :: '192.0.2.1' # one IP address '192.0.2.0-31' # one block with 32 IP addresses. '192.0.2-3.1-254' # two blocks with 254 IP addresses. '0-255.0-255.0-255.0-255' # the whole IPv4 address space i˙˙˙˙(tAddrFormatError(t IPAddresscCs˘t}t|dƒp t}n|idƒ}t|ƒdjo t}nSxO|D]G}d|joä|idƒ}t|ƒd jo t}Pnyjdt|dƒjo djnp t}Pndt|dƒjo djnp t}PnWntj ot}PnXt|dƒt|dƒjo t}PqšqSy3dt|ƒjo djnp t}PnWqStj ot}PqSXqSW|S( sy @param iprange: an nmap-style IP address range. @return: C{True} if IP range is valid, C{False} otherwise. tsplitt.it-iiii˙(ii(tTruethasattrtFalseRtlentintt ValueError(tiprangetstatusttokensttokentoctets((s3/usr/lib/python2.6/site-packages/netaddr/ip/nmap.pytvalid_nmap_rangesD   (( ! $  c cs†t|ƒptd|ƒ‚ng}|idƒ}xv|D]n}d|jo6|iddƒ}t|dƒt|dƒf}nt|ƒt|ƒf}|i|ƒq=WxĐt|dd|dddƒD]Ť}x˘t|dd|dddƒD]}}xtt|dd|dddƒD]O}xFt|dd|dddƒD]!} td|||| fƒVqQWq'WqýWqÓWd S( sH The nmap security tool supports a custom type of IPv4 range using multiple hyphenated octets. This generator provides iterators yielding IP addresses according to this rule set. @param iprange: an nmap-style IP address range. @return: an iterator producing IPAddress objects for each IP in the range. sinvalid nmap range: %sRRiiiis %d.%d.%d.%dN(RRRR tappendtrangeR( R tmatrixR RRtpairtwtxtytz((s3/usr/lib/python2.6/site-packages/netaddr/ip/nmap.pytiter_nmap_rangeKs(  $$$$$N(t__doc__t netaddr.coreRt netaddr.ipRRR(((s3/usr/lib/python2.6/site-packages/netaddr/ip/nmap.pyts ,