# IP Tools Validate, classify, and inspect IPs and CIDR networks. Pure stdlib (`ipaddress`). ``` python scripts/run.py info 192.168.1.10 python scripts/run.py info 10.0.0.0/24 python scripts/run.py validate 8.8.8.8 999.1.1.1 python scripts/run.py contains 10.0.0.0/8 10.4.5.6 echo "2001:db8::1" | python scripts/run.py info - ``` Supports IPv4 and IPv6. --- name: ip-tools display_name: IP Tools description: "Parse and inspect IPv4/IPv6 addresses and CIDR ranges: validate, classify private/global, show netmask, broadcast, host count, and test membership. Triggers: validate ip, cidr range, is ip in subnet, network broadcast, private or public ip." --- # IP Tools Inspect IP addresses and CIDR networks from chat, using Python's `ipaddress`. ## When to use The user has an IP address or CIDR block and wants to validate it, classify it (private/global/loopback/etc.), see its netmask/broadcast/host count, or check whether an address falls inside a subnet. ## How to use Run `scripts/run.py` with a subcommand: - `python scripts/run.py info 192.168.1.10` — classify a single address. - `python scripts/run.py info 10.0.0.0/24` — netmask, broadcast, host count, first/last host. - `python scripts/run.py validate 8.8.8.8 999.1.1.1` — validate; exits 1 if any invalid. - `python scripts/run.py contains 10.0.0.0/8 10.4.5.6` — membership test (exit 0 if inside, 3 if not). - `echo "2001:db8::1" | python scripts/run.py info -` — read targets from stdin. ## Pitfalls - For networks, host bits set are tolerated (`strict=False`), so `10.0.0.5/24` is read as `10.0.0.0/24`. - IPv4 usable-host count subtracts network+broadcast for /30 and shorter; /31 and /32 report raw counts. - `contains` uses exit code 3 for "not a member" so it scripts cleanly.
IP Tools by langbot-team
Parse and inspect IPv4/IPv6 addresses and CIDR ranges: validate, classify private/global, show netmask, broadcast, host count, and test membership.
Loading...