Skip to main content

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)
  • 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).

Metadata

Release files for subnethostcount 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subnethostcount 0.1.5
File Size Uploaded
subnethostcount-0.1.5.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for subnethostcount 0.1.5
File Interpreter ABI Platform
subnethostcount-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / subnethostcount-0.1.5.tar.gz

Download URL subnethostcount-0.1.5.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c5e93c51007943b5f8a2cd2af6069fbdc9086b2b0edf149db52aacba987245e7
BLAKE2b-256 checksum
How to use checksums
0a3483635c3aa1bed456fe40e3048a97d8e3bde825492a6bc8fa9e802fbd3f08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / subnethostcount-0.1.5-py3-none-any.whl

Download URL subnethostcount-0.1.5-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62ebe9c491fd3ab28509e18bd8ea3a0e5bbadba06a7af008673c487cfa9fd405
BLAKE2b-256 checksum
How to use checksums
12c90951055c63355c2ff649b1f4a9365afbea35b8217d1addaedb3246651775
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page