4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
8 license-file: doc/LICENSE
15 Hath manipulates network blocks in CIDR notation.
17 Hath is a Haskell program for working with network blocks in CIDR
18 notation. When dealing with blocks of network addresses, there are a
19 few things that one usually wants to do with them:
21 * Create a regular expression matching the CIDR block(s). This is
22 because grep will throw up if you feed it CIDR.
24 * Combine small blocks into larger ones. For example, if you have two
25 consecutive \/24s, they might combine into a larger \/23.
27 * View the result of block combination in a useful way.
31 * Find their associated PTR records.
33 Hath has several modes to perform these functions:
36 This computes a (Perl-compatible) regular expression matching
37 the input CIDR blocks. It's the default mode of operation.
40 This combines small blocks into larger ones where possible, and
41 eliminates redundant blocks. The output should be equivalent to
45 Shows only the blocks that would be removed by reduce; that is, it
46 shows the ones that would get combined into larger blocks or are
50 Shows what would change if you used reduce. Uses diff-like
54 List the IP addresses contained within the given CIDRs.
57 Perform reverse DNS (PTR) lookups on the IP addresses contained
58 within the given CIDRs.
62 Compute a (Perl-compatible) regular expression matching
63 the input CIDR blocks. It's the default mode of operation.
66 $ hath <<< \"10.0.0.0\/29 10.0.0.8\/29\"
67 ((10)\.(0)\.(0)\.(15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0))
70 Combine two \/24s into a \/23:
73 $ hath reduced <<< \"10.0.0.0\/24 10.0.1.0\/24\"
77 List the addresses in 192.168.0.240\/29:
80 $ hath listed <<< 192.168.0.240\/29
91 Perform PTR lookups on all of 198.41.0.4\/30:
94 $ hath reversed <<< 198.41.0.4\/30
95 198.41.0.4: a.root-servers.net.
97 198.41.0.6: rs.internic.net.
101 The DNS lookups are usually the bottleneck for this mode, but we can
102 perform them in parallel. Simply pass the number of threads to the
103 GHC runtime on the command line; for example, the following will
104 perform 25 lookups in parallel:
107 $ hath reversed +RTS -N25 <<< 198.41.0.4\/24
108 198.41.0.4: a.root-servers.net.
110 198.41.0.6: rs.internic.net.
114 The command-line syntax and complete set of options are documented in
147 tasty-quickcheck >= 0.8.1
152 -fwarn-missing-signatures
153 -fwarn-name-shadowing
157 -fwarn-incomplete-record-updates
158 -fwarn-monomorphism-restriction
159 -fwarn-unused-do-bind
173 type: exitcode-stdio-1.0
174 hs-source-dirs: src test
175 main-is: TestSuite.hs
187 tasty-quickcheck >= 0.8.1
190 -- It's not entirely clear to me why I have to reproduce all of this.
194 -fwarn-missing-signatures
195 -fwarn-name-shadowing
199 -fwarn-incomplete-record-updates
200 -fwarn-monomorphism-restriction
201 -fwarn-unused-do-bind
209 -- These won't work without shelltestrunner installed in your
210 -- $PATH. Maybe there is some way to tell Cabal that.
211 test-suite shelltests
212 type: exitcode-stdio-1.0
214 main-is: ShellTests.hs
227 tasty-quickcheck >= 0.8.1
229 -- It's not entirely clear to me why I have to reproduce all of this.
233 -fwarn-missing-signatures
234 -fwarn-name-shadowing
238 -fwarn-incomplete-record-updates
239 -fwarn-monomorphism-restriction
240 -fwarn-unused-do-bind
248 test-suite shelltests-net
249 type: exitcode-stdio-1.0
251 main-is: ShellTestsNet.hs
264 tasty-quickcheck >= 0.8.1
266 -- It's not entirely clear to me why I have to reproduce all of this.
270 -fwarn-missing-signatures
271 -fwarn-name-shadowing
275 -fwarn-incomplete-record-updates
276 -fwarn-monomorphism-restriction
277 -fwarn-unused-do-bind
285 source-repository head
287 location: http://michael.orlitzky.com/git/hath.git