Count usable IPv4 hosts across CIDR subnets and individual IP addresses.
Project description
SubnetHostCount
Simple python to count hosts in a list of subnets and ip addresses
CIDR Host Counter
This script reads a file containing IPv4 CIDR notations or individual IP addresses and calculates the total number of valid hosts. It excludes network and broadcast addresses for subnets, but counts single IPs (e.g., 10.0.0.5) as one valid host.
Features
- Accepts a file containing:
- IPv4 CIDR ranges (e.g.,
192.168.1.0/24) - Individual IP addresses (e.g.,
10.0.0.5)
- IPv4 CIDR ranges (e.g.,
- Excludes network and broadcast addresses from the host count
- Ignores empty lines and lines starting with
# - Warns about invalid lines with a descriptive message
- Identifies duplicates (-D to list hosts appearing in multiple files)
- Calculates RFC1918 private vs public host counts (-r)
Usage
Prerequisites
Python 3.6+
Command
python HostCount.py -d path/to/cidrs.txt
or
subnethostcount -d path/to/cidrs.txt
Optional flags:
-
-D,--duplicates
When processing a directory, list hosts that appear in more than one file and which files they appear in. -
-r,--rfc1918
Show how many hosts are in RFC1918 private address space vs how many are not (prints per-file and totals).
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subnethostcount-0.1.5.tar.gz.
File metadata
- Download URL: subnethostcount-0.1.5.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e93c51007943b5f8a2cd2af6069fbdc9086b2b0edf149db52aacba987245e7
|
|
| MD5 |
72a77b3e8242c9ec28f05eb4e5448671
|
|
| BLAKE2b-256 |
0a3483635c3aa1bed456fe40e3048a97d8e3bde825492a6bc8fa9e802fbd3f08
|
File details
Details for the file subnethostcount-0.1.5-py3-none-any.whl.
File metadata
- Download URL: subnethostcount-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62ebe9c491fd3ab28509e18bd8ea3a0e5bbadba06a7af008673c487cfa9fd405
|
|
| MD5 |
9fd591dbaf9283e95e1a37980fdf0e51
|
|
| BLAKE2b-256 |
12c90951055c63355c2ff649b1f4a9365afbea35b8217d1addaedb3246651775
|