5 Hath is a Haskell program for working with network blocks in CIDR[1]
6 notation. When dealing with blocks of network addresses, there are a
7 few things that you (i.e. I) want to do with them:
9 * Create a regular expression matching the CIDR block(s). This is
10 because grep will throw up if you feed it CIDR.
12 * Combine small blocks into larger ones. For example, if you have two
13 consecutive /24s, they might combine into a larger /23.
15 * View the result of block combination in a useful way.
17 Hath does just that. It takes as its input (via stdin, or a file with
18 the -i parameter) a list of CIDR blocks. From now on, assume we have
19 the following in cidrs.txt:
28 Hath has the following modes:
32 This computes a (Perl-compatible) regular expression matching
33 the input CIDR blocks. It's the default mode of operation.
36 ([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1)
41 This combines small blocks into larger ones where possible, and
42 eliminates redundant blocks. The output should be equivalent to
45 $ hath reduced -i cidrs.txt
50 Shows only the blocks that would be removed by reduce; that is, it
51 shows the ones that would get combined into larger blocks or are
54 $ hath duped -i cidrs.txt
60 Shows what would change if you used reduce. Uses diff-like
63 $ hath diffed -i cidrs.txt
68 Each of the modes also supports a present-tense flavor; the following
69 are equivalent to their counterparts: regex, reduce, dupe, diff.
75 Send bugs to the moon[2].
79 [1] http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
81 [2] michael@orlitzky.com