1.4 IPWildcard Objects

An IPWildcard object represents a range or block of IP addresses. The IPWildcard object handles iteration over IP addresses with for x in wildcard.

class IPWildcard( wildcard)
The constructor takes a string representation wildcard of the wildcard address.

The string wildcard can be in CIDR notation, an integer, an integer with a CIDR designation, or an entry in SiLK wildcard notation. In SiLK wildcard notation, a wildcard is represented as a string IP address in canonical form with an x representing an entire octet or hexadectet. An IP wildcard string can also have lists or ranges in place of an octet or hexadectet. IPv6 wildcard addresses are only accepted if ipv6_enabled() returns True.

Examples:

>>> a = IPWildcard('1.2.3.0/24')
>>> b = IPWildcard('ff80::/16')
>>> c = IPWildcard('1.2.3.4')
>>> d = IPWildcard('::FFFF:0102:0304')
>>> e = IPWildcard('16909056')
>>> f = IPWildcard('16909056/24')
>>> g = IPWildcard('1.2.3.x')
>>> h = IPWildcard('1:2:3:4:5:6:7.x')
>>> i = IPWildcard('1.2,3.4,5.6,7')
>>> j = IPWildcard('1.2.3.0-255')
>>> k = IPWildcard('::2-4')
>>> l = IPWildcard('1-2:3-4:5-6:7-8:9-a:b-c:d-e:0-ffff')

Supported operations:

Operation Result
addr in wildcard True if addr is in wildcard, False otherwise
addr not in wildcard False if addr is in wildcard, True otherwise
string in wildcard Same as: IPAddr(string) in wildcard
string not in wildcard Same as: IPAddr(string) not in wildcard

Instance methods:

__str__( )
For an IP wildcard wild, str(wild) returns the string that was used to make the wildcard.