michael orlitzky

hath

Get It

The development version can be found in the hath git repository. Official releases can be found on the hath hackage page.

About

Hath is a Haskell program for working with network blocks in CIDR notation. When dealing with blocks of network addresses, there are a few things that one usually wants to do with them:

Hath does just that. It takes as its input (via stdin) a list of CIDR blocks.

Modes

Hath has the following modes:

Regexed

This computes a (Perl-compatible) regular expression matching the input CIDR blocks. It's the default mode of operation.

user $ echo "10.0.0.0/29 10.0.0.8/29" | hath

((10)\.(0)\.(0)\.(15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0))

Reduced

This combines small blocks into larger ones where possible, and eliminates redundant blocks. The output should be equivalent to the input, though.

user $ echo "10.0.0.0/24 10.0.1.0/24" | hath reduced

10.0.0.0/23

Duped

Shows only the blocks that would be removed by reduce; that is, it shows the ones that would get combined into larger blocks or are simply redundant.

user $ echo "10.0.0.0/24 10.0.1.0/24" | hath duped

10.0.0.0/24

10.0.1.0/24

Diffed

Shows what would change if you used reduce. Uses diff-like notation.

user $ echo "10.0.0.0/24 10.0.1.0/24" | hath diffed

-10.0.0.0/24

-10.0.1.0/24

+10.0.0.0/23

Listed

List the IP addresses contained within the given CIDRs.

user $ echo 192.168.0.240/29 | hath listed

192.168.0.240

192.168.0.241

192.168.0.242

192.168.0.243

192.168.0.244

192.168.0.245

192.168.0.246

192.168.0.247

The command-line syntax and complete set of options are documented in the man page.

Bugs

Email them to me at michael@orlitzky.com.