Skip to content

Add IP Address Classification with Network & Host#56

Merged
Vaibhav2154 merged 1 commit intoVaibhav2154:mainfrom
shirshanag:feat/ip
Sep 9, 2025
Merged

Add IP Address Classification with Network & Host#56
Vaibhav2154 merged 1 commit intoVaibhav2154:mainfrom
shirshanag:feat/ip

Conversation

@shirshanag
Copy link
Contributor

@shirshanag shirshanag commented Aug 29, 2025

This PR introduces a Python script that classifies an IP address into its respective class (A–E) and provides associated network and host information such as Net Mask, Net ID, Host Mask, and Host ID.

Changes Introduced

Implemented IP parsing from user input.

Added binary conversion function usage (dec_bin) for class detection.

Classification of IP into classes A–E.

Implemented calculations for:

Net Mask

Net ID

Host Mask

Host ID

Handles cases where classification is not applicable (NA) (e.g., Class D/E).

Example Usage

Input:

Enter ip address: 123.3.6.5

Output::

Class: A
Net Mask= [255, 0, 0, 0]
Net ID= [123, 0, 0, 0]
Host Mask = [0, 255, 255, 255]
Host ID = [0, 3, 6, 5]

Benefits

Provides a quick way to classify IPs and analyze their network details.

Modular implementation, easy to extend for subnetting or CIDR notation.

User-friendly output.

Next Steps / Improvements

Add input validation (e.g., invalid IP formats, octets > 255).

Implement subnetting & CIDR support.

Add unit tests to ensure accuracy across all IP classes.

Improve code readability (e.g., refactor into functions).

Closes Issue no:
#53

@vercel
Copy link

vercel bot commented Aug 29, 2025

@shirshanag is attempting to deploy a commit to the vaibhav2154's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@Vaibhav2154 Vaibhav2154 merged commit 3da5208 into Vaibhav2154:main Sep 9, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants