michael orlitzky

Hath

Get It

The development version can be found in the hath git repository. There isn't an official release yet, because I haven't convinced myself that it's any good.

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 you (i.e. I) want to do with them:

Hath does just that. It takes as its input (via stdin, or a file with the -i parameter) a list of CIDR blocks. From now on, assume we have the following in cidrs.txt:

10.0.0.0/24
10.0.1.0/24

Modes

Hath has the following modes:

  1. Regexed

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

    1
    2
    $ hath -i cidrs.txt
    ([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1)\.(0)[^\.0-9])
  2. Reduced

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

    1
    2
    $ hath reduced -i cidrs.txt
    10.0.0.0/23
  3. 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.

    1
    2
    3
    $ hath duped -i cidrs.txt
    10.0.0.0/24
    10.0.1.0/24
  4. Diffed

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

    1
    2
    3
    4
    $ hath diffed -i cidrs.txt
    -10.0.0.0/24
    -10.0.1.0/24
    +10.0.0.0/23

Each of the modes also supports a present-tense flavor; the following are equivalent to their counterparts: regex, reduce, dupe, diff.

Bugs

Email them to me at that address on the home page.