Skip to main content

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

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 details)

Uploaded Source

File details

Details for the file IPGenerator-0.3.1.tar.gz.

File metadata

  • Download URL: IPGenerator-0.3.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for IPGenerator-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a8bb00a00ad1b63689c2f1bc41a90e7c73120460145d557846a5e4ce8f3443c3
MD5 c60dbabf92c7087999b924c1bbdae405
BLAKE2b-256 d6ffbeac5083b34d95825406de371fa25a2a92641bb5d2a0e16b44f26e5d31c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page