CS50.Final.Project.-.Subnets.Visualization.Tool.mp4
This project provides a tool to visualize IP Subnets within a given Network. It takes a network in CIDR notation, a list of occupied Subnets, and an end prefix length to determine the depth of the subnet tree. The tool then generates a visual representation of the Subnets using the Graphviz library.
- Visualize a given network's Subnets up to a specified Subnet Mask.
- Highlight Occupied Subnets within the Network.
- Option for a full representation of Occupied Subnets.
git clone https://github.com/FilippoCiarlo/Subnet-Visualization-Tool.git
cd Subnet-Visualization-Tool
pip install ipaddress
pip install graphviz
python main.py
4. Enter the Target Network Address in CIDR notation:
Input the IP address of the network you wish to analyze, using Classless Inter-Domain Routing (CIDR) notation. CIDR notation is a method used to create unique identifiers for networks and individual devices. This notation combines the standard IP address with a suffix that indicates the number of bits that represent the network portion of the address. For example, '192.168.1.0/24' indicates a network IP address of '192.168.1.0' with a subnet mask of 24 bits. This step is crucial for accurately defining the scope and range of the network for your analysis.
![Network](https://private-user-images.githubusercontent.com/26838702/287523534-1464e550-e250-4447-a979-249a8f02a733.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjM1MzQtMTQ2NGU1NTAtZTI1MC00NDQ3LWE5NzktMjQ5YThmMDJhNzMzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmODc2NjA1Y2NhMTBhNzI3ZDQwMWNhYWI5Mjg5MTg0ZWNhYzY0OWEzZTcyOWI1YTUxMzk5YTMyNjY1ZDVkZDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.aJqS5tl8NOn_5BWNlCn3V1UBAWlQj4V_eN7k_JWUFNc)
5. Enter the Count and Details of Occupied Subnets in CIDR notation:
Specify the number of subnets that are currently in use within your network, and provide their corresponding IP addresses using Classless Inter-Domain Routing (CIDR) notation.
![Occupied Subnets](https://private-user-images.githubusercontent.com/26838702/287523843-1cd17e08-a364-47db-a61f-f2fb447a91d2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjM4NDMtMWNkMTdlMDgtYTM2NC00N2RiLWE2MWYtZjJmYjQ0N2E5MWQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTM4NzFmYWE5ZWE2NjY3NWE2ZjliZTA0ZjNkMWQzNWY1MDA1NmMwY2QwZTg0YjQ3ZjU1YzkxZjQ2NzNiNzlkZGImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FxOpccHcSEUz8eRlKGFk3iQzFmv1A4To97zNbpjwZ48)
![Full or Compact Representation](https://private-user-images.githubusercontent.com/26838702/287524046-f465b03f-71a4-4462-ac67-e867ebf456d9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjQwNDYtZjQ2NWIwM2YtNzFhNC00NDYyLWFjNjctZTg2N2ViZjQ1NmQ5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgwMTNiNWIyNWVkMjU3OTI4ZDRmNGRmODQzNzQ0YzU3NzM3ZDdmNzEyM2I1NWYyOGRlM2U0M2FlNTQ4MzljNmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.pR8SLEOK9wIkIruslekCh2bUEzgQbBmqQjR9QNZj1s8)
This approach is comprehensive in nature, showcasing every layer of the network without exception. In Full Representation, all subnets, including subnets within occupied subnets, are displayed. This method ensures a complete, detailed view of the network's structure, leaving no stone unturned. It’s particularly useful for in-depth analysis, allowing network administrators to see every component and their interconnections.
![Full Representation](https://private-user-images.githubusercontent.com/26838702/287523945-00a25305-8bc7-4a1b-9a61-7f6d27a8f793.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjM5NDUtMDBhMjUzMDUtOGJjNy00YTFiLTlhNjEtN2Y2ZDI3YThmNzkzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM4YzM1YjhjYjUxMjQ2OTAzMDE5NDlkZDUyZDM2ZGYwMDA5MTk1Nzk2MTNkNzY0MWMzZTMyYWNiNzFjMTlkMWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nLZi5yww701qIMAc9R4zZr8L9NvQXHrYsLG-rMrTG5s)
In contrast, the Compact Representation adopts a more streamlined approach. When a subnet is occupied, its internal subnets are not visualized in the diagram. This form of representation focuses on the broader picture, omitting the finer details of occupied subnets. It’s akin to viewing a tree without examining the occpied leafs. This method is beneficial for general overviews or when the details of internal occupied subnets are not necessary for the task at hand.
![Compact Representation](https://private-user-images.githubusercontent.com/26838702/287523960-9593ba34-d89b-4ecb-9722-2c657654de87.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjM5NjAtOTU5M2JhMzQtZDg5Yi00ZWNiLTk3MjItMmM2NTc2NTRkZTg3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI1MjEyMWE5YWQ5ZGJjMDdmMDA4YzY5MjZmNmNhYzE3ZTE4YWFiNTZiMGFhOWIzYWY1Njk5NGFlYTAxNWUwZmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.NZT8VosqMCmgMQgrPu-Mz_6WpoXPqjE62tap1PjQ6AU)
By specifying the maximum subnet mask for your network, you are effectively setting the tree depth in your network structure. This value determines how detailed or granular your network tree will be, representing the deepest level of subnetting possible within your network hierarchy. A more specific subnet mask correlates with a deeper tree depth, allowing for finer segmentation and organization of network addresses.
![Maximum Subnet Mask Value](https://private-user-images.githubusercontent.com/26838702/287524395-90196351-5576-4263-9805-0d587ff88188.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjQzOTUtOTAxOTYzNTEtNTU3Ni00MjYzLTk4MDUtMGQ1ODdmZjg4MTg4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWFjY2E1MjU4OTIxN2RlNmM4ZTViMDRkZTU5ZjJlNzI3ZjUxNzZhZjRmYjliOWU2NDVlNjM2NGEyZjIzZjU2ZmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.R3X1JyuiPAcMrOapt8-04KCBTAlSkQySl6-lmXPrFPY)
Upon completion of the analysis, the tool will automatically generate a visual representation of the Subnet Tree. This visualization will be saved as a PDF file, named subnets_tree.pdf
, and it will be located in your project's directory. This file provides a comprehensive graphical representation of the network's subnet structure, making it easier to understand and analyze the network's hierarchy and segmentation. You can access this file in the specified directory to view, share, or print the subnet tree for further use or documentation purposes.
![subnets_tree file](https://private-user-images.githubusercontent.com/26838702/287524794-85634924-ed15-4c5f-ac76-ef8797d5e092.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIwNjQ5NDAsIm5iZiI6MTcyMjA2NDY0MCwicGF0aCI6Ii8yNjgzODcwMi8yODc1MjQ3OTQtODU2MzQ5MjQtZWQxNS00YzVmLWFjNzYtZWY4Nzk3ZDVlMDkyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI3VDA3MTcyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNmNmI1YjliMDNlZjQzOTU0NmU4Mzg2NmQ0NGVmZjU3YzNmZDMzZTNlNjgxNWU0YWJmNzcyMWNlMjFlYjhkMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.odI8rFhPk8hgBAdDfyv4idFyV6cvYt-oCYo5A9Q0A10)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.