https://github.com/cdzombak/cidrtool
Simple command line tool for manipulating CIDR blocks
https://github.com/cdzombak/cidrtool
cidr-notation
Last synced: 12 months ago
JSON representation
Simple command line tool for manipulating CIDR blocks
- Host: GitHub
- URL: https://github.com/cdzombak/cidrtool
- Owner: cdzombak
- License: lgpl-3.0
- Created: 2018-03-29T18:09:26.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2024-07-18T15:17:28.000Z (almost 2 years ago)
- Last Synced: 2025-06-22T21:46:31.252Z (12 months ago)
- Topics: cidr-notation
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cidrtool
`cidrtool` is a simple command line tool to manipulate CIDR blocks.
## Usage
### Expand netblock
`cidrtool --expand` reads a list of CIDR blocks from stdin and expands them to a list of IP addresses.
```shell
echo "192.168.0.0/16" | cidrtool --expand
```
### Collapse netblocks
`cidrtool --collapse4` or `--collapse6` reads a list of IP v4 or v6 addresses from stdin and collapses them to a list of CIDR blocks.
```shell
echo "192.0.2.0/25
192.0.2.128/25" | cidrtool --collapse4
```
## Requirements
`cidrtool` requires Python 3. In particular, `/usr/bin/env python3` must be a usable Python 3 interpreter.
## Installation
### Debian/derivatives via apt repository
Install my Debian repository, if you haven't already:
```shell
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://dist.cdzombak.net/deb.key | sudo gpg --dearmor -o /etc/apt/keyrings/dist-cdzombak-net.gpg
sudo chmod 0644 /etc/apt/keyrings/dist-cdzombak-net.gpg
echo -e "deb [signed-by=/etc/apt/keyrings/dist-cdzombak-net.gpg] https://dist.cdzombak.net/deb/oss any oss\n" | sudo tee -a /etc/apt/sources.list.d/dist-cdzombak-net.list > /dev/null
sudo apt-get update
```
Then install `cidrtool` via `apt-get`:
```shell
sudo apt-get install cidrtool
```
### macOS via Homebrew
```shell
brew install cdzombak/oss/cidrtool
```
## License
`cidrtool` is licensed under the LGPL-3.0 License. See the [LICENSE](LICENSE) file for details.
## Author
Chris Dzombak
- [dzombak.com](https://dzombak.com)
- [github.com/cdzombak](https://github.com/cdzombak)