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.
112 base >= 4.6 && < 4.7,
113 bytestring == 0.10.*,
118 parallel-io == 0.3.*,
120 test-framework == 0.8.*,
121 test-framework-hunit == 0.3.*,
122 test-framework-quickcheck2 == 0.3.*
144 -fwarn-missing-signatures
145 -fwarn-name-shadowing
149 -fwarn-incomplete-record-updates
150 -fwarn-monomorphism-restriction
151 -fwarn-unused-do-bind
165 type: exitcode-stdio-1.0
166 hs-source-dirs: src test
167 main-is: TestSuite.hs
169 base >= 4.6 && < 4.7,
170 bytestring == 0.10.*,
175 parallel-io == 0.3.*,
177 test-framework == 0.8.*,
178 test-framework-hunit == 0.3.*,
179 test-framework-quickcheck2 == 0.3.*
181 -- It's not entirely clear to me why I have to reproduce all of this.
185 -fwarn-missing-signatures
186 -fwarn-name-shadowing
190 -fwarn-incomplete-record-updates
191 -fwarn-monomorphism-restriction
192 -fwarn-unused-do-bind
199 source-repository head
201 location: http://michael.orlitzky.com/git/hath.git