IP Manager is a Python library that provides advanced operations on IP addresses:
- ✅ Validation of IP addresses and CIDR.
- 🔄 Conversion between binary and decimal notation.
- 🛠 Subnet mask calculation.
- 📍 Network address range determination.
- 🚀 Network optimization for a given number of hosts.
Make sure you have Python 3.x installed on your machine, then clone the repository:
git clone https://github.com/thamnis/ip_manager.git
cd ip_managerExample usage of the Ip class:
from ip_manager import Ip
# Creating an instance with an IP address
ip_instance = Ip("192.168.1.0/24")
print(f"IP Address: {ip_instance.ip}")
print(f"CIDR: {ip_instance.cidr}")
print(f"Decimal Mask: {ip_instance.mask_dec}")
print(f"Address Range: {ip_instance.ip_range}")Run an example:
python main.pyIf you want to optimize your network for a given number of hosts:
optimized_network = ip_instance.optimize_network(50)
print(optimized_network)No external dependencies are required. The script works with Python's standard modules.
A test file test.py is available to validate the functionalities.
python -m unittest test.pyThis project is licensed under the MIT License. See the LICENSE file for more details.
Developed by @thamnis.