Generate a list of IPs for a given Network ID
Project description
# IPGenerator
-------------
############################################
__Program__: IPGenerator
__version__: 0.3.1
__Author__ : Boumediene Kaddour
__Email__ : snboumediene@gmail.com
__Website__: http://www.pentestingskills.com
############################################
This is a very simple third-party python module that generates list of ALL IPs for a given network, the module provides a couple of other information as well, through out the Class IPGen for instance, you can get the first IP, the last IP, the BROADCAST address or the network ID, in addition, you can generate the list of IPs which is returned as a list.
The module provides another Class for performing an informtion gathering, for example you can use the localIP() method to get the local IP address, or you can use other methods to get other info like MASK(), GATEWAY(), GW_MAC() ... etc.
Requirements:
------------
No third-party mudules are needed, which means the tool has been built from scratch, i'm using only the AF_INET, SOCK_STREAM and inet_ntoa socket methods.
Usage:
-----
# Generating List of IPs
------------------------
>>> from IPGenerator import IPGen, Netinfo
>>> ip = IPGenerator("172.16.122.1/28")
>>> ip.isNetOK()
>>> True
>>> iplist = ip.IPGen()
>>> for IP in iplist:
>>> .... print IP
172.16.122.1
172.16.122.2
172.16.122.3
172.16.122.4
172.16.122.5
172.16.122.6
172.16.122.7
172.16.122.8
172.16.122.9
172.16.122.10
172.16.122.11
172.16.122.12
172.16.122.13
172.16.122.14
# Getting the local IP address
------------------------------
>>> LIP = Netinfo().localIP()
>>> print "The local IP address is: %s "%LIP
>>> The local IP address is: 172.16.122.99
>>> print Netinfo().MASK()
255.255.255.0
>>> print Netinfo().GATEWAY()
172.16.122.1
-------------
############################################
__Program__: IPGenerator
__version__: 0.3.1
__Author__ : Boumediene Kaddour
__Email__ : snboumediene@gmail.com
__Website__: http://www.pentestingskills.com
############################################
This is a very simple third-party python module that generates list of ALL IPs for a given network, the module provides a couple of other information as well, through out the Class IPGen for instance, you can get the first IP, the last IP, the BROADCAST address or the network ID, in addition, you can generate the list of IPs which is returned as a list.
The module provides another Class for performing an informtion gathering, for example you can use the localIP() method to get the local IP address, or you can use other methods to get other info like MASK(), GATEWAY(), GW_MAC() ... etc.
Requirements:
------------
No third-party mudules are needed, which means the tool has been built from scratch, i'm using only the AF_INET, SOCK_STREAM and inet_ntoa socket methods.
Usage:
-----
# Generating List of IPs
------------------------
>>> from IPGenerator import IPGen, Netinfo
>>> ip = IPGenerator("172.16.122.1/28")
>>> ip.isNetOK()
>>> True
>>> iplist = ip.IPGen()
>>> for IP in iplist:
>>> .... print IP
172.16.122.1
172.16.122.2
172.16.122.3
172.16.122.4
172.16.122.5
172.16.122.6
172.16.122.7
172.16.122.8
172.16.122.9
172.16.122.10
172.16.122.11
172.16.122.12
172.16.122.13
172.16.122.14
# Getting the local IP address
------------------------------
>>> LIP = Netinfo().localIP()
>>> print "The local IP address is: %s "%LIP
>>> The local IP address is: 172.16.122.99
>>> print Netinfo().MASK()
255.255.255.0
>>> print Netinfo().GATEWAY()
172.16.122.1
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
IPGenerator-0.3.1.tar.gz
(3.7 kB
view hashes)