]> gitweb.michael.orlitzky.com - hath.git/blob - man1/hath.1
hath.cabal: drop a word and a period from the synopsis
[hath.git] / man1 / hath.1
1 .TH hath 1
2
3 .SH NAME
4 hath \- Manipulate network blocks in CIDR notation
5 .SH SYNOPSIS
6
7 \fBhath\fR [\fBregexed|reduced|duped|diffed\fR] [\fB\-h\fR] [\fB-i \fIFILE\fR] \fI<input>\fR
8 .SH INPUT
9 .P
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.
13 .SH DESCRIPTION
14 .P
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:
18 .IP \(bu 2
19 Create a regular expression matching the CIDR block(s). This is
20 because grep will throw up if you feed it CIDR.
21 .IP \(bu
22 Combine small blocks into larger ones. For example, if you have two
23 consecutive /24s, they might combine into a larger /23.
24 .IP \(bu
25 View the result of block combination in a useful way.
26 .IP \(bu
27 List them.
28 .IP \(bu
29 Find their associated PTR records.
30 .P
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.
33 .SH MODES
34 .P
35 Hath has several modes:
36 .IP \(bu 2
37 \fBRegexed\fR
38 .P
39 This computes a (Perl-compatible) regular expression matching
40 the input CIDR blocks. It's the default mode of operation.
41 .P
42 .nf
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)
45 \.(0)[^\.0-9])
46 .fi
47 .IP \(bu 2
48 \fBReduced\fR
49 .P
50 This combines small blocks into larger ones where possible, and
51 eliminates redundant blocks. The output should be equivalent to
52 the input, though.
53 .P
54 .nf
55 .I $ hath reduced <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
56 10.0.0.0/23
57 .fi
58 .IP \(bu 2
59 \fBDuped\fR
60 .P
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
63 simply redundant.
64 .P
65 .nf
66 .I $ hath duped <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
67 10.0.0.0/24
68 10.0.1.0/24
69 .fi
70 .IP \(bu 2
71 \fBDiffed\fR
72 .P
73 Shows what would change if you used reduce. Uses diff-like
74 notation.
75 .P
76 .nf
77 .I $ hath diffed <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
78 -10.0.0.0/24
79 -10.0.1.0/24
80 +10.0.0.0/23
81 .fi
82 .IP \(bu 2
83 \fBListed\fR
84 .P
85 List the IP addresses contained within the given CIDRs.
86 .P
87 .nf
88 .I $ hath listed <<< \(dq192.168.0.240/29\(dq
89 192.168.0.240
90 192.168.0.241
91 192.168.0.242
92 192.168.0.243
93 192.168.0.244
94 192.168.0.245
95 192.168.0.246
96 192.168.0.247
97 .fi
98 .IP \(bu 2
99 \fBReversed\fR
100 .P
101 Perform reverse DNS (PTR) lookups on the IP addresses contained within
102 the given CIDRs.
103 .P
104 .nf
105 .I $ hath reversed <<< \(dq198.41.0.4/30\(dq
106 198.41.0.4: a.root-servers.net.
107 198.41.0.5:
108 198.41.0.6: rs.internic.net.
109 198.41.0.7:
110 .fi
111 .P
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:
116 .P
117 .nf
118 .I $ hath reversed +RTS -N25 <<< \(dq198.41.0.4/24\(dq
119 198.41.0.4: a.root-servers.net.
120 198.41.0.5:
121 198.41.0.6: rs.internic.net.
122 \(pc\(pc\(pc
123 .fi
124 .P
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.
128
129 .SH OPTIONS
130
131 .IP \fB\-\-input\fR,\ \fB\-i\fR
132 Specify the input file containing a list of CIDRs, rather than using
133 stdin (the default).