iptools

Python utilites for manipulating IP addresses
Download

iptools Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Bryan Davis
  • Publisher web site:
  • http://code.google.com/u/casadebender/

iptools Tags


iptools Description

Python utilites for manipulating IP addresses The iptools package contains a few useful functions and objects for manipulating ip addresses in Python. This was all inspired by a desire to be able to use CIDR address notation to designate INTERNAL_IPS in a Django project's settings file.Functions: * validate_ip: Validate a dotted quad ip address. * ip2long: Convert a dotted quad ip address to a network byte order 32-bit integer. * long2ip: Convert a network byte order 32-bit integer to a dotted quad ip address. * validate_cidr: Validate a CIDR notation ip address. * cidr2block: Convert a CIDR notation ip address into a tuple containing network block start and end addresses. Objects: * IpRange: Range of ip addresses providing `in` and iteration. * IpRangeList: List of IpRange objects providing `in` and iteration. Using with DjangoThe IpRangeList object can be used in a django settings file to allow CIDR notation and/or (start, end) ranges to be used in the INTERNAL_IPS list.Example:#!/usr/bin/env pythonimport iptoolsINTERNAL_IPS = iptools.IpRangeList( '127.0.0.1', # single ip '192.168/16', # CIDR network block ('10.0.0.1', '10.0.0.19'), # inclusive range)Python Version CompatibilityThis library has been tested with Python versions 2.3.5, 2.6.2, & 2.3.1 on Ubuntu x86_64 and Python 2.6.1 & 2.6.4 on Snow Leopard.InstallingInstall the latest stable version using easy_install:easy_install iptoolsor pip:pip install iptoolsInstall the latest development version:svn checkout http://python-iptools.googlecode.com/svn/trunk/ python-iptoolscd python-iptoolspython setup.py install Requirements: · Python


iptools Related Software