Fast conversion of IPv4 ranges into CIDR form
Timothy Rice db03541c74 Add licence | 6 anos atrás | |
---|---|---|
.gitignore | 6 anos atrás | |
LICENSE.md | 6 anos atrás | |
Makefile | 6 anos atrás | |
README.md | 6 anos atrás | |
args.h | 6 anos atrás | |
cider.c | 6 anos atrás | |
io.c | 6 anos atrás | |
io.h | 6 anos atrás | |
parse.c | 6 anos atrás | |
parse.h | 6 anos atrás |
Convert IPv4 ranges into CIDR form.
A faster and more script-friendly version of ipcalc's deaggregation function.
cider [-?hvV] [--help] [--help] [--usage] [--version] [--version] [file]
-?, --help Give this help list
-h, --help Print this help message.
--usage Give a short usage message
-v, --version Print version information.
-V, --version Print program version
If [file]
is omitted, Cider will read from stdin
.
Read from stdin:
$ cider <<< 192.168.0.128-192.168.1.255
192.168.0.128/25
192.168.1.0/24
Read from a file:
$ cat > /tmp/10.x.x.x << EOF
> 10.0.0.0-10.255.255.255
> EOF
$ cider /tmp/10.x.x.x
10.0.0.0/8
Convert all Australian ranges:
$ curl -s https://www.nirsoft.net/countryip/au.csv | awk -F, '{OFS="-"; print $1, $2}' | cider
1.40.0.0/14
1.44.0.0/16
1.120.0.0/13
1.128.0.0/11
1.178.0.0/16
1.179.0.0/17
14.2.0.0/16
14.137.0.0/17
14.137.128.0/18
... (truncated)
Other libc
s may or may not work, depending on whether they ship with their own variants of sys/socket.h
, netinet/in.h
and arpa/inet.h
.