]> gitweb.michael.orlitzky.com - hath.git/blob - doc/man1/hath.1
Update man page and cabal file examples.
[hath.git] / doc / 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 .P
27 Hath does just that. It takes as its input (via stdin, or a file with
28 the -i parameter) a list of CIDR blocks.
29 .SH MODES
30 .P
31 Hath has several modes:
32 .IP \(bu 2
33 \fBRegexed\fR
34 .P
35 This computes a (Perl-compatible) regular expression matching
36 the input CIDR blocks. It's the default mode of operation.
37 .P
38 .nf
39 .I $ hath <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
40 ([^\.0-9](10)\.(0)\.(0)\.(0)[^\.0-9]|[^\.0-9](10)\.(0)\.(1)
41 \.(0)[^\.0-9])
42 .fi
43 .IP \(bu 2
44 \fBReduced\fR
45 .P
46 This combines small blocks into larger ones where possible, and
47 eliminates redundant blocks. The output should be equivalent to
48 the input, though.
49 .P
50 .nf
51 .I $ hath reduced <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
52 10.0.0.0/23
53 .fi
54 .IP \(bu 2
55 \fBDuped\fR
56 .P
57 Shows only the blocks that would be removed by reduce; that is, it
58 shows the ones that would get combined into larger blocks or are
59 simply redundant.
60 .P
61 .nf
62 .I $ hath duped <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
63 10.0.0.0/24
64 10.0.1.0/24
65 .fi
66 .IP \(bu 2
67 \fBDiffed\fR
68 .P
69 Shows what would change if you used reduce. Uses diff-like
70 notation.
71 .P
72 .nf
73 .I $ hath diffed <<< \(dq10.0.0.0/24 10.0.1.0/24\(dq
74 -10.0.0.0/24
75 -10.0.1.0/24
76 +10.0.0.0/23
77 .fi
78 .IP \(bu 2
79 \fBListed\fR
80 .P
81 List the IP addresses contained within the given CIDRs.
82 .P
83 .nf
84 .I $ hath listed <<< \(dq192.168.0.240/29\(dq
85 192.168.0.240
86 192.168.0.241
87 192.168.0.242
88 192.168.0.243
89 192.168.0.244
90 192.168.0.245
91 192.168.0.246
92 192.168.0.247
93 .fi
94 .IP \(bu 2
95 \fBReversed\fR
96 .P
97 Perform reverse DNS (PTR) lookups on the IP addresses contained within
98 the given CIDRs.
99 .P
100 .nf
101 .I $ hath reversed <<< \(dq198.41.0.4\/30\(dq
102 198.41.0.4: a.root-servers.net.
103 198.41.0.5:
104 198.41.0.6: rs.internic.net.
105 198.41.0.7:
106 .fi
107 .P
108 Each of the modes also supports a present-tense flavor; the following
109 are equivalent to their counterparts: \fBregex\fR, \fBreduce\fR,
110 \fBdupe\fR, \fBdiff\fR, \fBlist\fR, \fBreverse\fR.
111
112 .SH OPTIONS
113
114 .IP \fB\-\-input\fR,\ \fB\-i\fR
115 Specify the input file containing a list of CIDRs, rather than using
116 stdin (the default).