Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
ó -=¤Mc@s2dZdZddlZddlZi dd6dd6dd6dd 6dd 6dd 6dd 6dd 6dd6ZiPdd6ddd6ddd6dddd 6dddd d6dddd6dd6dd6dd6dd6dd 6dd!6d"d#6d$d%6d&d'6d(d)dd6d*d+6d,d-6d.d/6d0d16d0d26d0d36d,d46d5d66d,d76d8d96d0d:6d0d;6d.d<6d0d=6d0d>6d0d?6d0d@6d0dA6ddB6d0dC6dDdE6d,dF6d0dG6d.dH6d0dI6d0dJ6d0dK6d,dL6d,dM6d,dN6dOdP6d0dQ6d,dR6d.dS6d.dT6d.dU6d8dV6d0dW6dDdX6ddY6ddZ6dd[6dd\6dd]6dd^6dd_6dd`6dda6ddb6ddc6ddde6ddf6dgdh6ddi6djdk6dldm6dndo6dpdq6drds6dtdu6dvdw6dxdy6dzd{6d|d}6Zd~fd„ƒYZd€efd�„ƒYZd‚„Zdƒ„Z d„„Z d…„Z d†„Z id‡d6d!d 6dˆd‰6d[dŠ6d‹dŒ6d�dŽ6d�d�6d‘d’6d“d”6d•d–6d—d˜6d™dš6d›dœ6d�dž6dadŸ6d d¡6Z d¢„Zd£„Zd¤„Zd¥„Zd¦„Zd§„Zd¨„Zd©„Zedªkr.ddlZejƒ\ZZer+ddlZejd«ƒnndS(¬sÇ IPy - class and tools for handling of IPv4 and IPv6 addresses and networks. See README file for learn how to use IPy. Further Information might be available at: https://github.com/haypo/python-ipy s0.75iÿÿÿÿNtPUBLICt0tPRIVATEt00000000t00001010t01111111t1t1010100111111110t 101011000001t1100000010101000tRESERVEDt111i`t UNSPECIFIEDi€tLOOPBACKitIPV4MAPiPit WKP46TRANSt 00000000011001001111111110011011i@t UNASSIGNEDt00000001t0000001t0000010t0000011t00001t0001sGLOBAL-UNICASTt001tSPECIALPURPOSEt00100000000000010000000tTEREDOt 00100000000000010000000000000000tBMWGt 00100000000000010000000000000010tORCHIDt0010000000000001000000000001sALLOCATED APNICt00100000000000010000001sALLOCATED ARINt00100000000000010000010sALLOCATED RIPE NCCt00100000000000010000011t00100000000000010000100t00100000000000010000101t00100000000000010000110t DOCUMENTATIONt 00100000000000010000110110111000t00100000000000010000111sALLOCATED LACNICt00100000000000010001001t00100000000000010001010t00100000000000010001011t00100000000000010001100t00100000000000010001101t0010000000000001000111t00100000000000010010t001000000000000100110t0010000000000001001110t0010000000000001001111t00100000000000010100000sALLOCATED AFRINICt00100000000000010100001t00100000000000010100010t00100000000000010100011t00100000000000010100100t00100000000000010100101t00100000000000010100110t00100000000000010101t0010000000000001100t00100000000000011010t00100000000000011011t6TO4t0010000000000010t001000000000001100t 001001000000t 001001100000t00100110000100000000000t00100110001000000000000t 001010000000t 001010100000t 001011000000t00101101t0010111t0011t010t011t100t101t110t1110t11110t111110tULAt1111110t 111111100t LINKLOCALt 1111111010t 1111111011t MULTICASTt11111111sNODE-LOCAL MULTICASTt1111111100000001sLINK-LOCAL MULTICASTt1111111100000010sADMIN-LOCAL MULTICASTt1111111100000100sSITE-LOCAL MULTICASTt1111111100000101sORG-LOCAL MULTICASTt1111111100001000sGLOBAL MULTICASTt1111111100001110sRESERVED MULTICASTt1111111100001111sPREFIX-BASED MULTICASTt 111111110011sRP-EMBEDDED MULTICASTt 111111110111tIPintcBs"eZdZddd„Zd„Zd„Zd„Zd„Zd„Zd„Z dd „Z dd „Z dd „Z dd „Zdd „Zdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(sHandling of IP addresses returning integers. Use class IP instead because some features are not implemented for IPint.icCsWd|_d|_d}d}t|ttfƒrt|ƒ|_|dkro|jdkrfd}qod}n|dkr©|jdkr td|jƒ‚nd }nF|dkrã|jd krÚtd |jƒ‚nd }n td ƒ‚||_||_ nOt|t ƒr:|j|_|j |_ |j|_nt|t t fƒr=|j dƒ}t|ƒdkrR|\}}t|ƒ\|_} | dkr¬tdƒ‚nt|ƒ\}} | dkrÙtdƒ‚n||jkr÷tdƒ‚n||j} t| ƒ}td|d |fƒjƒjƒ|krFtd|ƒ‚qFnôt|ƒdkr|j dƒ}t|ƒdkr˜|d}d}qFt|ƒdkr¹tdƒ‚qF|\}}|jdƒdkrFt|ƒ\} } | dkrtdƒ‚nt| ƒ}qFn-t|ƒdkr:tdƒ‚n tdƒ‚t|ƒ\|_} |dkrp| }n|dkr½|dkr•d |}q½|dkr®d |}q½td ƒ‚n||_t|ƒ|_ |rý|jt|j |jƒ@|_nt|j|j |jƒsStdt|ƒ|j fƒ‚qSntdt|ƒƒ‚dS(s-Create an instance of an IP object. Data can be a network specification or a single IP. IP addresses can be specified in all forms understood by parseAddress(). The size of a network can be specified as /prefixlen a.b.c.0/24 2001:658:22a:cafe::/64 -lastIP a.b.c.0-a.b.c.255 2001:658:22a:cafe::-2001:658:22a:cafe:ffff:ffff:ffff:ffff /decimal netmask a.b.c.d/255.255.255.0 not supported for IPv6 If no size specification is given a size of 1 address (/32 for IPv4 and /128 for IPv6) is assumed. If make_net is True, an IP address will be transformed into the network address by applying the specified netmask. >>> print(IP('127.0.0.0/8')) 127.0.0.0/8 >>> print(IP('127.0.0.0/255.0.0.0')) 127.0.0.0/8 >>> print(IP('127.0.0.0-127.255.255.255')) 127.0.0.0/8 >>> print(IP('127.0.0.1/255.0.0.0', make_net=True)) 127.0.0.0/8 See module documentation for more examples. iiiÿÿÿÿIiiIÿÿÿÿsJIPv4 Addresses can't be larger than 0xffffffffffffffffffffffffffffffff: %xi l ÿÿÿÿÿÿÿÿÿsJIPv6 Addresses can't be larger than 0xffffffffffffffffffffffffffffffff: %xi€sonly IPv4 and IPv6 supportedt-is)first-last notation only allowed for IPv4s last address should be IPv4, toos(last address should be larger than firsts%s/%ss*the range %s is not on a network boundary.t/s"only one '/' allowed in IP Addresst.snetmask must be IPv4s"only one '-' allowed in IP Addresss can't parses!%s has invalid prefix length (%s)sUnsupported data type: %sN(tNoPrefixForSingleIptNonet WantPrefixLent isinstancetinttlongtipt ValueErrort _ipversiont _prefixlenRetstrtunicodetsplittlent parseAddresst _count1BitstIPt broadcasttfindt_netmaskToPrefixlent_prefixlenToNetmaskt_checkNetaddrWorksWithPrefixlentreprt TypeErrorttype(tselftdatat ipversiontmake_nettnetbitst prefixlentxRotlastt parsedVersiont lastversiontsizetnetmasktvers((s'/usr/lib/python2.7/site-packages/IPy.pyt__init__{s”                   ,             " %cCs|jS(s Return the first / base / network addess as an (long) integer. The same as IP[0]. >>> "%X" % IP('10.0.0.0/8').int() 'A000000' (Ro(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyRmüscCs|jS(sŠReturn the IP version of this Object. >>> IP('10.0.0.0/8').version() 4 >>> IP('::1').version() 6 (Rq(R‚((s'/usr/lib/python2.7/site-packages/IPy.pytversionscCs|jS(sWReturns Network Prefixlen. >>> IP('10.0.0.0/8').prefixlen() 8 (Rr(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyR‡scCs |jƒS(sT Return the base (first) address of a network as an (long) integer. (Rm(R‚((s'/usr/lib/python2.7/site-packages/IPy.pytnetscCs|jƒ|jƒdS(sl Return the broadcast (last) address of a network as an (long) integer. The same as IP[-1].i(RmRv(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyRzscCs|jdkr|jdks<|jdkrQ|jdkrQ|jrQd}qQn|d kr~|j}|d kr~d}q~n|r|dkrÔ|jƒ}t|ttfƒsÀ|jƒ}ndt ||jƒS|d krd t |j |j ƒd|jƒSd |jSnd Sd S(s¿Prints Prefixlen/Netmask. Not really. In fact it is our universal Netmask/Prefixlen printer. This is considered an internal function. want == 0 / None don't return anything 1.2.3.0 want == 1 /prefix 1.2.3.0/24 want == 2 /netmask 1.2.3.0/255.255.255.0 want == 3 -lastip 1.2.3.0-1.2.3.255 ii ii€iiis/%sis-%ss/%dtN( RqRrRiRjRkR�RlRmRntintToIpRoRv(R‚twantR�((s'/usr/lib/python2.7/site-packages/IPy.pyt _printPrefix%s$          %cCs’|jdkrd}n$|jdkr0d}n tdƒ‚|jdkr`|dkr`d}nt|jƒ}d|t|ƒ||j|ƒS( s�Return a string representation as a binary value. >>> print(IP('127.0.0.1').strBin()) 01111111000000000000000000000001 ii ii€sonly IPv4 and IPv6 supportediRN(RqRpRkRjt _intToBinRoRvR•(R‚t wantprefixlentbitstret((s'/usr/lib/python2.7/site-packages/IPy.pytstrBinOs    c Cs|jd kr$|d kr$d}n|jdkr@|j|ƒS|jd?dkr„t|jd@dƒ}d||j|ƒ}|Sg|jdƒjdƒD]}t|d ƒ^q�}dgd }x.t t |ƒƒD]}t ||ƒ||>> IP('127.0.0.1').strCompressed() '127.0.0.1' >>> IP('2001:0658:022a:cafe:0200::1').strCompressed() '2001:658:22a:cafe:200::1' >>> IP('ffff:ffff:ffff:ffff:ffff:f:f:fffc/127').strCompressed() 'ffff:ffff:ffff:ffff:ffff:f:f:fffc/127' iii iÿÿIÿÿÿÿs::ffff:it:iiRR’N(RkRjRqt strFullsizeRoR“R•RuRmtxrangeRvt_countFollowingZerostindextmaxt strNormaltinserttappendtjoin( R‚R—tipv4ttextRˆthextetstfollowingzerostitcompressionpos((s'/usr/lib/python2.7/site-packages/IPy.pyt strCompressedcs0   4 +%  cCsÎ|jd kr$|d kr$d}n|jdkrE|jdƒ}nx|jdkr±djgg|jdƒjdƒD]}t|dƒ^qvD]}t|ƒd^q�ƒ}n tdƒ‚||j |ƒS( sãReturn a string representation in the usual format. >>> print(IP('127.0.0.1').strNormal()) 127.0.0.1 >>> print(IP('2001:0658:022a:cafe:0200::1').strNormal()) 2001:658:22a:cafe:200:0:0:1 iiiiR›iisonly IPv4 and IPv6 supportedN( RkRjRqRœR¤RuRmthexRpR•(R‚R—R™Rˆ((s'/usr/lib/python2.7/site-packages/IPy.pyR¡�s  ] cCsJ|jdkr$|dkr$d}nt|j|jƒjƒ|j|ƒS(sùReturn a string representation in the non-mangled format. >>> print(IP('127.0.0.1').strFullsize()) 127.0.0.1 >>> print(IP('2001:0658:022a:cafe:0200::1').strFullsize()) 2001:0658:022a:cafe:0200:0000:0000:0001 iN(RkRjR“RoRqtlowerR•(R‚R—((s'/usr/lib/python2.7/site-packages/IPy.pyRœ§s  cCsg|jdkr$|dkr$d}nt|jƒ}|ddkrP|d }n|jƒ|j|ƒS(sãReturn a string representation in hex format in lower case. >>> IP('127.0.0.1').strHex() '0x7f000001' >>> IP('2001:0658:022a:cafe:0200::1').strHex() '0x20010658022acafe0200000000000001' iiÿÿÿÿtLN(RkRjR¬RoR­R•(R‚R—Rˆ((s'/usr/lib/python2.7/site-packages/IPy.pytstrHexµs   cCsa|jdkr$|dkr$d}nt|jƒ}|ddkrP|d }n||j|ƒS(sçReturn a string representation in decimal format. >>> print(IP('127.0.0.1').strDec()) 2130706433 >>> print(IP('2001:0658:022a:cafe:0200::1').strDec()) 42540616829182469433547762482097946625 iiÿÿÿÿR®N(RkRjRsRoR•(R‚R—Rˆ((s'/usr/lib/python2.7/site-packages/IPy.pytstrDecÆs   cCs‹|jdkrt}n$|jdkr0t}n tdƒ‚|jƒ}x<tt|ƒddƒD]"}|| |kra||| SqaWdS(s×Return a description of the IP type ('PRIVATE', 'RESERVERD', etc). >>> print(IP('127.0.0.1').iptype()) PRIVATE >>> print(IP('192.168.1.1').iptype()) PRIVATE >>> print(IP('195.185.1.2').iptype()) PUBLIC >>> print(IP('::1').iptype()) LOOPBACK >>> print(IP('2001:0658:022a:cafe:0200::1').iptype()) ALLOCATED RIPE NCC The type information for IPv6 is out of sync with reality. iisonly IPv4 and IPv6 supportediiÿÿÿÿtunknown(Rqt IPv4rangest IPv6rangesRpRšR�Rv(R‚tiprangeR˜R©((s'/usr/lib/python2.7/site-packages/IPy.pytiptype×s    cCs]|jdkrd|j}n+|jdkr>d|j}n tdƒ‚d|jd|>S(srReturn netmask as an integer. >>> "%X" % IP('195.185.0.0/16').netmask().int() 'FFFF0000' ii ii€sonly IPv4 and IPv6 supportedii(RqRrRp(R‚tlocallen((s'/usr/lib/python2.7/site-packages/IPy.pyR�øs  cCso|jdkr8d|j}td|jd|>dƒS|jdkr_d|j}d|jStdƒ‚d S( sÓReturn netmask as an string. Mostly useful for IPv6. >>> print(IP('195.185.0.0/16').strNetmask()) 255.255.0.0 >>> print(IP('2001:0658:022a:cafe::0/64').strNetmask()) /64 ii iiii€s/%dsonly IPv4 and IPv6 supportedN(RqRrR“Rp(R‚R¶((s'/usr/lib/python2.7/site-packages/IPy.pyt strNetmask s    cCsR|jdkrd|j}n+|jdkr>d|j}n tdƒ‚d|S(s›Return the length of a subnet. >>> print(IP('195.185.1.0/28').len()) 16 >>> print(IP('195.185.1.0/24').len()) 256 ii ii€sonly IPv4 and IPv6 supportedi(RqRrRp(R‚R¶((s'/usr/lib/python2.7/site-packages/IPy.pyRvs  cCstS(sAll IPy objects should evaluate to true in boolean context. Ordinarily they do, but if handling a default route expressed as 0.0.0.0/0, the __len__() of the object becomes 0, which is used as the boolean value of the object. (tTrue(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyt __nonzero__0scCst|jƒƒS(s�Return the length of a subnet. Called to implement the built-in function len(). It breaks with IPv6 Networks. Anybody knows how to fix this.(RmRv(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyt__len__9s cCs�t|ttfƒst‚n|dkrdt|ƒ|jƒkr[|jƒt|ƒ}qt‚n||jƒkrt‚n|jt|ƒS(sNCalled to implement evaluation of self[key]. >>> ip=IP('127.0.0.0/30') >>> for x in ip: ... print(repr(x)) ... IP('127.0.0.0') IP('127.0.0.1') IP('127.0.0.2') IP('127.0.0.3') >>> ip[2] IP('127.0.0.2') >>> ip[-1] IP('127.0.0.3') i(RlRmRnR€tabsRvt IndexErrorRo(R‚tkey((s'/usr/lib/python2.7/site-packages/IPy.pyt __getitem__Es    cCsTt|ƒ}|j|jkrL|j|j|jƒ|jƒdkrLtStSdS(s¦Called to implement membership test operators. Should return true if item is in self, false otherwise. Item can be other IP-objects, strings or ints. >>> IP('195.185.1.1').strHex() '0xc3b90101' >>> 0xC3B90101 in IP('195.185.1.0/24') True >>> '127.0.0.1' in IP('127.0.0.0/24') True >>> IP('127.0.0.0/24') in IP('127.0.0.0/25') False iN(RyRoRvR¸tFalse(R‚titem((s'/usr/lib/python2.7/site-packages/IPy.pyt __contains__es <cCsxt|ƒ}|j|jkr>|j|j|jƒkr>dS|j|jkrp|j|j|jƒkrpdSdSdS(sÏCheck if two IP address ranges overlap. Returns 0 if the two ranges don't overlap, 1 if the given range overlaps at the end and -1 if it does at the beginning. >>> IP('192.168.0.0/23').overlaps('192.168.1.0/24') 1 >>> IP('192.168.0.0/23').overlaps('192.168.1.255') 1 >>> IP('192.168.0.0/23').overlaps('192.168.2.0') 0 >>> IP('192.168.1.0/24').overlaps('192.168.0.0/23') -1 iiÿÿÿÿiN(RyRoRv(R‚RÀ((s'/usr/lib/python2.7/site-packages/IPy.pytoverlaps|s  ..cCs |jƒS(sSDispatch to the prefered String Representation. Used to implement str(IP).(R«(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyt__str__•scCsd|jdƒS(sPrint a representation of the Object. Used to implement repr(IP). Returns a string which evaluates to an identical Object (without the wantprefixlen stuff - see module docstring. >>> print(repr(IP('10.0.0.0/24'))) IP('10.0.0.0/24') s IPint('%s')i(R«(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyt__repr__�s cCsÅ|j|jƒkr&|jƒ|jS|j|jƒkrL|jƒ|jS|j|jkrbdS|j|jkrxdS|j|jkr½|j|jkr dS|j|jkr¶dSdSndSdS(sÔCalled by comparison operations. Should return a negative integer if self < other, zero if self == other, a positive integer if self > other. Networks with different prefixlen are considered non-equal. Networks with the same prefixlen and differing addresses are considered non equal but are compared by their base address integer value to aid sorting of IP objects. The version of Objects is not put into consideration. >>> IP('10.0.0.0/24') > IP('10.0.0.0') 1 >>> IP('10.0.0.0/24') < IP('10.0.0.0') 0 >>> IP('10.0.0.0/24') < IP('12.0.0.0/24') 1 >>> IP('10.0.0.0/24') > IP('12.0.0.0/24') 0 iÿÿÿÿiiN(RrR‡RoRq(R‚tother((s'/usr/lib/python2.7/site-packages/IPy.pyt__cmp__«scCs|j|ƒdkS(Ni(RÆ(R‚RÅ((s'/usr/lib/python2.7/site-packages/IPy.pyt__eq__èscCs|j|ƒdkS(Ni(RÆ(R‚RÅ((s'/usr/lib/python2.7/site-packages/IPy.pyt__lt__ëscCsWtdƒ}|j}x(|dkr?||d@A}|d?}qW||jA}t|ƒS(shCalled for the key object for dictionary operations, and by the built-in function hash(). Should return a 32-bit integer usable as a hash value for dictionary operations. The only required property is that objects which compare equal have the same hash value >>> IP('10.0.0.0/24').__hash__() -167772185 iÿÿÿÿiiÿÿÿi (RmRoRr(R‚tthehashRo((s'/usr/lib/python2.7/site-packages/IPy.pyt__hash__îs   N( t__name__t __module__t__doc__R�RmR�R‡R‘RzR•RjRšR«R¡RœR¯R°RµR�R·RvR¹RºR¾RÁRÂRÃRÄRÆRÇRÈRÊ(((s'/usr/lib/python2.7/site-packages/IPy.pyReus:�    *  -     !        =  RycBsheZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z RS( s-Class for handling IP addresses and networks.cCsttj|ƒd|jƒS(s�Return the base (first) address of a network as an IP object. The same as IP[0]. >>> IP('10.0.0.0/8').net() IP('10.0.0.0') R„(RyReR‘Rq(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyR‘scCsttj|ƒƒS(s®Return the broadcast (last) address of a network as an IP object. The same as IP[-1]. >>> IP('10.0.0.0/8').broadcast() IP('10.255.255.255') (RyReRz(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyRzscCsttj|ƒd|jƒS(siReturn netmask as an IP object. >>> IP('10.0.0.0/8').netmask() IP('255.0.0.0') R„(RyReR�Rq(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyR�scCst|jdkrdS|jd?dkr*dS|jd@}|jdkrdd|dd|jf}nt|ddƒS( Nii iÿÿIÿÿÿÿi€s%s/%sR„i(RqRjRoRrRy(R‚R¥((s'/usr/lib/python2.7/site-packages/IPy.pyt _getIPv4Map!s cCs|jdkr6g}|jƒdkrNx|D]}|j|jƒƒq.Wnä|jƒdkr¡xÏtd|jƒdƒD]!}|j||jƒdƒqyWn‘|jƒdkrôx|td|jƒdƒD]!}|j||jƒdƒqÌWn>x;td|jƒdƒD]!}|j||jƒdƒq W|S|jdkr|jƒ}|dk rg|jƒSt|j ƒdj ƒ}|dd kr�|d }n|j ddkr¿t d ƒ‚nt |ƒ}|jƒd j|ƒ}td |j dƒd}d ||gStdƒ‚dS(sºReturn a list with values forming the reverse lookup. >>> IP('213.221.113.87/32').reverseNames() ['87.113.221.213.in-addr.arpa.'] >>> IP('213.221.112.224/30').reverseNames() ['224.112.221.213.in-addr.arpa.', '225.112.221.213.in-addr.arpa.', '226.112.221.213.in-addr.arpa.', '227.112.221.213.in-addr.arpa.'] >>> IP('127.0.0.0/24').reverseNames() ['0.0.127.in-addr.arpa.'] >>> IP('127.0.0.0/23').reverseNames() ['0.0.127.in-addr.arpa.', '1.0.127.in-addr.arpa.'] >>> IP('127.0.0.0/16').reverseNames() ['0.127.in-addr.arpa.'] >>> IP('127.0.0.0/15').reverseNames() ['0.127.in-addr.arpa.', '1.127.in-addr.arpa.'] >>> IP('128.0.0.0/8').reverseNames() ['128.in-addr.arpa.'] >>> IP('128.0.0.0/7').reverseNames() ['128.in-addr.arpa.', '129.in-addr.arpa.'] >>> IP('::1:2').reverseNames() ['2.0.0.0.1.ip6.arpa.'] iiiiiiiiÿÿÿÿtls3can't create IPv6 reverse names at sub nibble levelRhi s %s.ip6.arpa.sonly IPv4 and IPv6 supportedNiiiiii(RqRvR£t reverseNameR�RÎRjt reverseNamesR¬RoR­RrtNotImplementedErrortlisttreverseR¤RmRp(R‚R™RˆR©R¥tstfirst_nibble_index((s'/usr/lib/python2.7/site-packages/IPy.pyRÑ+s: ""      cCs<|jdkrø|jdƒ}|jdƒ}|jƒtd|jdƒ}|jddkrÑd|d|jdt|j|jƒddƒjdƒdf}|dd krÄ|d }n|d7}nd }dj ||ƒ}d ||fS|jd kr,|j ƒ}|dk r)|j ƒSt |jƒd jƒ}|dd kr_|d }n|jddkrÔd||jt |j|jƒdƒd jƒf}|dd krÇ|d }n|d7}nd }t|ƒ}|jƒdj |ƒ}td|jdƒd }d|||fStdƒ‚dS(sReturn the value for reverse lookup/PTR records as RFC 2317 look alike. RFC 2317 is an ugly hack which only works for sub-/24 e.g. not for /23. Do not use it. Better set up a zone for every address. See reverseName for a way to achieve that. >>> print(IP('195.185.1.1').reverseName()) 1.1.185.195.in-addr.arpa. >>> print(IP('195.185.1.0/28').reverseName()) 0-15.1.185.195.in-addr.arpa. >>> IP('::1:2').reverseName() '2.0.0.0.1.ip6.arpa.' iiRhis%s-%siiiÿÿÿÿRÏR’s%s%s.in-addr.arpa.iii s%s%s.ip6.arpa.sonly IPv4 and IPv6 supportedN(RqRœRuRÔRmRrR“RoRvR¤RÎRjRÐR¬R­RÓRp(R‚RÕtfirst_byte_indext nibblepartR¥RÖ((s'/usr/lib/python2.7/site-packages/IPy.pyRÐcs@ F      8    cCs?dt|ƒkr%td|ƒ‚ntd||fdtƒS(sÜTransform a single IP address into a network specification by applying the given netmask. Returns a new IP instance. >>> print(IP('127.0.0.1').make_net('255.0.0.0')) 127.0.0.0/8 Rgsinvalid netmask (%s)s%s/%sR…(RsRpRyR¸(R‚R�((s'/usr/lib/python2.7/site-packages/IPy.pyR…˜s cCsttj||ƒƒS(sACalled to implement evaluation of self[key]. >>> ip=IP('127.0.0.0/30') >>> for x in ip: ... print(str(x)) ... 127.0.0.0 127.0.0.1 127.0.0.2 127.0.0.3 >>> print(str(ip[2])) 127.0.0.2 >>> print(str(ip[-1])) 127.0.0.3 (RyReR¾(R‚R½((s'/usr/lib/python2.7/site-packages/IPy.pyR¾¥scCsd|jdƒS(sePrint a representation of the Object. >>> IP('10.0.0.0/8') IP('10.0.0.0/8') sIP('%s')i(R«(R‚((s'/usr/lib/python2.7/site-packages/IPy.pyRÄ·scCsµ|jƒ|jƒkr'tdƒ‚n|jƒdkrHtdƒ‚n|jƒ|jƒkrotdƒ‚n||krˆ|j|ƒSt|jƒƒ}|jƒd|_|SdS(s3Emulate numeric objects through network aggregations3Only networks with the same prefixlen can be added.is8Networks with a prefixlen longer than /1 can't be added.s4Only networks with the same IP version can be added.N(R‡RpR�t__add__RyRmRr(R‚RÅR™((s'/usr/lib/python2.7/site-packages/IPy.pyRÙÀs  ( RËRÌRÍR‘RzR�RÎRÑRÐR…R¾RÄRÙ(((s'/usr/lib/python2.7/site-packages/IPy.pyRys  8 5  c CsÛg}d}d}x|t|ƒkr1||}|jdƒr{|dk r_td|ƒ‚nt|ƒ}|d7}qn|jdƒ}|dkr©td|ƒ‚n|dkr |j|| ƒ|||d!dkrê||7}n||d7}|t|ƒkr.td|ƒ‚q.q|j|ƒPqW|r¹d |dkr¹|dk r~|t|ƒdk r~td |ƒ‚nt|dƒd}|d d |d ?d |d @g}n|dk rdt|ƒ}|dkrôtd|ƒ‚n|| dg|||}nt|ƒdkr9td|ƒ‚nd}d}x�|D]‡}y0t|d ƒ}d|ko{d kn } Wntk r›t} nX| r»td||fƒ‚n|d >|}|d7}qLW|S(st Internal function used by parseAddress() to parse IPv6 address with ':'. >>> print(_parseAddressIPv6('::')) 0 >>> print(_parseAddressIPv6('::1')) 1 >>> print(_parseAddressIPv6('0:0:0:0:0:0:0:1')) 1 >>> print(_parseAddressIPv6('0:0:0::0:0:1')) 1 >>> print(_parseAddressIPv6('0:0:0:0:0:0:0:0')) 0 >>> print(_parseAddressIPv6('0:0:0::0:0:0')) 0 >>> print(_parseAddressIPv6('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210')) 338770000845734292534325025077361652240 >>> print(_parseAddressIPv6('1080:0000:0000:0000:0008:0800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('1080:0:0:0:8:800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('1080:0::8:800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('1080::8:800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('FF01:0:0:0:0:0:0:43')) 338958331222012082418099330867817087043 >>> print(_parseAddressIPv6('FF01:0:0::0:0:43')) 338958331222012082418099330867817087043 >>> print(_parseAddressIPv6('FF01::43')) 338958331222012082418099330867817087043 >>> print(_parseAddressIPv6('0:0:0:0:0:0:13.1.68.3')) 218186755 >>> print(_parseAddressIPv6('::13.1.68.3')) 218186755 >>> print(_parseAddressIPv6('0:0:0:0:0:FFFF:129.144.52.38')) 281472855454758 >>> print(_parseAddressIPv6('::FFFF:129.144.52.38')) 281472855454758 >>> print(_parseAddressIPv6('1080:0:0:0:8:800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('1080::8:800:200C:417A')) 21932261930451111902915077091070067066 >>> print(_parseAddressIPv6('::1:2:3:4:5:6')) 1208962713947218704138246 >>> print(_parseAddressIPv6('1:2:3:4:5:6::')) 5192455318486707404433266432802816 is::s,%r: Invalid IPv6 address: more than one '::'iR›s%r: Invalid IPv6 addressiÿÿÿÿiRhs)%r: Invalid IPv6 address: '::' after IPv4s%04xiiÿÿis,%r: Invalid IPv6 address: '::' is not neededRs/%r: Invalid IPv6 address: should have 8 hextetss+%r: Invalid IPv6 address: invalid hexlet %rN( RjRvt startswithRpR{R£RwRmR¸( tipstrtitemsRŸtfill_posR¦tpostvaluetdiffRÀterror((s'/usr/lib/python2.7/site-packages/IPy.pyt_parseAddressIPv6Ñs`6        #'    !  cCs |jdƒrdt|ddƒ}|dkrAtd|ƒ‚n|dkrW|dfS|dfSn|jd ƒd kr‰t|ƒdfSt|ƒd kr®t|dƒdfS|jd ƒd ksçt|ƒdkr¿t|ƒd kr¿|jd ƒ}t|ƒdkrtdƒ‚n|dgdt|ƒ7}g|D]}t|ƒ^q9}x9|D]1}|dksv|dkrXtd|ƒ‚qXqXW|dd>|dd>|dd>|ddfSt|dƒ}|dkrétdƒ‚n|dkrÿ|dfS|dfSdS(sÙ Parse a string and return the corresponding IP address (as integer) and a guess of the IP version. Following address formats are recognized: >>> def testParseAddress(address): ... ip, version = parseAddress(address) ... print(("%s (IPv%s)" % (ip, version))) ... >>> testParseAddress('0x0123456789abcdef') # IPv4 if <= 0xffffffff else IPv6 81985529216486895 (IPv6) >>> testParseAddress('123.123.123.123') # IPv4 2071690107 (IPv4) >>> testParseAddress('123.123') # 0-padded IPv4 2071658496 (IPv4) >>> testParseAddress('1080:0000:0000:0000:0008:0800:200C:417A') 21932261930451111902915077091070067066 (IPv6) >>> testParseAddress('1080:0:0:0:8:800:200C:417A') 21932261930451111902915077091070067066 (IPv6) >>> testParseAddress('1080:0::8:800:200C:417A') 21932261930451111902915077091070067066 (IPv6) >>> testParseAddress('::1') 1 (IPv6) >>> testParseAddress('::') 0 (IPv6) >>> testParseAddress('0:0:0:0:0:FFFF:129.144.52.38') 281472855454758 (IPv6) >>> testParseAddress('::13.1.68.3') 218186755 (IPv6) >>> testParseAddress('::FFFF:129.144.52.38') 281472855454758 (IPv6) t0xiil ÿÿÿÿÿÿÿÿÿs)%r: IP Address can't be bigger than 2^128IiiR›iÿÿÿÿi Rhis#IPv4 Address with more than 4 bytesRiÿis'%r: single byte must be 0 <= byte < 256iiiii s%IP Address can't be bigger than 2^128IÿÿÿÿN(RÚRnRpR{RâRvRmRu(RÛR™tbytesRˆ((s'/usr/lib/python2.7/site-packages/IPy.pyRwIs6#    9 2   cCs€t|ƒ}|dkr+td|ƒ‚nd}|dkr¨|dkrbtdt|ƒƒ‚nx6tdƒD](}t|d@ƒd|}|d ?}qoW|d }nÔ|d krp|d krÙtd t|ƒƒ‚ntjdkrût|ƒd}nt|ƒdd !}|jdƒ}xCtddƒD]2}|| |}|ddkr-d|}q-q-W|d}n tdƒ‚|S(s/Transform an integer string into an IP address.isIPs can't be negative: %dR’iIÿÿÿÿs2IPv4 Addresses can't be larger than 0xffffffff: %siÿRhiiÿÿÿÿil ÿÿÿÿÿÿÿÿÿsJIPv6 Addresses can't be larger than 0xffffffffffffffffffffffffffffffff: %siii ii!R›sonly IPv4 and IPv6 supported(RnRpR¬R�Rstsyst hexversiontzfill(RoR�R™RÏRˆ((s'/usr/lib/python2.7/site-packages/IPy.pyR“•s2         cCs0|dkrdS|dkr dStdƒ‚dS(sƒReturn number of bits in address for a certain IP version. >>> _ipVersionToLen(4) 32 >>> _ipVersionToLen(6) 128 >>> _ipVersionToLen(5) Traceback (most recent call last): File "", line 1, in ? File "IPy.py", line 1076, in _ipVersionToLen raise ValueError("only IPv4 and IPv6 supported") ValueError: only IPv4 and IPv6 supported ii ii€sonly IPv4 and IPv6 supportedN(Rp(R�((s'/usr/lib/python2.7/site-packages/IPy.pyt_ipVersionToLenºs   cCs@t|ƒdkrdS|ddkr*dSdt|dƒSdS(sDReturn number of elements containing 0 at the beginning of the list.iiN(RvRž(RÏ((s'/usr/lib/python2.7/site-packages/IPy.pyRžÑs t0000t0010t2t3t0100t4t0101t5t0110t6t0111t7t1000t8t1001t9t1010tat1011tbt1100tct1101tdtet1111tfcCsª|dkrtdƒ‚nt|ƒjƒ}d}|ddkrP|d }nx |dD]}|t|7}q[Wx0|ddkr¥t|ƒdkr¥|d}qvW|S( s9Return the binary representation of an integer as string.isOnly positive values allowedR’iÿÿÿÿRÏiRi(RpR¬R­t _BitTableRv(tvalRÕR™Rˆ((s'/usr/lib/python2.7/site-packages/IPy.pyR–às  %cCs1d}x$|dkr,|d?}|d7}q W|S(s,Find the highest bit set to 1 in an integer.ii((tnumR™((s'/usr/lib/python2.7/site-packages/IPy.pyRxðs  cCspt|ƒ}|dkr+td|ƒ‚nd}x8|dkrk|d@dkrTPn|d?}|d7}q4W|S(s,Find the highest bit set to 0 in an integer.is Only positive Numbers please: %si(RnRp(RR™((s'/usr/lib/python2.7/site-packages/IPy.pyt _count0Bitsøs   cCsit|ƒ}|dks$||kr(dS|dkrA|d}n t|ƒ}|||kradSdSdS(sJCheck the validity of a prefix Checks if the variant part of a prefix only has 0s, and the length is correct. >>> _checkPrefix(0x7f000000, 24, 4) 1 >>> _checkPrefix(0x7f000001, 24, 4) 0 >>> repr(_checkPrefix(0x7f000001, -1, 4)) 'None' >>> repr(_checkPrefix(0x7f000001, 33, 4)) 'None' iiN(RèRjR(RoR‡R�R˜tzbits((s'/usr/lib/python2.7/site-packages/IPy.pyt _checkPrefixs    cCs­t|ƒ}|}xD|d@dkrX|dkrX|d?}|d8}|dkrPqqWxM|dkr¨|d@dkr‘tdt|ƒƒ‚n|d?}|d8}q\WdS(s2Checks if a netmask is expressable as a prefixlen.iis+Netmask %s can't be expressed as an prefix.N(RnRpR¬(R�tmasklenRR˜((s'/usr/lib/python2.7/site-packages/IPy.pyt _checkNetmask(s     cCs|t||ƒ@|kS(sBCheck if a base addess of a network is compatible with a prefixlen(R}(R‘R‡R�((s'/usr/lib/python2.7/site-packages/IPy.pyR~<scCs-t|ƒ}t|ƒ}t||ƒ||S(snConvert an Integer representing a netmask to a prefixlen. E.g. 0xffffff00 (255.255.255.0) returns 24 (RRxR (R�tnetlenR ((s'/usr/lib/python2.7/site-packages/IPy.pyR|As   cCsI|dkrdS|dkr+tdƒ‚nd|d>dt|ƒ|>S(sÑReturn a mask of n bits as a long integer. From 'IP address conversion functions with the builtin socket module' by Alex Martelli http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66517 isPrefixlen must be > 0ii(RpRè(R‡R�((s'/usr/lib/python2.7/site-packages/IPy.pyR}Ms   t__main__i(RÍt __version__RåttypesR²R³ReRyRâRwR“RèRžRR–RxRR R R~R|R}RËtdoctestttestmodtfailuretnbtesttexit(((s'/usr/lib/python2.7/site-packages/IPy.pytsò      ÿÿ�Ï x L %