4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
8 license-file: doc/LICENSE
13 Hath manipulates network blocks in CIDR notation.
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 has several modes to perform these functions:
34 This computes a (Perl-compatible) regular expression matching
35 the input CIDR blocks. It's the default mode of operation.
38 This combines small blocks into larger ones where possible, and
39 eliminates redundant blocks. The output should be equivalent to
43 Shows only the blocks that would be removed by reduce; that is, it
44 shows the ones that would get combined into larger blocks or are
48 Shows what would change if you used reduce. Uses diff-like
52 List the IP addresses contained within the given CIDRs.
55 Perform reverse DNS (PTR) lookups on the IP addresses contained
56 within the given CIDRs.
60 Combine two \/24s into a \/23:
63 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
67 Create a perl-compatible regex to be fed to grep:
70 $ grep -P `hath regexed -i cidrs.txt` mail.log
73 List the addresses in 192.168.0.240\/29:
76 $ hath listed <<< \"192.168.0.240\/29\"
87 Perform PTR lookups on all of 198.41.0.4\/30:
90 hath reversed <<< \"198.41.0.4\/30\"
91 198.41.0.4: a.root-servers.net.
93 198.41.0.6: rs.internic.net.
97 The DNS lookups are usually the bottleneck for this mode, but we can
98 perform them in parallel. Simply pass the number of threads to the
99 GHC runtime on the command line; for example, the following will
100 perform 25 lookups in parallel:
103 hath reversed +RTS -N25 <<< \"198.41.0.4\/24\"
104 198.41.0.4: a.root-servers.net.
106 198.41.0.6: rs.internic.net.
130 base >= 4.6 && < 4.7,
131 bytestring == 0.10.*,
137 parallel-io == 0.3.*,
139 test-framework == 0.8.*,
140 test-framework-hunit == 0.3.*,
141 test-framework-quickcheck2 == 0.3.*
146 -fwarn-missing-signatures
147 -fwarn-name-shadowing
151 -fwarn-incomplete-record-updates
152 -fwarn-monomorphism-restriction
153 -fwarn-unused-do-bind
167 type: exitcode-stdio-1.0
168 hs-source-dirs: src test
169 main-is: TestSuite.hs
172 base >= 4.6 && < 4.7,
173 bytestring == 0.10.*,
179 parallel-io == 0.3.*,
181 test-framework == 0.8.*,
182 test-framework-hunit == 0.3.*,
183 test-framework-quickcheck2 == 0.3.*
185 -- It's not entirely clear to me why I have to reproduce all of this.
189 -fwarn-missing-signatures
190 -fwarn-name-shadowing
194 -fwarn-incomplete-record-updates
195 -fwarn-monomorphism-restriction
196 -fwarn-unused-do-bind
204 -- These won't work without shelltestrunner installed in your
205 -- $PATH. Maybe there is some way to tell Cabal that.
206 test-suite shelltests
207 type: exitcode-stdio-1.0
209 main-is: ShellTests.hs
212 base >= 4.6 && < 4.7,
213 bytestring == 0.10.*,
219 parallel-io == 0.3.*,
222 test-framework == 0.8.*,
223 test-framework-hunit == 0.3.*,
224 test-framework-quickcheck2 == 0.3.*
226 -- It's not entirely clear to me why I have to reproduce all of this.
230 -fwarn-missing-signatures
231 -fwarn-name-shadowing
235 -fwarn-incomplete-record-updates
236 -fwarn-monomorphism-restriction
237 -fwarn-unused-do-bind
245 test-suite shelltests-net
246 type: exitcode-stdio-1.0
248 main-is: ShellTestsNet.hs
251 base >= 4.6 && < 4.7,
252 bytestring == 0.10.*,
258 parallel-io == 0.3.*,
261 test-framework == 0.8.*,
262 test-framework-hunit == 0.3.*,
263 test-framework-quickcheck2 == 0.3.*
265 -- It's not entirely clear to me why I have to reproduce all of this.
269 -fwarn-missing-signatures
270 -fwarn-name-shadowing
274 -fwarn-incomplete-record-updates
275 -fwarn-monomorphism-restriction
276 -fwarn-unused-do-bind
284 source-repository head
286 location: http://michael.orlitzky.com/git/hath.git