code » python » ipcalc
ipcalc
| Author: | Wijnand Modderman |
|---|---|
| Description: | IPv4 and IPv6 network calculator |
| Keywords: | ipcalc network subnet ipv4 ipv6 cidr |
| Version: | 0.1 |
| License: | BSD |
Example
>>> from ipcalc import Network, IP
>>> for x in Network('172.16.42.0/30'):
... print str(x)
...
172.16.42.0
172.16.42.1
172.16.42.2
172.16.42.3
>>> subnet = Network('2001:beef:babe::/48')
>>> print str(subnet.network())
2001:beef:babe:0000:0000:0000:0000:0000
>>> print str(subnet.netmask())
ffff:ffff:ffff:0000:0000:0000:0000:0000
>>> '192.168.42.23' in Network('192.168.42.0/24')
True
>>> long(IP('fe80::213:ceff:fee8:c937'))
338288524927261089654168587652869703991L
Download
| Stable: | http://tehmaze.com/asset/code/python/ipcalc-0.1.tar.bz2 |
|---|---|
| Checksum MD5: | 9a445fc643b49ddb8a11160cfae2eb00 |
| Checksum SHA1: | 69160e17759cc035e4cc8e23648c53c28a6b18b1 |