4 author: Michael Orlitzky
5 maintainer: Michael Orlitzky <michael@orlitzky.com>
6 homepage: http://michael.orlitzky.com/code/hath.php
9 license-file: doc/LICENSE
16 Hath manipulates network blocks in CIDR notation.
18 Hath is a Haskell program for working with network blocks in CIDR
19 notation. When dealing with blocks of network addresses, there are a
20 few things that one usually wants to do with them:
22 * Create a regular expression matching the CIDR block(s). This is
23 because grep will throw up if you feed it CIDR.
25 * Combine small blocks into larger ones. For example, if you have two
26 consecutive \/24s, they might combine into a larger \/23.
28 * View the result of block combination in a useful way.
32 * Find their associated PTR records.
34 Hath has several modes to perform these functions:
37 This computes a (Perl-compatible) regular expression matching
38 the input CIDR blocks. It's the default mode of operation.
41 This combines small blocks into larger ones where possible, and
42 eliminates redundant blocks. The output should be equivalent to
46 Shows only the blocks that would be removed by reduce; that is, it
47 shows the ones that would get combined into larger blocks or are
51 Shows what would change if you used reduce. Uses diff-like
55 List the IP addresses contained within the given CIDRs.
58 Perform reverse DNS (PTR) lookups on the IP addresses contained
59 within the given CIDRs.
63 Compute a (Perl-compatible) regular expression matching
64 the input CIDR blocks. It's the default mode of operation.
67 $ echo \"10.0.0.0\/29 10.0.0.8\/29\" | hath
68 ((10)\.(0)\.(0)\.(15|14|13|12|11|10|9|8|7|6|5|4|3|2|1|0))
71 Combine two \/24s into a \/23:
74 $ echo \"10.0.0.0\/24 10.0.1.0\/24\" | hath reduced
78 List the addresses in 192.168.0.240\/29:
81 $ echo 192.168.0.240\/29 | hath listed
92 Perform PTR lookups on all of 198.41.0.4\/30:
95 $ echo 198.41.0.4\/30 | hath reversed
96 198.41.0.4: a.root-servers.net.
98 198.41.0.6: rs.internic.net.
102 The DNS lookups are usually the bottleneck for this mode, but we can
103 perform them in parallel. Simply pass the number of threads to the
104 GHC runtime on the command line; for example, the following will
105 perform 25 lookups in parallel:
108 $ echo 198.41.0.4\/24 | hath reversed +RTS -N25
109 198.41.0.4: a.root-servers.net.
111 198.41.0.6: rs.internic.net.
115 The command-line syntax and complete set of options are documented in
148 tasty-quickcheck >= 0.8.1
153 -fwarn-missing-signatures
154 -fwarn-name-shadowing
158 -fwarn-incomplete-record-updates
159 -fwarn-monomorphism-restriction
160 -fwarn-unused-do-bind
174 type: exitcode-stdio-1.0
175 hs-source-dirs: src test
176 main-is: TestSuite.hs
188 tasty-quickcheck >= 0.8.1
191 -- It's not entirely clear to me why I have to reproduce all of this.
195 -fwarn-missing-signatures
196 -fwarn-name-shadowing
200 -fwarn-incomplete-record-updates
201 -fwarn-monomorphism-restriction
202 -fwarn-unused-do-bind
210 -- These won't work without shelltestrunner installed in your
211 -- $PATH. Maybe there is some way to tell Cabal that.
212 test-suite shelltests
213 type: exitcode-stdio-1.0
215 main-is: ShellTests.hs
228 tasty-quickcheck >= 0.8.1
230 -- It's not entirely clear to me why I have to reproduce all of this.
234 -fwarn-missing-signatures
235 -fwarn-name-shadowing
239 -fwarn-incomplete-record-updates
240 -fwarn-monomorphism-restriction
241 -fwarn-unused-do-bind
249 test-suite shelltests-net
250 type: exitcode-stdio-1.0
252 main-is: ShellTestsNet.hs
265 tasty-quickcheck >= 0.8.1
267 -- It's not entirely clear to me why I have to reproduce all of this.
271 -fwarn-missing-signatures
272 -fwarn-name-shadowing
276 -fwarn-incomplete-record-updates
277 -fwarn-monomorphism-restriction
278 -fwarn-unused-do-bind
286 source-repository head
288 location: http://michael.orlitzky.com/git/hath.git