4 hath \- Manipulate network blocks in CIDR notation
7 \fBhath\fR [\fBregexed|reduced|duped|diffed\fR] [\fB\-h\fR] [\fB-i \fIFILE\fR] \fI<input>\fR
10 The \fIinput\fR (default: stdin) should be a list of CIDR blocks,
11 separated by whitespace. Empty lines will be ignored, but otherwise,
12 malformed entries will cause an error to be displayed.
15 Hath is a Haskell program for working with network blocks in CIDR
16 notation. When dealing with blocks of network addresses, there are a
17 few things that one usually wants to do with them:
19 Create a regular expression matching the CIDR block(s). This is
20 because grep will throw up if you feed it CIDR.
22 Combine small blocks into larger ones. For example, if you have two
23 consecutive /24s, they might combine into a larger /23.
25 View the result of block combination in a useful way.
29 Find their associated PTR records.
31 Hath does just that. It takes as its input (via stdin, or a file with
32 the -i parameter) a list of CIDR blocks.
35 Hath has several modes:
39 This computes a (Perl-compatible) regular expression matching
40 the input CIDR blocks. It's the default mode of operation.
43 .I $ hath <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
44 ([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1)
50 This combines small blocks into larger ones where possible, and
51 eliminates redundant blocks. The output should be equivalent to
55 .I $ hath reduced <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
61 Shows only the blocks that would be removed by reduce; that is, it
62 shows the ones that would get combined into larger blocks or are
66 .I $ hath duped <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
73 Shows what would change if you used reduce. Uses diff-like
77 .I $ hath diffed <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
85 List the IP addresses contained within the given CIDRs.
88 .I $ hath listed <<< \(dq192.168.0.240/29\(dq
101 Perform reverse DNS (PTR) lookups on the IP addresses contained within
105 .I $ hath reversed <<< \(dq198.41.0.4/30\(dq
106 198.41.0.4: a.root-servers.net.
108 198.41.0.6: rs.internic.net.
112 The DNS lookups are usually the bottleneck for this mode, but we can
113 perform them in parallel. Simply pass the number of threads to the GHC
114 runtime on the command line; for example, the following will perform
115 25 lookups in parallel:
118 .I $ hath reversed +RTS -N25 <<< \(dq198.41.0.4/24\(dq
119 198.41.0.4: a.root-servers.net.
121 198.41.0.6: rs.internic.net.
125 Each of the modes also supports a present-tense flavor; the following
126 are equivalent to their counterparts: \fBregex\fR, \fBreduce\fR,
127 \fBdupe\fR, \fBdiff\fR, \fBlist\fR, \fBreverse\fR.
131 .IP \fB\-\-input\fR,\ \fB\-i\fR
132 Specify the input file containing a list of CIDRs, rather than using