https://github.com/codeexpress/cidr2ip
Convert CIDR blocks to constituent IP addresses
https://github.com/codeexpress/cidr2ip
cidr-notation cidr-range cidr-subnet cidr2ip golang golang-tools ip-address ip-range ipv4 network
Last synced: about 1 month ago
JSON representation
Convert CIDR blocks to constituent IP addresses
- Host: GitHub
- URL: https://github.com/codeexpress/cidr2ip
- Owner: codeexpress
- License: gpl-3.0
- Created: 2019-02-03T20:16:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-19T00:37:02.000Z (over 3 years ago)
- Last Synced: 2025-12-17T14:53:04.078Z (2 months ago)
- Topics: cidr-notation, cidr-range, cidr-subnet, cidr2ip, golang, golang-tools, ip-address, ip-range, ipv4, network
- Language: Go
- Size: 23.4 KB
- Stars: 47
- Watchers: 2
- Forks: 13
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cidr2ip
This program converts IPv4 CIDR blocks into their constituent IP addresses.
### Input modes
1. Commnd line arguments
```
code@express:~$ cidr2ip 10.0.0.0/30 192.68.0.0/30
10.0.0.1
10.0.0.2
192.68.0.1
192.68.0.2
```
The `-r` flag outputs IP ranges seperated by hyphen.
```
code@express:~$ cidr2ip -r 10.0.0.0/30 192.68.0.0/30
10.0.0.1-10.0.0.2
192.68.0.1-192.68.0.2
```
2. Piped input
```
code@express:~$ cat cidrs.txt | cidr2ip
192.168.0.101
192.168.0.102
```
3. File input
```
code@express:~$ cidr2ip -f cidrs.txt
192.168.0.101
192.168.0.102
```
### Install
#### Use `go install`
If you have `golang` tools installed, you can download and build the source code
locally as follows:
```
go install github.com/codeexpress/cidr2ip@latest
```
#### Download from the releases pages
Download pre-built binary from the [releases page](https://github.com/codeexpress/cidr2ip/releases/latest). Rename it to `cidr2ip`. Optionally, add it to your `PATH` to be able to invoke `cidr2ip` from any directory without specifying the full path to binary.