+
    4i                     D    R t ^ RIHt ^ RIHtHt R tR tR tR t	R t
R# )	z
Routines for dealing with nmap-style IPv4 address ranges.

Based on nmap's Target Specification :-

    http://nmap.org/book/man-target-specification.html
)AddrFormatError)	IPAddress	IPNetworkc                 H   \        4       pV P                  R 4       F  pRV9   d   VP                  R^4      w  r4V'       g   ^ pV'       g   ^p\        V4      p\        V4      p^ Tu;8:  d   ^8:  d   M M^ Tu;8:  d   ^8:  g   M \        RV : R24      hWV8  d   \        RV: 24      h\	        WV^,           4       F  pVP                  V4       K  	  K  \        V4      p^ Tu;8:  d   ^8:  g   M \        RV : R24      hVP                  V4       K  	  \        V4      # ),-zoctet value overflow for spec !z%left side of hyphen must be <= right )setsplitint
ValueErrorrangeaddsorted)specvalueselementleftrightlowhighoctets   &       1/usr/lib/python3/dist-packages/netaddr/ip/nmap.py_nmap_octet_target_valuesr      s     UF::c?'>!--Q/KDd)Cu:D#__1+;+; !NOOz g!WXXs1H-

5! . LE%#% !NOOJJu' #* &>    c                 v   \        V \        4      '       g   \        R \        V 4      ,          4      hV '       g   \	        R4      hV P                  R4      p\        V4      ^8w  d   \        RV : 24      h\        V^ ,          4      \        V^,          4      \        V^,          4      \        V^,          4      3# )zstring expected, not %sz*nmap target specification cannot be blank!.zinvalid nmap range: )	
isinstancestr	TypeErrortyper   r
   lenr   r   )nmap_target_spectokenss   & r   _generate_nmap_octet_rangesr$   /   s     &,,1D9I4JJKKEFF##C(F
6{a:JLMM 	"&),!&),!&),!&),	 r   c              #     "   R V 9   dt   V P                  R ^4      w  r^ \        V4      u;8  d   ^!8  g   M \        RV: 24      h\        V 4      pVP                  ^8w  d   \        R4      hV F  pVx  K	  	  R# RV 9   d   \        V 4      x  R# \        V 4      pV^ ,           FJ  pV^,           F:  pV^,           F*  pV^,           F  p	\        RWgW3,          ^4      x  K  	  K,  	  K<  	  KL  	  R# 5i)/zCIDR prefix expected, not zCIDR only support for IPv4!:z%d.%d.%d.%dN)r
   r   r   r   versionr   r$   )
target_spec_prefixnetipoctet_rangeswxyzs
   &         r   _parse_nmap_target_specr3   E   s     
k%%c1-	CK$"$!F"LMM$;;!!"?@@BH 		$$2;?aA!!__%aA)!__'q(DaHH - ) % !s   C5C7c                j     \        \        V 4      4       R#   \        \        \        3 d     R# i ; i)z
:param target_spec: an nmap-style IP range target specification.

:return: ``True`` if IP range target spec is valid, ``False`` otherwise.
TF)nextr3   r   r   r   )r)   s   &r   valid_nmap_ranger6   [   s4    $[12z?3 s    22c               '  L   "   V  F  p\        V4       F  pVx  K	  	  K  	  R# 5i)a=  
An generator that yields IPAddress objects from defined by nmap target
specifications.

See https://nmap.org/book/man-target-specification.html for details.

:param nmap_target_spec: one or more nmap IP range target specification.

:return: an iterator producing IPAddress objects for each IP in the target spec(s).
N)r3   )r"   r)   addrs   *  r   iter_nmap_ranger9   i   s%      (+K8DJ 9 (s   "$N)__doc__netaddr.corer   
netaddr.ipr   r   r   r$   r3   r6   r9    r   r   <module>r>      s,    ) +:,I,r   