netaddr is a Python library for the manipulation of various common network address notations and representations.
It takes the hassle out of fiddling with innumerable variations of network addresses, presenting a consistent, extensible, easy-to-use, Pythonic API.
With it you can validate, convert, categorize, iterate, generate, slice (and dice) :-
- IP version 4 addresses
- IP version 6 addresses
- IPv4 and IPv6 CIDR (Classless Inter-Domain Routing) addresses
- MAC (Media Access Control) and IEEE EUI-48 and EUI-64 identifiers
- Support for arbitrary IP address range manipulations (with full CIDR conversions and interoperability)
- IPv4 glob-style address ranges with a user friendly syntax (useful in configuration scenarios where end-users may not be networking experts)
You can also take a look at the API documentation.
Current stable release is version 0.6.x. Please see the detailed CHANGELOG for latest changes and updates.
Enjoy!